From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 4796B3857C5E for ; Fri, 20 Aug 2021 10:29:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4796B3857C5E Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DBCC0101E; Fri, 20 Aug 2021 03:29:22 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 67D823F70D; Fri, 20 Aug 2021 03:29:22 -0700 (PDT) From: Richard Sandiford To: Iain Sandoe Mail-Followup-To: Iain Sandoe , GCC Patches , richard.sandiford@arm.com Cc: GCC Patches Subject: Re: [PATCH] configure: Allow a host makefile fragment to override PIE flag settings. References: <7F4EA5FF-0CDC-4C0C-BF2B-B276C1A4E434@sandoe.co.uk> <7E483B90-25B7-494C-9BC5-2BC51D2BEB78@sandoe.co.uk> Date: Fri, 20 Aug 2021 11:29:21 +0100 In-Reply-To: <7E483B90-25B7-494C-9BC5-2BC51D2BEB78@sandoe.co.uk> (Iain Sandoe's message of "Fri, 20 Aug 2021 11:13:09 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 10:29:24 -0000 Iain Sandoe writes: > Hi Richard, >> Maybe it would be easier to have the makefile fragments determine >> something like CODE_MODEL_CFLAGS, which can be "-fPIC", "-mdynamic-no-pi= c", >> etc., and use: >>=20 >> COMPILER +=3D $(NO_PIE_CFLAGS) $(CODE_MODEL_CFLAGS) > > OK. I have misgivings about this - the problem is that: > > -fPIC -fno-PIE !=3D -fno-PIE -fPIC, which is not obvious to many folks -= who expect that > the =E2=80=9Clast edition of a flag will be the one in force=E2=80=9D. > > So the PIE-ness and the PIC-ness are decoupled in the configury but they = need to be > ordered specifically for targets that want PIC code by default (FWIW, I d= on=E2=80=99t think Darwin > is the only default-PIC case here, from discussions on irc). Yeah, that's what the above was supposed to achieve. In other words, if you force non-PIE, you also need to follow that by $(CODE_MODEL_CFLAGS), which restates whatever the base code model is. If it's the decoupling you're worried about, then an alternative would be to have: NO_PIE_CFLAGS=3D"-fno-PIE \$(CODE_MODEL_CFLAGS)" I was going to suggest that originally, but thought the above might be simpler to follow later. Thanks, Richard