On Fri, Sep 21, 2018 at 02:54:04PM -0400, Ed Maste wrote: > On 21 September 2018 at 01:59, Mark Millard via freebsd-toolchain > <freebsd-toolchain_at_freebsd.org> wrote: > > In looking into another report about using devel/amd64-gcc to buld > > head I tried a build of -r338675 ( with WERROR= ). It got: > > > ... > > > > Question: > > > > Is ignoring "-z ifunc-noplt" a problem for using what > > is built? > > This will have no functional impact, should just result in a missed > optimization. (We ought to avoid passing it to non-lld linkers > though.) Perhaps the following? It's not quite right since it'll still use -zifunc-noplt with an external LLVM toolchain, but I can't seem to figure out how to define a linker feature for only non-cross toolchains. In any case, we're going to upstream the option soon. diff --git a/share/mk/bsd.linker.mk b/share/mk/bsd.linker.mk index caf4fccbae0f..bee6a9e345dc 100644 --- a/share/mk/bsd.linker.mk +++ b/share/mk/bsd.linker.mk _at__at_ -13,6 +13,9 _at__at_ # linker support for that feature: # # - build-id: support for generating a Build-ID note +# - filter: support for filter DSOs +# - ifunc: support for GNU ifuncs +# - ifunc-noplt: support for optimized ifunc calls # - retpoline: support for generating PLT with retpoline speculative # execution vulnerability mitigation # _at__at_ -85,6 +88,7 _at__at_ ${X_}LINKER_FEATURES+= filter .endif .if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 60000 ${X_}LINKER_FEATURES+= retpoline +${X_}LINKER_FEATURES+= ifunc-noplt .endif .endif .else diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 523cea605afd..911f1accf1f6 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk _at__at_ -121,12 +121,16 _at__at_ CFLAGS+= ${CONF_CFLAGS} LDFLAGS+= -Wl,--build-id=sha1 .endif -.if (${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386") && \ - defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == "" +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" +.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == "" .error amd64/i386 kernel requires linker ifunc support .endif +.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc-noplt} != "" +LDFLAGS+= -Wl,-z -Wl,ifunc-noplt +.endif +.endif .if ${MACHINE_CPUARCH} == "amd64" -LDFLAGS+= -Wl,-z max-page-size=2097152 -Wl,-z common-page-size=4096 -Wl,-z -Wl,ifunc-noplt +LDFLAGS+= -Wl,-z max-page-size=2097152 -Wl,-z common-page-size=4096 .endif NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}Received on Fri Sep 21 2018 - 17:31:45 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:18 UTC