From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93529 invoked by alias); 1 Aug 2019 10:13:44 -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 92964 invoked by uid 89); 1 Aug 2019 10:13:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_MANYTO,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=nopie, PIE, Rich X-HELO: mail-lf1-f66.google.com Received: from mail-lf1-f66.google.com (HELO mail-lf1-f66.google.com) (209.85.167.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Aug 2019 10:13:42 +0000 Received: by mail-lf1-f66.google.com with SMTP id u10so11058051lfm.12 for ; Thu, 01 Aug 2019 03:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=EpZDvD3o+4e4SC4e7azc+U5IsPZ16hWeH7OOZ6kg/GY=; b=RSpluutzsXnjvitOTSI2Yh51a4q6uIkhVv0AfBwAKe4Cft25837G8OGaQ7/E6V+GJx 6E0/XfioN+LHjjGNT1J6IVBb9j1myBNPR1N8SNSEbbi4Q7m+BkMox2W2biV/WNPbKr3C HBvFhqStgMZNJySxVGaysKIQVker0qFQQbPOEMAz6o8dRk7aEckNOYLqj9KcxTy6BEHs oFIoLbW/4dJb3AR0hTXfdk6PwQuwk9TE5HjLL1+viqxvA+3hdr3KWPzSLSUvsLP2cCyg VRLrKS/HaZWIGLmXIVXATORh32+UIlcf/UKFY3kZ1+KeFHiCvR9GqtgbOxVoKCWXI8fa u6rQ== MIME-Version: 1.0 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> In-Reply-To: From: Christophe Lyon Date: Thu, 01 Aug 2019 10:13:00 -0000 Message-ID: Subject: Re: [ARM/FDPIC v5 03/21] [ARM] FDPIC: Force FDPIC related options unless -mno-fdpic is provided To: Christophe Lyon , Christophe Lyon , Szabolcs Nagy , Rich Felker , nd , "gcc-patches@gcc.gnu.org" , Richard Sandiford Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00016.txt.bz2 On Tue, 16 Jul 2019 at 12:34, Richard Sandiford wrote: > > 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? > Sure. Do you know if there is a way to catch linker options in the specs? Would it be possible to still accept -static -Wl,-dynamic-linker XXX ? > 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? No, I will remove it. > > > 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. Indeed. > > +/* Add --fdpic assembler flag by default. */ > > +#undef TARGET_FDPIC_ASM_SPEC > > +#define TARGET_FDPIC_ASM_SPEC "%{!mno-fdpic: --fdpic}" > > Single space before the ". > Thanks, Christophe > Thanks, > Richard