From owner-freebsd-toolchain@freebsd.org Fri Sep 21 19:31:45 2018 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C39E10A216C; Fri, 21 Sep 2018 19:31:45 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0BAB98D0FD; Fri, 21 Sep 2018 19:31:45 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pg1-x544.google.com with SMTP id r77-v6so1362023pgr.5; Fri, 21 Sep 2018 12:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3EUtzWnNKnTGrAQoghiXftRK7g0YWSB2jzzQiPcTRYo=; b=a4p5Lp2ykCm6i78Ir2vu+jtM4x4JMksSH2i3DWlkGlAORSSyUu5jixzbaldihvChym vm3plROIE63/afM9ifIiKWLWTXphJUS9gzpj9+B2yFnlkyrDT6ZIMyTmeLOprUnP8Tc5 k/DWFxgoqBIj1zii6sFBCBS3g6Ui5IL3A48/4OyYiNAR2PZpw4VP9GhEZqJioU+2Hb6A /jvdaTiqqEDJa7v6AK24PKy6PXAT9csRCshhVRe/VhY7/0J+yPHnW8+VUNvbQNwJCCl2 mLDNQDCwmHvcan551vcdbEGGt3akWDlv8AX0oT5c5R20cnIEn+j5TTrI7Lq+zejKbW0z AyBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=3EUtzWnNKnTGrAQoghiXftRK7g0YWSB2jzzQiPcTRYo=; b=LlGH3TmJunYzO9c6z3vUcFvi9CWZ0enc8dUq5GWlzqgidBKkrGTKvw3TaQnjM9n+wR qHtIDkDKyZ+EL1VugaXNk/UVmo3jQILWTY8gHdvbG7N+t/O+Qr16nJjGbUVNVSRymS8r XTQSgGvaJW4+Bvo2av4WTs/z0wax2AKlkAZbw+VZty5a45UmcJ0K24fLGEbvm+tKnEVR sgEAaDmg45z3f9PpZXjVwC8wSpWDfacRi7eAEOPLo6l1KZwMZvxeXCQVjvyd4Eb7ku5B nGc+ABIfLAx+YV9GQrWluPJVqyBVBzxePtYqMqOR60ydXsLj6Sfyrs0Bu6CHAxTphPPk p0aw== X-Gm-Message-State: APzg51BVP/Q7A2eR53RHYBrwkNGEgwPG8LmqK6+zlVWQ9RqtC+CH/DdI zV3+TR9JSMSIvSFng6R8oRaHBzCL X-Google-Smtp-Source: ANB0VdZAjrNjYkPIt2nqf+5uwskelR5/R6oZgE3IBhxb8BWm+g2Km6a9AkNn4DU6RrLbkamxOs7SAw== X-Received: by 2002:a63:4663:: with SMTP id v35-v6mr42885592pgk.178.1537558303560; Fri, 21 Sep 2018 12:31:43 -0700 (PDT) Received: from raichu (toroon0560w-lp130-01-174-88-78-8.dsl.bell.ca. [174.88.78.8]) by smtp.gmail.com with ESMTPSA id z11-v6sm47574136pfi.4.2018.09.21.12.31.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 12:31:42 -0700 (PDT) Sender: Mark Johnston Date: Fri, 21 Sep 2018 15:31:39 -0400 From: Mark Johnston To: Ed Maste Cc: Mark Millard , FreeBSD Toolchain , FreeBSD Current 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> References: <2E7136DD-9C25-44C1-8C9A-310C2D1D7189@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Sep 2018 19:31:45 -0000 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 > 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}