Error out on attempt to link amd64 kernel with old binutils linker

As of r333461 we require ifunc support to link a working amd64 kernel.
The default in-tree bootstrap linker is lld and it has the required
support, as does any modern out-of-tree binutils linker.  The in-tree
GNU ld is from binutils 2.17.50 and it does not have ifunc support,
so produce an error rather than a broken kernel.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D15378
This commit is contained in:
Ed Maste 2018-05-10 20:10:02 +00:00
parent 7bf272a612
commit ff8f1e8332
2 changed files with 4 additions and 0 deletions

View File

@ -71,6 +71,7 @@ ${X_}LINKER_VERSION!= echo "${_v:M[1-9].[0-9]*}" | \
${X_}LINKER_FEATURES=
.if ${${X_}LINKER_TYPE} != "bfd" || ${${X_}LINKER_VERSION} > 21750
${X_}LINKER_FEATURES+= build-id
${X_}LINKER_FEATURES+= ifunc
.endif
.if ${${X_}LINKER_TYPE} != "lld" || ${${X_}LINKER_VERSION} >= 50000
${X_}LINKER_FEATURES+= filter

View File

@ -121,6 +121,9 @@ LDFLAGS+= -Wl,--build-id=sha1
.endif
.if ${MACHINE_CPUARCH} == "amd64"
.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == ""
.error amd64 kernel requires linker ifunc support
.endif
LDFLAGS+= -Wl,-z max-page-size=2097152 -Wl,-z common-page-size=4096
.endif