Skip to content

Commit

Permalink
sparc/sparc64: use crtendS.o for default-pie executables [PR96190]
Browse files Browse the repository at this point in the history
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  <[email protected]>

	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.
  • Loading branch information
trofi committed Jul 20, 2020
1 parent 4d1c5b4 commit 87891d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
10 changes: 2 additions & 8 deletions gcc/config/sparc/linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
10 changes: 2 additions & 8 deletions gcc/config/sparc/linux64.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 87891d5

Please sign in to comment.