From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54393 invoked by alias); 16 Jul 2019 10:34:12 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 54097 invoked by uid 89); 16 Jul 2019 10:34:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,SEM_URI,SEM_URIRED,SPF_PASS autolearn=ham version=3.3.1 spammy=mailer X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Jul 2019 10:34:10 +0000 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 BD7BB2B; Tue, 16 Jul 2019 03:34:08 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.39]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CB0913F71A; Tue, 16 Jul 2019 03:34:07 -0700 (PDT) From: Richard Sandiford To: Christophe Lyon Mail-Followup-To: Christophe Lyon ,Christophe Lyon , Szabolcs Nagy , Rich Felker , nd , "gcc-patches\@gcc.gnu.org" , richard.sandiford@arm.com Cc: Christophe Lyon , Szabolcs Nagy , Rich Felker , nd , "gcc-patches\@gcc.gnu.org" Subject: Re: [ARM/FDPIC v5 03/21] [ARM] FDPIC: Force FDPIC related options unless -mno-fdpic is provided References: <20190515124006.25840-1-christophe.lyon@st.com> <20190515124006.25840-4-christophe.lyon@st.com> <67018f7b-f120-b33f-886f-c081a9ee1061@arm.com> <20190515143653.GT23599@brightrain.aerifal.cx> <20190515153718.GV23599@brightrain.aerifal.cx> <2d337959-2238-eb8d-012b-9f46e64728f8@arm.com> <20190515160646.GW23599@brightrain.aerifal.cx> <929589a5-dc82-087c-f9d8-dacbb55a82c3@arm.com> <611566ee-a939-aef6-4354-16fbf8ad822a@st.com> Date: Tue, 16 Jul 2019 10:38:00 -0000 In-Reply-To: <611566ee-a939-aef6-4354-16fbf8ad822a@st.com> (Christophe Lyon's message of "Thu, 23 May 2019 14:45:22 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2019-07/txt/msg01105.txt.bz2 Christophe Lyon writes: > On 22/05/2019 10:45, Christophe Lyon wrote: >> On Wed, 22 May 2019 at 10:39, Szabolcs Nagy wrote: >>> >>> On 21/05/2019 16:28, Christophe Lyon wrote: >>>> --- a/gcc/config/arm/linux-eabi.h >>>> +++ b/gcc/config/arm/linux-eabi.h >>>> @@ -89,7 +89,7 @@ >>>> #define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}" >>>> #endif >>>> #define MUSL_DYNAMIC_LINKER \ >>>> - "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1" >>>> + "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E >>>> "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1" >>> >>> the line break seems wrong (either needs \ or no newline) >>> >> Sorry, that's a mailer artifact. >> >>>> --- a/libsanitizer/configure.tgt >>>> +++ b/libsanitizer/configure.tgt >>>> @@ -45,7 +45,7 @@ case "${target}" in >>>> ;; >>>> sparc*-*-solaris2.11*) >>>> ;; >>>> - arm*-*-uclinuxfdpiceabi) >>>> + arm*-*-fdpiceabi) >>> >>> should be *fdpiceabi instead of *-fdpiceabi i think. >> >> Indeed, thanks >> . >> > FWIW, here is the updated patch: > - handles musl -fdpic suffix > - disables sanitizers for arm*-*-fdpiceabi > - does not handle -static in a special way, so using -static produces binaries that request the non-existing /usr/lib/ld.so.1, thus effectively making -static broken/unsupported (this does lead to a few more FAIL in the testsuite) > > The plan is to work -static-pie later, as discussed. Could you make -static without -mno-fdpic an error via a %e spec, so that the failure mode is a bit more user-friendly? I realise this isn't your preferred option, sorry. > diff --git a/gcc/config/arm/bpabi.h b/gcc/config/arm/bpabi.h > index e1bacf4..6c25a1a 100644 > --- a/gcc/config/arm/bpabi.h > +++ b/gcc/config/arm/bpabi.h > @@ -55,6 +55,8 @@ > #define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\ > "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}" > > +#define TARGET_FDPIC_ASM_SPEC "" Formatting nit: should be a single space before "" > + > #define BE8_LINK_SPEC \ > "%{!r:%{!mbe32:%:be8_linkopt(%{mlittle-endian:little}" \ > " %{mbig-endian:big}" \ > @@ -64,7 +66,7 @@ > /* Tell the assembler to build BPABI binaries. */ > #undef SUBTARGET_EXTRA_ASM_SPEC > #define SUBTARGET_EXTRA_ASM_SPEC \ > - "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}" TARGET_FIX_V4BX_SPEC > + "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}" TARGET_FIX_V4BX_SPEC TARGET_FDPIC_ASM_SPEC Long line. > diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h > index 66ec0ea..d7cc923 100644 > --- a/gcc/config/arm/linux-eabi.h > +++ b/gcc/config/arm/linux-eabi.h > @@ -89,7 +89,7 @@ > #define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}" > #endif > #define MUSL_DYNAMIC_LINKER \ > - "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1" > + "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1" > > /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to > use the GNU/Linux version, not the generic BPABI version. */ Rich, could you confirm that this is (going to be?) the correct name? > diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h > index 66ec0ea..d7cc923 100644 > --- a/gcc/config/arm/linux-eabi.h > +++ b/gcc/config/arm/linux-eabi.h > @@ -89,7 +89,7 @@ > #define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}" > #endif > #define MUSL_DYNAMIC_LINKER \ > - "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1" > + "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1" > > /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to > use the GNU/Linux version, not the generic BPABI version. */ > @@ -101,11 +101,14 @@ > #undef ASAN_CC1_SPEC > #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}" > > +#define FDPIC_CC1_SPEC "" > + > #undef CC1_SPEC > #define CC1_SPEC \ > - LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC " " ASAN_CC1_SPEC, \ > + LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC " " ASAN_CC1_SPEC " " \ > + FDPIC_CC1_SPEC, \ > GNU_USER_TARGET_CC1_SPEC " " ASAN_CC1_SPEC " " \ > - ANDROID_CC1_SPEC) > + ANDROID_CC1_SPEC "" FDPIC_CC1_SPEC) > > #define CC1PLUS_SPEC \ > LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) Does it make sense to add FDPIC_CC1_SPEC to the Android version? > diff --git a/gcc/config/arm/uclinuxfdpiceabi.h b/gcc/config/arm/uclinuxfdpiceabi.h > new file mode 100644 > index 0000000..3180bcd > --- /dev/null > +++ b/gcc/config/arm/uclinuxfdpiceabi.h > @@ -0,0 +1,52 @@ > +/* Configuration file for ARM GNU/Linux FDPIC EABI targets. > + Copyright (C) 2018 Free Software Foundation, Inc. > + Contributed by STMicroelectronics. > + > + This file is part of GCC. > + > + GCC is free software; you can redistribute it and/or modify it > + under the terms of the GNU General Public License as published > + by the Free Software Foundation; either version 3, or (at your > + option) any later version. > + > + GCC is distributed in the hope that it will be useful, but WITHOUT > + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public > + License for more details. > + > + You should have received a copy of the GNU General Public License > + along with GCC; see the file COPYING3. If not see > + . */ > + > +/* On uClibc EABI GNU/Linux, we want to force -mfdpic by default, > + which also means we produce PIE code by default. */ > +#undef FDPIC_CC1_SPEC > +#define FDPIC_CC1_SPEC \ > + "%{!mno-fdpic:-mfdpic %{!no-PIE:%{!fpie:%{!fPIC:%{!fpic: -fPIE}}}}}" Looks like the !no-PIE should be !fno-PIE. > +/* Add --fdpic assembler flag by default. */ > +#undef TARGET_FDPIC_ASM_SPEC > +#define TARGET_FDPIC_ASM_SPEC "%{!mno-fdpic: --fdpic}" Single space before the ". Thanks, Richard