Date: Fri, 21 Sep 2018 15:31:39 -0400 From: Mark Johnston <markj@freebsd.org> To: Ed Maste <emaste@freebsd.org> Cc: Mark Millard <marklmi@yahoo.com>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored Message-ID: <20180921193139.GB5120@raichu> In-Reply-To: <CAPyFy2BHUocGh-H8xfmdQXTTX_Qvoi50xKzoTGco8Cn9FfGcyQ@mail.gmail.com> References: <2E7136DD-9C25-44C1-8C9A-310C2D1D7189@yahoo.com> <CAPyFy2BHUocGh-H8xfmdQXTTX_Qvoi50xKzoTGco8Cn9FfGcyQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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@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 @@ -13,6 +13,9 @@ # 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 # @@ -85,6 +88,7 @@ ${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 @@ -121,12 +121,16 @@ 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}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180921193139.GB5120>