Message ID | 20200714174036.3735562-1-slyfox@gentoo.org |
---|---|
State | New |
Headers | show |
Series | [v2] sparc/sparc64: use crtendS.o for default-pie executables [PR96190] | expand |
> In --enable-default-pie mode compiler should switch from > using crtend.o to crtendS.o. On sparc it is especially important > because crtend.o contains PIC-unfriendly code. > > We use GNU_USER_TARGET_ENDFILE_SPEC as a baseline spec to get > crtendS.o instead of crtend.o in !no-pie mode. > > gcc: > > 2020-07-14 Sergei Trofimovich <siarheit@google.com> > > PR target/96190 > * config/sparc/linux.h: Extend GNU_USER_TARGET_ENDFILE_SPEC > to get crtendS.o for !no-pie mode. > * config/sparc/linux64.h: Ditto. This should be: PR target/96190 * config/sparc/linux.h (ENDFILE_SPEC): Use GNU_USER_TARGET_ENDFILE_SPEC to get crtendS.o for !no-pie mode. * config/sparc/linux64.h(ENDFILE_SPEC): Ditto. OK for mainline with this change. You can also put it on the 10 branch after the 10.1 release is out if this is deemed necessary.
> This should be: > > PR target/96190 > * config/sparc/linux.h (ENDFILE_SPEC): Use GNU_USER_TARGET_ENDFILE_SPEC > to get crtendS.o for !no-pie mode. > * config/sparc/linux64.h(ENDFILE_SPEC): Ditto. * config/sparc/linux64.h (ENDFILE_SPEC): Ditto. > OK for mainline with this change. You can also put it on the 10 branch > after the 10.1 release is out if this is deemed necessary. 10.2
On Wed, 15 Jul 2020 13:46:12 +0200 Eric Botcazou <botcazou@adacore.com> wrote: > > This should be: > > > > PR target/96190 > > * config/sparc/linux.h (ENDFILE_SPEC): Use GNU_USER_TARGET_ENDFILE_SPEC > > to get crtendS.o for !no-pie mode. > > * config/sparc/linux64.h(ENDFILE_SPEC): Ditto. > > * config/sparc/linux64.h (ENDFILE_SPEC): Ditto. > > > OK for mainline with this change. You can also put it on the 10 branch > > after the 10.1 release is out if this is deemed necessary. > > 10.2 Oh! Sent out v3 with tweaked description as https://gcc.gnu.org/pipermail/gcc-patches/2020-July/550168.html I don't have a push access to gcc tree. Should I request one via https://sourceware.org/cgi-bin/pdw/ps_form.cgi ?
> Oh! Sent out v3 with tweaked description as > https://gcc.gnu.org/pipermail/gcc-patches/2020-July/550168.html Thanks. > I don't have a push access to gcc tree. Should I request one via > https://sourceware.org/cgi-bin/pdw/ps_form.cgi ? Sure, you can put me (ebotcazou@libertysurf.fr) as sponsor if need be.
On Fri, 17 Jul 2020 10:19:41 +0200 Eric Botcazou <botcazou@adacore.com> wrote: > > Oh! Sent out v3 with tweaked description as > > https://gcc.gnu.org/pipermail/gcc-patches/2020-July/550168.html > > Thanks. > > > I don't have a push access to gcc tree. Should I request one via > > https://sourceware.org/cgi-bin/pdw/ps_form.cgi ? > > Sure, you can put me (ebotcazou@libertysurf.fr) as sponsor if need be. Got access and pushed as https://gcc.gnu.org/g:87891d5eafe8 Will cherry-pick it to gcc-10 as well after 10.2 release. Thank you!
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h index 81201e67a2f..63853e60c03 100644 --- a/gcc/config/sparc/linux.h +++ b/gcc/config/sparc/linux.h @@ -27,16 +27,10 @@ along with GCC; see the file COPYING3. If not see } \ while (0) -/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on - the GNU/Linux magical crtend.o file (see crtstuff.c) which - provides part of the support for getting C++ file-scope static - object constructed before entering `main', followed by a normal - GNU/Linux "finalizer" file, `crtn.o'. */ - #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ - %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" + GNU_USER_TARGET_ENDFILE_SPEC \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" /* -mcpu=native handling only makes sense with compiler running on a SPARC chip. */ diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h index a1a0efd8f28..19ce84d7adb 100644 --- a/gcc/config/sparc/linux64.h +++ b/gcc/config/sparc/linux64.h @@ -44,16 +44,10 @@ along with GCC; see the file COPYING3. If not see #undef ASM_CPU64_DEFAULT_SPEC #define ASM_CPU64_DEFAULT_SPEC "-Av9a" -/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on - the GNU/Linux magical crtend.o file (see crtstuff.c) which - provides part of the support for getting C++ file-scope static - object constructed before entering `main', followed by a normal - GNU/Linux "finalizer" file, `crtn.o'. */ - #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ - %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" + GNU_USER_TARGET_ENDFILE_SPEC \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" /* The default code model. */ #undef SPARC_DEFAULT_CMODEL
From: Sergei Trofimovich <siarheit@google.com> In --enable-default-pie mode compiler should switch from using crtend.o to crtendS.o. On sparc it is especially important because crtend.o contains PIC-unfriendly code. We use GNU_USER_TARGET_ENDFILE_SPEC as a baseline spec to get crtendS.o instead of crtend.o in !no-pie mode. gcc: 2020-07-14 Sergei Trofimovich <siarheit@google.com> PR target/96190 * config/sparc/linux.h: Extend GNU_USER_TARGET_ENDFILE_SPEC to get crtendS.o for !no-pie mode. * config/sparc/linux64.h: Ditto. --- gcc/config/sparc/linux.h | 10 ++-------- gcc/config/sparc/linux64.h | 10 ++-------- 2 files changed, 4 insertions(+), 16 deletions(-)