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
This commit is contained in:
Alex Richardson 2020-08-11 16:47:00 +00:00
parent fded98749a
commit 91b31c100b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364125
2 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -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