svn commit: r360780 - in stable/12: share/mk sys/conf

John Baldwin jhb at FreeBSD.org
Thu May 7 14:20:53 UTC 2020


Author: jhb
Date: Thu May  7 14:20:52 2020
New Revision: 360780
URL: https://svnweb.freebsd.org/changeset/base/360780

Log:
  MFC 355428,356504: Add a new "riscv-relaxations" linker feature.
  
  355428:
  Add a new "riscv-relaxations" linker feature.
  
  When the linker doesn't have this feature, add -mno-relax to CFLAGS
  on RISC-V.
  
  Define the feature for ld.bfd, but not lld.  If lld gains relaxation
  support in a newer version, we can enable it for those versions of lld
  in bsd.linker.mk.
  
  356504:
  Add -mno-relax to CFLAGS in bsd.prog/lib.mk instead of bsd.cpu.mk.
  
  bsd.cpu.mk is included by bsd.init.mk before bsd.linker.mk, so it
  was always setting the flag since LINKER_FEATURES wasn't defined.

Modified:
  stable/12/share/mk/bsd.lib.mk
  stable/12/share/mk/bsd.linker.mk
  stable/12/share/mk/bsd.prog.mk
  stable/12/sys/conf/kern.mk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/mk/bsd.lib.mk
==============================================================================
--- stable/12/share/mk/bsd.lib.mk	Thu May  7 13:11:32 2020	(r360779)
+++ stable/12/share/mk/bsd.lib.mk	Thu May  7 14:20:52 2020	(r360780)
@@ -86,6 +86,10 @@ CXXFLAGS+= ${DEBUG_FILES_CFLAGS}
 CTFFLAGS+= -g
 .endif
 
+.if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == ""
+CFLAGS += -mno-relax
+.endif
+
 .include <bsd.libnames.mk>
 
 # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries

Modified: stable/12/share/mk/bsd.linker.mk
==============================================================================
--- stable/12/share/mk/bsd.linker.mk	Thu May  7 13:11:32 2020	(r360779)
+++ stable/12/share/mk/bsd.linker.mk	Thu May  7 14:20:52 2020	(r360780)
@@ -82,6 +82,9 @@ ${X_}LINKER_FEATURES=
 ${X_}LINKER_FEATURES+=	build-id
 ${X_}LINKER_FEATURES+=	ifunc
 .endif
+.if ${${X_}LINKER_TYPE} == "bfd" && ${${X_}LINKER_VERSION} > 21750
+${X_}LINKER_FEATURES+=	riscv-relaxations
+.endif
 .if ${${X_}LINKER_TYPE} != "lld" || ${${X_}LINKER_VERSION} >= 50000
 ${X_}LINKER_FEATURES+=	filter
 .endif

Modified: stable/12/share/mk/bsd.prog.mk
==============================================================================
--- stable/12/share/mk/bsd.prog.mk	Thu May  7 13:11:32 2020	(r360779)
+++ stable/12/share/mk/bsd.prog.mk	Thu May  7 14:20:52 2020	(r360780)
@@ -52,6 +52,10 @@ LDFLAGS+= -Wl,-zretpolineplt
 .endif
 .endif
 
+.if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == ""
+CFLAGS += -mno-relax
+.endif
+
 .if defined(CRUNCH_CFLAGS)
 CFLAGS+=${CRUNCH_CFLAGS}
 .else

Modified: stable/12/sys/conf/kern.mk
==============================================================================
--- stable/12/sys/conf/kern.mk	Thu May  7 13:11:32 2020	(r360779)
+++ stable/12/sys/conf/kern.mk	Thu May  7 14:20:52 2020	(r360780)
@@ -147,6 +147,10 @@ CFLAGS+=	-march=rv64imafdc -mabi=lp64
 CFLAGS.clang+=	-mcmodel=medium
 CFLAGS.gcc+=	-mcmodel=medany
 INLINE_LIMIT?=	8000
+
+.if ${LINKER_FEATURES:Mriscv-relaxations} == ""
+CFLAGS+=	-mno-relax
+.endif
 .endif
 
 #


More information about the svn-src-all mailing list