diff options
author | ro <ro@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-09-24 09:00:22 +0000 |
---|---|---|
committer | ro <ro@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-09-24 09:00:22 +0000 |
commit | 80fc7cb79bc5089fb7b19a90dab4175804a561b7 (patch) | |
tree | f52d2a26a4f1a076c6412585f560c29447771e77 /gcc/configure.ac | |
parent | ba24ad380cf6ee626e1a523b5a3215072f3d056a (diff) | |
download | gcc-80fc7cb79bc5089fb7b19a90dab4175804a561b7.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228078 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/configure.ac')
-rw-r--r-- | gcc/configure.ac | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/gcc/configure.ac b/gcc/configure.ac index 4f8a44e51f1..65b5d704e3b 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -4751,19 +4751,41 @@ AC_MSG_RESULT($gcc_cv_ld_eh_frame_ciev3) AC_MSG_CHECKING(linker position independent executable support) gcc_cv_ld_pie=no if test $in_tree_ld = yes ; then - if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 15 -o "$gcc_cv_gld_major_version" -gt 2 \ + case "$target" in + # Full PIE support on Solaris was only introduced in gld 2.26. + *-*-solaris2*) gcc_gld_pie_min_version=26 ;; + *) gcc_gld_pie_min_version=15 ;; + esac + if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge "$gcc_gld_pie_min_version" -o "$gcc_cv_gld_major_version" -gt 2 \ && test $in_tree_ld_is_elf = yes; then gcc_cv_ld_pie=yes fi elif test x$gcc_cv_ld != x; then - # Check if linker supports -pie option - if $gcc_cv_ld --help 2>/dev/null | grep -- -pie > /dev/null; then - gcc_cv_ld_pie=yes + # Check if linker supports -pie option + if $gcc_cv_ld --help 2>/dev/null | grep -- -pie > /dev/null; then + gcc_cv_ld_pie=yes + case "$target" in + *-*-solaris2*) + if echo "$ld_ver" | grep GNU > /dev/null \ + && test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 26; then + gcc_cv_ld_pie=no fi + ;; + esac + else + case "$target" in + *-*-solaris2.1[[1-9]]*) + # Solaris 11.x and Solaris 12 added PIE support. + if $gcc_cv_ld -z help 2>&1 | grep -- type.*pie > /dev/null; then + gcc_cv_ld_pie=yes + fi + ;; + esac + fi fi if test x"$gcc_cv_ld_pie" = xyes; then AC_DEFINE(HAVE_LD_PIE, 1, -[Define if your linker supports -pie option.]) +[Define if your linker supports PIE option.]) fi AC_MSG_RESULT($gcc_cv_ld_pie) |