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/rs6000 | |
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/rs6000')
-rw-r--r-- | gcc/config/rs6000/linux64.h | 13 | ||||
-rw-r--r-- | gcc/config/rs6000/sysv4.h | 18 | ||||
-rw-r--r-- | gcc/config/rs6000/vxworks.h | 4 |
3 files changed, 22 insertions, 13 deletions
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index bd3a6a8..5a31366 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -215,14 +215,19 @@ #endif #undef STARTFILE_LINUX_SPEC +#ifdef HAVE_LD_PIE #define STARTFILE_LINUX_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;:crtbegin.o%s}" +#else +#define STARTFILE_LINUX_SPEC "\ +%{!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 #undef ENDFILE_LINUX_SPEC #define ENDFILE_LINUX_SPEC "\ -%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" +%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" #undef TOC_SECTION_ASM_OP #define TOC_SECTION_ASM_OP "\t.section\t\".toc\",\"aw\"" diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index d266c28..d91dd3d 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -810,7 +810,7 @@ extern int fixuplabelno; #define ASM_SPEC "%(asm_cpu) \ %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \ %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \ -%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \ +%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \ %{memb|msdata|msdata=eabi: -memb} \ %{mlittle|mlittle-endian:-mlittle; \ mbig|mbig-endian :-mbig; \ @@ -947,8 +947,8 @@ extern int fixuplabelno; #define CPP_SYSV_SPEC \ "%{mrelocatable*: -D_RELOCATABLE} \ -%{fpic: -D__PIC__=1 -D__pic__=1} \ -%{!fpic: %{fPIC: -D__PIC__=2 -D__pic__=2}}" +%{fpic|fpie: -D__PIC__=1 -D__pic__=1} \ +%{!fpic: %{fPIC|fPIE: -D__PIC__=2 -D__pic__=2}}" /* Override rs6000.h definition. */ #undef CPP_SPEC @@ -1107,12 +1107,16 @@ extern int fixuplabelno; %{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \ %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \ %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" +#elif defined HAVE_LD_PIE +#define STARTFILE_LINUX_SPEC "\ +%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ +%{mnewlib:ecrti.o%s;:crti.o%s} \ +%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" #else #define STARTFILE_LINUX_SPEC "\ -%{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \ -%{mnewlib: ecrti.o%s} %{!mnewlib: 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}} \ +%{mnewlib:ecrti.o%s;:crti.o%s} \ +%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" #endif #define ENDFILE_LINUX_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \ diff --git a/gcc/config/rs6000/vxworks.h b/gcc/config/rs6000/vxworks.h index 6a5c7e9..e7a7092 100644 --- a/gcc/config/rs6000/vxworks.h +++ b/gcc/config/rs6000/vxworks.h @@ -48,8 +48,8 @@ t860: -DCPU=PPC860 -D_SOFT_FLOAT ; \ : -DCPU=PPC604} \ %{!msoft-float:-D__hardfp} \ - %{fpic: -D__PIC__=1 -D__pic__=1 ; \ - fPIC: -D__PIC__=2 -D__pic__=2 } \ + %{fpic|fpie: -D__PIC__=1 -D__pic__=1 ; \ + fPIC|fPIE: -D__PIC__=2 -D__pic__=2 } \ %(cpp_cpu)" #define CC1_SPEC \ |