diff --git a/share/mk/bsd.linker.mk b/share/mk/bsd.linker.mk index d4ab69337f10..839479280ccc 100644 --- a/share/mk/bsd.linker.mk +++ b/share/mk/bsd.linker.mk @@ -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 diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 007a2355905b..a51378ef7695 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -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