svn commit: r364125 - in head: share/mk sys/conf

Alex Richardson arichardson at FreeBSD.org
Tue Aug 11 16:47:05 UTC 2020


Author: arichardson
Date: Tue Aug 11 16:47:00 2020
New Revision: 364125
URL: https://svnweb.freebsd.org/changeset/base/364125

Log:
  Allow linking the kernel with a linker that doesn't support -z ifunc-noplt
  
  This can happen when linking with upstream LLD < 9.0.
  
  Reviewed By:	markj
  Differential Revision: https://reviews.freebsd.org/D25985

Modified:
  head/share/mk/bsd.linker.mk
  head/sys/conf/kern.pre.mk

Modified: head/share/mk/bsd.linker.mk
==============================================================================
--- head/share/mk/bsd.linker.mk	Tue Aug 11 16:46:54 2020	(r364124)
+++ head/share/mk/bsd.linker.mk	Tue Aug 11 16:47:00 2020	(r364125)
@@ -94,6 +94,9 @@ ${X_}LINKER_FEATURES+=	riscv-relaxations
 .if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 60000
 ${X_}LINKER_FEATURES+=	retpoline
 .endif
+.if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 90000
+${X_}LINKER_FEATURES+=	ifunc-noplt
+.endif
 .endif
 .else
 # Use LD's values

Modified: head/sys/conf/kern.pre.mk
==============================================================================
--- head/sys/conf/kern.pre.mk	Tue Aug 11 16:46:54 2020	(r364124)
+++ head/sys/conf/kern.pre.mk	Tue Aug 11 16:47:00 2020	(r364125)
@@ -166,9 +166,13 @@ LDFLAGS+=	-z max-page-size=2097152
 .if ${LINKER_TYPE} != "lld"
 LDFLAGS+=	-z common-page-size=4096
 .else
+.if defined(LINKER_FEATURES) && !${LINKER_FEATURES:Mifunc-noplt}
+.warning "Linker ${LD} does not support -z ifunc-noplt -> ifunc calls are unoptimized."
+.else
 LDFLAGS+=	-z notext -z ifunc-noplt
 .endif
 .endif
+.endif  # ${MACHINE_CPUARCH} == "amd64"
 
 .if ${MACHINE_CPUARCH} == "riscv"
 # Hack: Work around undefined weak symbols being out of range when linking with


More information about the svn-src-head mailing list