diff options
author | Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> | 2015-09-24 09:00:22 +0000 |
---|---|---|
committer | Rainer Orth <ro@gcc.gnu.org> | 2015-09-24 09:00:22 +0000 |
commit | df2a1cc48b45a5493646e14bcd81eff7d684e15b (patch) | |
tree | f52d2a26a4f1a076c6412585f560c29447771e77 /libgcc | |
parent | 2d11044217edd9168eafea1c8c60603f87b0e00d (diff) | |
download | gcc-df2a1cc48b45a5493646e14bcd81eff7d684e15b.zip gcc-df2a1cc48b45a5493646e14bcd81eff7d684e15b.tar.gz gcc-df2a1cc48b45a5493646e14bcd81eff7d684e15b.tar.bz2 |
Support PIE on Solaris
gcc/testsuite:
* lib/target-supports.exp (check_effective_target_pie): Check for
PIE support on Solaris 11.x and 12.
libgcc:
* config.host (*-*-solaris2*): Add t-crtstuff-pic to tmake_file.
Add crtbeginS.o, crtendS.o to extra_parts if libgcc_cv_solaris_crts.
* config/sol2/gmon.c: (monstartup): Don't write trailing NUL of
messages.
(internal_mcount): Likewise.
* config/sol2/t-sol2 (crtp.o, crtpg.o, gmon.o): Compile with
crt_compile, add CRTSTUFF_T_CFLAGS_S.
gcc:
* configure.ac (gcc_cv_ld_pie): Check for gld >= 2.26 on Solaris.
Check for ld -type pie on Solaris 11.x and 12.
* configure: Regenerate.
* config.in: Regenerate.
* gcc.c (LD_PIE_SPEC): Allow redefinition.
* config/sol2.h (STARTFILE_CRTBEGIN_SPEC): Define.
(STARTFILE_SPEC): Use it.
(ENDFILE_CRTEND_SPEC): Define.
(ENDFILE_SPEC): Use it and ENDFILE_ARCH_SPEC.
(SUBTARGET_EXTRA_SPECS): Add STARTFILE_CRTBEGIN_SPEC,
ENDFILE_ARCH_SPEC, ENDFILE_CRTEND_SPEC.
[HAVE_LD_PIE && HAVE_SOLARIS_CRTS] (LD_PIE_SPEC): Define.
(!(HAVE_LD_PIE && HAVE_SOLARIS_CRTS)] (LINK_PIE_SPEC): Define.
* config/i386/sol2.h (ENDFILE_SPEC): Remove.
(ENDFILE_ARCH_SPEC): Define.
* config/sparc/sol2.h (ENDFILE_ARCH_SPEC): Define.
From-SVN: r228078
Diffstat (limited to 'libgcc')
-rw-r--r-- | libgcc/ChangeLog | 10 | ||||
-rw-r--r-- | libgcc/config.host | 4 | ||||
-rw-r--r-- | libgcc/config.in | 3 | ||||
-rw-r--r-- | libgcc/config/sol2/gmon.c | 8 | ||||
-rw-r--r-- | libgcc/config/sol2/t-sol2 | 6 |
5 files changed, 23 insertions, 8 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 559f772..cc5c2c3 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,5 +1,15 @@ 2015-09-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + * config.host (*-*-solaris2*): Add t-crtstuff-pic to tmake_file. + Add crtbeginS.o, crtendS.o to extra_parts if libgcc_cv_solaris_crts. + * config/sol2/gmon.c: (monstartup): Don't write trailing NUL of + messages. + (internal_mcount): Likewise. + * config/sol2/t-sol2 (crtp.o, crtpg.o, gmon.o): Compile with + crt_compile, add CRTSTUFF_T_CFLAGS_S. + +2015-09-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + * configure.ac (libgcc_cv_solaris_crts): New test. * configure: Regenerate. * config.in: Regenerate. diff --git a/libgcc/config.host b/libgcc/config.host index 6c8b97b..2c64756 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -267,7 +267,7 @@ case ${host} in *-*-solaris2*) # Unless linker support and dl_iterate_phdr are present, # unwind-dw2-fde-dip.c automatically falls back to unwind-dw2-fde.c. - tmake_file="$tmake_file sol2/t-sol2 t-eh-dw2-dip t-libgcc-pic t-slibgcc t-slibgcc-elf-ver" + tmake_file="$tmake_file sol2/t-sol2 t-eh-dw2-dip t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-elf-ver" if test $with_gnu_ld = yes; then tmake_file="$tmake_file t-slibgcc-gld" else @@ -280,6 +280,8 @@ case ${host} in # Solaris 11.x and 12 provide crt1.o, crti.o, and crtn.o as part of the # base system. crtp.o and crtpg.o implement the compiler-dependent parts. extra_parts="$extra_parts crtp.o crtpg.o" + # If the Solaris CRTs are present, both ld and gld will have PIE support. + extra_parts="$extra_parts crtbeginS.o crtendS.o" else case ${host} in i?86-*-solaris2.1[0-9]* | x86_64-*-solaris2.1[0-9]*) diff --git a/libgcc/config.in b/libgcc/config.in index 25aa0d9..4d33411 100644 --- a/libgcc/config.in +++ b/libgcc/config.in @@ -21,6 +21,9 @@ /* Define if the system-provided CRTs are present on Solaris. */ #undef HAVE_SOLARIS_CRTS +/* Define if the system-provided CRTs are present on Solaris. */ +#undef HAVE_SOLARIS_CRTS + /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H diff --git a/libgcc/config/sol2/gmon.c b/libgcc/config/sol2/gmon.c index f641958..81a0346 100644 --- a/libgcc/config/sol2/gmon.c +++ b/libgcc/config/sol2/gmon.c @@ -114,12 +114,12 @@ monstartup (char *lowpc, char *highpc) monsize = (s_textsize / HISTFRACTION) + sizeof (struct phdr); buffer = sbrk (monsize); if (buffer == (void *) -1) { - write (STDERR_FILENO, MSG, sizeof (MSG)); + write (STDERR_FILENO, MSG, sizeof (MSG) - 1); return; } froms = sbrk (s_textsize / HASHFRACTION); if (froms == (void *) -1) { - write (STDERR_FILENO, MSG, sizeof (MSG)); + write (STDERR_FILENO, MSG, sizeof (MSG) - 1); froms = NULL; return; } @@ -131,7 +131,7 @@ monstartup (char *lowpc, char *highpc) } tos = sbrk (tolimit * sizeof (struct tostruct)); if (tos == (void *) -1) { - write (STDERR_FILENO, MSG, sizeof (MSG)); + write (STDERR_FILENO, MSG, sizeof (MSG) - 1); froms = NULL; tos = NULL; return; @@ -429,7 +429,7 @@ internal_mcount (char *selfpc, unsigned short *frompcindex) profiling++; #define TOLIMIT "mcount: tos overflow\n" - write (STDERR_FILENO, TOLIMIT, sizeof (TOLIMIT)); + write (STDERR_FILENO, TOLIMIT, sizeof (TOLIMIT) - 1); goto out; } diff --git a/libgcc/config/sol2/t-sol2 b/libgcc/config/sol2/t-sol2 index 1f7324a..75b0588 100644 --- a/libgcc/config/sol2/t-sol2 +++ b/libgcc/config/sol2/t-sol2 @@ -18,13 +18,13 @@ # crtp, crtpg build rules crtp.o: $(srcdir)/config/sol2/crtp.c - $(gcc_compile) -c $< + $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< crtpg.o: $(srcdir)/config/sol2/crtpg.c - $(gcc_compile) -c $< + $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< # gmon build rule gmon.o: $(srcdir)/config/sol2/gmon.c - $(gcc_compile) -c $< + $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< # Assemble startup files. crt1.o: $(srcdir)/config/$(cpu_type)/sol2-c1.S |