aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-09-14 09:56:23 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-09-14 09:56:23 +0200
commit8c6562e12bf7d1406474cbba832073a4afe5687c (patch)
treec36d15fa07dd1f599e60da37b986e77a2403abd0 /gcc
parent022aa0ce5eebafe60f20245c8ff26b60a5074dfd (diff)
downloadgcc-8c6562e12bf7d1406474cbba832073a4afe5687c.zip
gcc-8c6562e12bf7d1406474cbba832073a4afe5687c.tar.gz
gcc-8c6562e12bf7d1406474cbba832073a4afe5687c.tar.bz2
elf.h (LINK_EH_SPEC): Add -static-pie support.
* config/alpha/elf.h (LINK_EH_SPEC): Add -static-pie support. * config/alpha/linux.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise. * config/netbsd.h (LINK_EH_SPEC): Likewise. * config/sol2.h (LINK_EH_SPEC): Likewise. * config/arm/uclinux-elf.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise. * config/s390/linux.h (LINK_SPEC): Likewise. * config/freebsd.h (LINK_EH_SPEC): Likewise. * config/openbsd.h (LINK_EH_SPEC): Likewise. * config/lm32/uclinux-elf.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise. * config/aarch64/aarch64-linux.h (LINUX_TARGET_LINK_SPEC): Likewise. * config/powerpcspe/sysv4.h (LINK_EH_SPEC): Likewise. * config/bfin/linux.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise. * config/i386/gnu-user64.h (GNU_USER_TARGET_LINK_SPEC): Fix a typo. * config/i386/gnu-user.h (GNU_USER_TARGET_LINK_SPEC): Formatting fix. From-SVN: r252750
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/config/aarch64/aarch64-linux.h5
-rw-r--r--gcc/config/alpha/elf.h2
-rw-r--r--gcc/config/alpha/linux.h3
-rw-r--r--gcc/config/arm/uclinux-elf.h3
-rw-r--r--gcc/config/bfin/linux.h5
-rw-r--r--gcc/config/freebsd.h2
-rw-r--r--gcc/config/i386/gnu-user.h2
-rw-r--r--gcc/config/i386/gnu-user64.h2
-rw-r--r--gcc/config/lm32/uclinux-elf.h3
-rw-r--r--gcc/config/netbsd.h2
-rw-r--r--gcc/config/openbsd.h2
-rw-r--r--gcc/config/powerpcspe/sysv4.h2
-rw-r--r--gcc/config/s390/linux.h5
-rw-r--r--gcc/config/sol2.h2
15 files changed, 40 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1c5b812..5a6a211 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,20 @@
+2017-09-14 Jakub Jelinek <jakub@redhat.com>
+
+ * config/alpha/elf.h (LINK_EH_SPEC): Add -static-pie support.
+ * config/alpha/linux.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise.
+ * config/netbsd.h (LINK_EH_SPEC): Likewise.
+ * config/sol2.h (LINK_EH_SPEC): Likewise.
+ * config/arm/uclinux-elf.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise.
+ * config/s390/linux.h (LINK_SPEC): Likewise.
+ * config/freebsd.h (LINK_EH_SPEC): Likewise.
+ * config/openbsd.h (LINK_EH_SPEC): Likewise.
+ * config/lm32/uclinux-elf.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise.
+ * config/aarch64/aarch64-linux.h (LINUX_TARGET_LINK_SPEC): Likewise.
+ * config/powerpcspe/sysv4.h (LINK_EH_SPEC): Likewise.
+ * config/bfin/linux.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise.
+ * config/i386/gnu-user64.h (GNU_USER_TARGET_LINK_SPEC): Fix a typo.
+ * config/i386/gnu-user.h (GNU_USER_TARGET_LINK_SPEC): Formatting fix.
+
2017-09-13 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/sysv4.h (STARTFILE_LINUX_SPEC): Add -static-pie
diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
index c45fc1d..2103344 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -38,9 +38,10 @@
%{static:-Bstatic} \
%{shared:-shared} \
%{symbolic:-Bsymbolic} \
- %{!static: \
+ %{!static:%{!static-pie: \
%{rdynamic:-export-dynamic} \
- %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
+ %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}} \
+ %{static-pie:-Bstatic -pie --no-dynamic-linker -z text} \
-X \
%{mbig-endian:-EB} %{mlittle-endian:-EL} \
-maarch64linux%{mabi=ilp32:32}%{mbig-endian:b}"
diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h
index c109b07..29ff1d9 100644
--- a/gcc/config/alpha/elf.h
+++ b/gcc/config/alpha/elf.h
@@ -168,5 +168,5 @@ extern int alpha_this_gpdisp_sequence_number;
I imagine that other systems will catch up. In the meantime, it
doesn't harm to make sure that the data exists to be used later. */
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
#endif
diff --git a/gcc/config/alpha/linux.h b/gcc/config/alpha/linux.h
index e15013e..2f2a185 100644
--- a/gcc/config/alpha/linux.h
+++ b/gcc/config/alpha/linux.h
@@ -79,7 +79,8 @@ along with GCC; see the file COPYING3. If not see
#define TARGET_POSIX_IO
#define LINK_GCC_C_SEQUENCE_SPEC \
- "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
+ "%{static|static-pie:--start-group} %G %L \
+ %{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}"
/* Use --as-needed -lgcc_s for eh support. */
#ifdef HAVE_LD_AS_NEEDED
diff --git a/gcc/config/arm/uclinux-elf.h b/gcc/config/arm/uclinux-elf.h
index 0e484d4..534af9a 100644
--- a/gcc/config/arm/uclinux-elf.h
+++ b/gcc/config/arm/uclinux-elf.h
@@ -70,7 +70,8 @@
#undef LINK_GCC_C_SEQUENCE_SPEC
#define LINK_GCC_C_SEQUENCE_SPEC \
- "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G %L}"
+ "%{static|static-pie:--start-group} %G %L \
+ %{static|static-pie:--end-group}%{!static:%{!static-pie:%G %L}}"
/* Use --as-needed -lgcc_s for eh support. */
#ifdef HAVE_LD_AS_NEEDED
diff --git a/gcc/config/bfin/linux.h b/gcc/config/bfin/linux.h
index 6236b98..bdea132 100644
--- a/gcc/config/bfin/linux.h
+++ b/gcc/config/bfin/linux.h
@@ -35,8 +35,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#undef LINK_GCC_C_SEQUENCE_SPEC
#define LINK_GCC_C_SEQUENCE_SPEC \
- "%{static:--start-group} %{mfast-fp:-lbffastfp} %G %L %{static:--end-group} \
- %{!static:%{mfast-fp:-lbffastfp} %G}"
+ "%{static|static-pie:--start-group} %{mfast-fp:-lbffastfp} %G %L \
+ %{static|static-pie:--end-group} \
+ %{!static:%{!static-pie:%{mfast-fp:-lbffastfp} %G}}"
#undef CPP_SPEC
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
diff --git a/gcc/config/freebsd.h b/gcc/config/freebsd.h
index a272455..e7ea423 100644
--- a/gcc/config/freebsd.h
+++ b/gcc/config/freebsd.h
@@ -45,7 +45,7 @@ along with GCC; see the file COPYING3. If not see
#define LIB_SPEC FBSD_LIB_SPEC
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
#endif
#ifdef TARGET_LIBC_PROVIDES_SSP
diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
index 8983dc9..07f64c8 100644
--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -80,7 +80,7 @@ along with GCC; see the file COPYING3. If not see
%{!static-pie: \
%{rdynamic:-export-dynamic} \
-dynamic-linker %(dynamic_linker)}} \
- %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}"
+ %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}"
#undef LINK_SPEC
#define LINK_SPEC GNU_USER_TARGET_LINK_SPEC
diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
index 6fc9eae..46434a8 100644
--- a/gcc/config/i386/gnu-user64.h
+++ b/gcc/config/i386/gnu-user64.h
@@ -59,7 +59,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
%{shared:-shared} \
%{!shared: \
%{!static: \
- %{!static-static: \
+ %{!static-pie: \
%{rdynamic:-export-dynamic} \
%{" SPEC_32 ":-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "} \
%{" SPEC_64 ":-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \
diff --git a/gcc/config/lm32/uclinux-elf.h b/gcc/config/lm32/uclinux-elf.h
index 55d0365..aebef88 100644
--- a/gcc/config/lm32/uclinux-elf.h
+++ b/gcc/config/lm32/uclinux-elf.h
@@ -72,7 +72,8 @@
#define TARGET_OS_CPP_BUILTINS() GNU_USER_TARGET_OS_CPP_BUILTINS()
#define LINK_GCC_C_SEQUENCE_SPEC \
- "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
+ "%{static|static-pie:--start-group} %G %L \
+ %{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}"
#undef CC1_SPEC
#define CC1_SPEC "%{G*} %{!fno-PIC:-fPIC}"
diff --git a/gcc/config/netbsd.h b/gcc/config/netbsd.h
index f96ead0..aafce9f 100644
--- a/gcc/config/netbsd.h
+++ b/gcc/config/netbsd.h
@@ -125,7 +125,7 @@ along with GCC; see the file COPYING3. If not see
#define LIBGCC_SPEC NETBSD_LIBGCC_SPEC
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
#endif
#undef TARGET_LIBC_HAS_FUNCTION
diff --git a/gcc/config/openbsd.h b/gcc/config/openbsd.h
index 1048e31..ed7837b 100644
--- a/gcc/config/openbsd.h
+++ b/gcc/config/openbsd.h
@@ -136,7 +136,7 @@ while (0)
#define LIB_SPEC OBSD_LIB_SPEC
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
#endif
#undef LIB_SPEC
diff --git a/gcc/config/powerpcspe/sysv4.h b/gcc/config/powerpcspe/sysv4.h
index de38629..f86ad11 100644
--- a/gcc/config/powerpcspe/sysv4.h
+++ b/gcc/config/powerpcspe/sysv4.h
@@ -805,7 +805,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
#if defined(HAVE_LD_EH_FRAME_HDR)
-# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+# define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
#endif
#define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
index 739df00..76f994a 100644
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -82,10 +82,11 @@ along with GCC; see the file COPYING3. If not see
%{shared:-shared} \
%{!shared: \
%{static:-static} \
- %{!static: \
+ %{!static:%{!static-pie: \
%{rdynamic:-export-dynamic} \
%{m31:-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "} \
- %{m64:-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}}"
+ %{m64:-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}}} \
+ %{static-pie:-static -pie --no-dynamic-linker -z text}"
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
index bf5203b..f6c2fef 100644
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -372,7 +372,7 @@ along with GCC; see the file COPYING3. If not see
/* Solaris 11 build 135+ implements dl_iterate_phdr. GNU ld needs
--eh-frame-hdr to create the required .eh_frame_hdr sections. */
#if defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
#endif /* HAVE_LD_EH_FRAME && TARGET_DL_ITERATE_PHDR */
#endif