On Tue, 16 Jul 2019 at 12:34, Richard Sandiford <richard.sandif...@arm.com> wrote: > > Christophe Lyon <christophe.l...@st.com> writes: > > On 22/05/2019 10:45, Christophe Lyon wrote: > >> On Wed, 22 May 2019 at 10:39, Szabolcs Nagy <szabolcs.n...@arm.com> 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 > > + <http://www.gnu.org/licenses/>. */ > > + > > +/* 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