diff options
| author | Jakub Jelinek <jakub@redhat.com> | 2003-06-03 11:06:55 +0200 |
|---|---|---|
| committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2003-06-03 11:06:55 +0200 |
| commit | 24a4dd31f80136aadf69774545916675b50836d6 (patch) | |
| tree | 9086bda0149c0c0178acfce160ac6deb805491fd /gcc/config/sparc | |
| parent | 8fd3cf4e17c97036b4f9cecbe2f438a2da920351 (diff) | |
| download | gcc-24a4dd31f80136aadf69774545916675b50836d6.zip gcc-24a4dd31f80136aadf69774545916675b50836d6.tar.gz gcc-24a4dd31f80136aadf69774545916675b50836d6.tar.bz2 | |
configure.in (HAVE_LD_PIE): Check for ld -pie.
* configure.in (HAVE_LD_PIE): Check for ld -pie.
* config.in: Rebuilt.
* configure: Rebuilt.
* toplev.c (flag_pie, flag_shlib): New variables.
(f_options): Add -fpie and -fPIE.
(parse_options_and_default_flags): Set flag_pic if -fpie/-fPIE.
Set flag_shlib if flag_pic and not -fpie/-fPIE.
* flags.h (flag_pic, flag_shlib): Add.
* varasm.c (default_binds_local_p): Use flag_shlib instead of
flag_pic.
* gcc.c (LINK_PIE_SPEC): Define.
(LINK_COMMAND_SPEC): Use LINK_PIE_SPEC.
(option_map): Add --pie -> -pie mapping.
* config/sol2.h (ASM_SPEC): Handle -fpie the same way as -fpic
and -fPIE the same way as -fPIC.
* config/openbsd.h (ASM_SPEC): Likewise.
* config/frv/frv.h (ASM_SPEC): Likewise.
* config/arm/linux-gas.h (SUBTARGET_CPP_SPEC): Likewise.
* config/arm/semi.h (ASM_SPEC): Likewise.
* config/arm/netbsd-elf.h (SUBTARGET_EXTRA_ASM_SPEC): Likewise.
* config/freebsd-spec.h (FBSD_CPP_SPEC): Likewise.
* config/i386/beos-elf.h (CC1_SPEC): Likewise.
* config/i386/freebsd-aout.h (ASM_SPEC): Likewise.
* config/m68k/linux.h (CPP_SPEC): Likewise.
* config/m68k/netbsd.h (ASM_SPEC): Likewise.
* config/m68k/openbsd.h (ASM_SPEC): Likewise.
* config/m68k/netbsd-elf.h (ASM_SPEC): Likewise.
* config/mips/linux.h (SUBTARGET_CPP_SPEC): Likewise.
* config/mips/openbsd.h (SUBTARGET_ASM_SPEC): Likewise.
* config/pa/pa-linux.h (CPP_SPEC): Likewise.
* config/netbsd-aout.h (ASM_SPEC): Likewise.
* config/rs6000/sysv4.h (ASM_SPEC, CPP_SYSV_SPEC): Likewise.
* config/rs6000/vxworks.h (CPP_SPEC): Likewise.
* config/sparc/linux.h (CPP_SUBTARGET_SPEC, ASM_SPEC): Likewise.
* config/sparc/linux64.h (CPP_SUBTARGET_SPEC, ASM_SPEC): Likewise.
* config/sparc/sparc.h (ASM_SPEC): Likewise.
* config/sparc/sp64-elf.h (ASM_SPEC): Likewise.
* config/sparc/sysv4.h (ASM_SPEC): Likewise.
* config/sparc/netbsd-elf.h (ASM_SPEC): Likewise.
* config/sparc/openbsd64.h (ASM_SPEC): Likewise.
* config/cris/linux.h (CRIS_ASM_SUBTARGET_SPEC): Likewise.
* config/linux.h (STARTFILE_SPEC, ENDFILE_SPEC): Handle -pie.
Simplify.
* config/alpha/elf.h (STARTFILE_SPEC, ENDFILE_SPEC): Likewise.
* config/i386/linux64.h (STARTFILE_SPEC, ENDFILE_SPEC): Likewise.
* config/ia64/linux.h (STARTFILE_SPEC, ENDFILE_SPEC): Likewise.
* config/rs6000/sysv4.h (STARTFILE_SPEC, ENDFILE_SPEC): Likewise.
* config/rs6000/linux64.h (STARTFILE_SPEC, ENDFILE_SPEC): Likewise.
* config/sparc/linux.h (STARTFILE_SPEC, ENDFILE_SPEC): Likewise.
* config/sparc/linux64.h (STARTFILE_SPEC, ENDFILE_SPEC): Likewise.
* doc/invoke.texi: Document -pie, -fpie and -fPIE options.
From-SVN: r67359
Diffstat (limited to 'gcc/config/sparc')
| -rw-r--r-- | gcc/config/sparc/linux.h | 20 | ||||
| -rw-r--r-- | gcc/config/sparc/linux64.h | 18 | ||||
| -rw-r--r-- | gcc/config/sparc/netbsd-elf.h | 2 | ||||
| -rw-r--r-- | gcc/config/sparc/openbsd64.h | 2 | ||||
| -rw-r--r-- | gcc/config/sparc/sp64-elf.h | 2 | ||||
| -rw-r--r-- | gcc/config/sparc/sparc.h | 2 | ||||
| -rw-r--r-- | gcc/config/sparc/sysv4.h | 2 |
7 files changed, 27 insertions, 21 deletions
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h index 23f5892..63ce3b9 100644 --- a/gcc/config/sparc/linux.h +++ b/gcc/config/sparc/linux.h @@ -57,12 +57,14 @@ Boston, MA 02111-1307, USA. */ "%{!shared: \ %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\ crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" +#elif defined HAVE_LD_PIE +#define STARTFILE_SPEC \ + "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\ + crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" #else #define STARTFILE_SPEC \ - "%{!shared: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\ - crti.o%s %{static:crtbeginT.o%s}\ - %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}" + "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\ + crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" #endif /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on @@ -74,7 +76,7 @@ Boston, MA 02111-1307, USA. */ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ - %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" + %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" /* This is for -profile to use -lc_p instead of -lc. */ #undef CC1_SPEC @@ -112,11 +114,11 @@ Boston, MA 02111-1307, USA. */ #undef CPP_SUBTARGET_SPEC #ifdef USE_GNULIBC_1 #define CPP_SUBTARGET_SPEC \ -"%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} \ +"%{fPIC|fPIE|fpic|fpie:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} \ %{mlong-double-128:-D__LONG_DOUBLE_128__}" #else #define CPP_SUBTARGET_SPEC \ -"%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} \ +"%{fPIC|fPIE|fpic|fpie:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} \ %{pthread:-D_REENTRANT} %{mlong-double-128:-D__LONG_DOUBLE_128__}" #endif @@ -192,8 +194,8 @@ Boston, MA 02111-1307, USA. */ It's safe to pass -s always, even if -g is not used. */ #undef ASM_SPEC #define ASM_SPEC \ - "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} \ - %{fPIC:-K PIC} %(asm_cpu) %(asm_relax)" + "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \ + %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu) %(asm_relax)" /* Same as sparc.h */ #undef DBX_REGISTER_NUMBER diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h index aed067d..ecdd520 100644 --- a/gcc/config/sparc/linux64.h +++ b/gcc/config/sparc/linux64.h @@ -66,10 +66,15 @@ Boston, MA 02111-1307, USA. */ #undef STARTFILE_SPEC +#ifdef HAVE_LD_PIE #define STARTFILE_SPEC \ - "%{!shared:%{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\ - crti.o%s %{static:crtbeginT.o%s}\ - %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}" + "%{!shared:%{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\ + crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}" +#else +#define STARTFILE_SPEC \ + "%{!shared:%{pg|p:gcrt1.o%s;:crt1.o%s}}\ + crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}" +#endif /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on the GNU/Linux magical crtend.o file (see crtstuff.c) which @@ -80,7 +85,7 @@ Boston, MA 02111-1307, USA. */ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s\ + "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" /* The GNU C++ standard library requires that these macros be defined. */ @@ -124,8 +129,7 @@ Boston, MA 02111-1307, USA. */ #undef CPP_SUBTARGET_SPEC #define CPP_SUBTARGET_SPEC "\ -%{fPIC:-D__PIC__ -D__pic__} \ -%{fpic:-D__PIC__ -D__pic__} \ +%{fPIC|fpic|fPIE|fpie:-D__PIC__ -D__pic__} \ %{posix:-D_POSIX_SOURCE} \ %{pthread:-D_REENTRANT} \ " @@ -254,7 +258,7 @@ Boston, MA 02111-1307, USA. */ %{T} \ %{Ym,*} \ %{Wa,*:%*} \ --s %{fpic:-K PIC} %{fPIC:-K PIC} \ +-s %{fpic|fPIC|fpie|fPIE:-K PIC} \ %{mlittle-endian:-EL} \ %(asm_cpu) %(asm_arch) %(asm_relax)" diff --git a/gcc/config/sparc/netbsd-elf.h b/gcc/config/sparc/netbsd-elf.h index a20fce4..06783f3 100644 --- a/gcc/config/sparc/netbsd-elf.h +++ b/gcc/config/sparc/netbsd-elf.h @@ -86,7 +86,7 @@ Boston, MA 02111-1307, USA. */ #define USER_LABEL_PREFIX "" #undef ASM_SPEC -#define ASM_SPEC "%{fpic:-K PIC} %{fPIC:-K PIC} %{V} %{v:%{!V:-V}} \ +#define ASM_SPEC "%{fpic|fPIC|fpie|fPIE:-K PIC} %{V} %{v:%{!V:-V}} \ %{mlittle-endian:-EL} \ %(asm_cpu) %(asm_arch) %(asm_relax)" diff --git a/gcc/config/sparc/openbsd64.h b/gcc/config/sparc/openbsd64.h index 96ddf79..e13c886 100644 --- a/gcc/config/sparc/openbsd64.h +++ b/gcc/config/sparc/openbsd64.h @@ -53,7 +53,7 @@ Boston, MA 02111-1307, USA. */ #undef ASM_SPEC #define ASM_SPEC "\ -%{v:-V} -s %{fpic:-K PIC} %{fPIC:-K PIC} \ +%{v:-V} -s %{fpic|fPIC|fpie|fPIE:-K PIC} \ %{mlittle-endian:-EL} \ %(asm_cpu) %(asm_arch) \ " diff --git a/gcc/config/sparc/sp64-elf.h b/gcc/config/sparc/sp64-elf.h index f442fd8..2782d68 100644 --- a/gcc/config/sparc/sp64-elf.h +++ b/gcc/config/sparc/sp64-elf.h @@ -56,7 +56,7 @@ Boston, MA 02111-1307, USA. */ #undef ASM_SPEC #define ASM_SPEC "\ -%{v:-V} -s %{fpic:-K PIC} %{fPIC:-K PIC} \ +%{v:-V} -s %{fpic|fPIC|fpie|fPIE:-K PIC} \ %{mlittle-endian:-EL} \ %(asm_cpu) %(asm_arch) \ " diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 3ec9cde..e08e403 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -336,7 +336,7 @@ extern enum cmodel sparc_cmodel; /* Special flags to the Sun-4 assembler when using pipe for input. */ #define ASM_SPEC "\ -%{R} %{!pg:%{!p:%{fpic:-k} %{fPIC:-k}}} %{keep-local-as-symbols:-L} \ +%{R} %{!pg:%{!p:%{fpic|fPIC|fpie|fPIE:-k}}} %{keep-local-as-symbols:-L} \ %(asm_cpu) %(asm_relax)" #define AS_NEEDS_DASH_FOR_PIPED_INPUT diff --git a/gcc/config/sparc/sysv4.h b/gcc/config/sparc/sysv4.h index 1d153c0..80defea 100644 --- a/gcc/config/sparc/sysv4.h +++ b/gcc/config/sparc/sysv4.h @@ -59,7 +59,7 @@ Boston, MA 02111-1307, USA. */ #undef ASM_SPEC #define ASM_SPEC \ "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \ - %{fpic:-K PIC} %{fPIC:-K PIC} %(asm_cpu)" + %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu)" /* Define the names of various pseudo-op used by the SPARC/svr4 assembler. Note that many of these are different from the typical pseudo-ops used |
