Require ifunc-capable linker for i386

The amd64 kernel started using ifunc for a variety of functions with
arch-specific implementations, and we would like to make use of the
same functionality on i386 and as much as possible avoid divergence
between i386 and amd64.  In particular, future changes for security
improvements and mitigations may rely on ifunc support.

Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Ed Maste 2018-09-18 15:01:21 +00:00
parent ba4704a278
commit 9ed6559e3e

View File

@ -121,10 +121,11 @@ CFLAGS+= ${CONF_CFLAGS}
LDFLAGS+= -Wl,--build-id=sha1
.endif
.if ${MACHINE_CPUARCH} == "amd64"
.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == ""
.error amd64 kernel requires linker ifunc support
.if (${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386") && \
defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == ""
.error amd64/i386 kernel requires linker ifunc support
.endif
.if ${MACHINE_CPUARCH} == "amd64"
LDFLAGS+= -Wl,-z max-page-size=2097152 -Wl,-z common-page-size=4096 -Wl,-z -Wl,ifunc-noplt
.endif