aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-09-13 23:22:33 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-09-13 23:22:33 +0200
commit7d27d2fa9d7343690c20c2d1e16e6c83df4e3817 (patch)
tree473c2363d2fd5953667ee3ad22450cec966c01a6
parent87f3a5cfb59347cd794c97c52b075d38dfc9ed48 (diff)
downloadgcc-7d27d2fa9d7343690c20c2d1e16e6c83df4e3817.zip
gcc-7d27d2fa9d7343690c20c2d1e16e6c83df4e3817.tar.gz
gcc-7d27d2fa9d7343690c20c2d1e16e6c83df4e3817.tar.bz2
sysv4.h (STARTFILE_LINUX_SPEC): Add -static-pie support.
* config/rs6000/sysv4.h (STARTFILE_LINUX_SPEC): Add -static-pie support. (ENDFILE_LINUX_SPEC): Likewise. (LINK_EH_SPEC): Likewise. * config/rs6000/linux64.h (LINK_SHLIB_SPEC): Likewise. (LINK_OS_LINUX_SPEC32): Likewise. (LINK_OS_LINUX_SPEC64): Likewise. * config/rs6000/linux.h (LINK_SHLIB_SPEC): Likewise. (LINK_OS_LINUX_SPEC): Likewise. From-SVN: r252735
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/config/rs6000/linux.h8
-rw-r--r--gcc/config/rs6000/linux64.h13
-rw-r--r--gcc/config/rs6000/sysv4.h8
4 files changed, 29 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 959e04e..1c5b812 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2017-09-13 Jakub Jelinek <jakub@redhat.com>
+
+ * config/rs6000/sysv4.h (STARTFILE_LINUX_SPEC): Add -static-pie
+ support.
+ (ENDFILE_LINUX_SPEC): Likewise.
+ (LINK_EH_SPEC): Likewise.
+ * config/rs6000/linux64.h (LINK_SHLIB_SPEC): Likewise.
+ (LINK_OS_LINUX_SPEC32): Likewise.
+ (LINK_OS_LINUX_SPEC64): Likewise.
+ * config/rs6000/linux.h (LINK_SHLIB_SPEC): Likewise.
+ (LINK_OS_LINUX_SPEC): Likewise.
+
2017-09-13 Martin Liska <mliska@suse.cz>
PR middle-end/82154
diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
index 684afd6..e4158d2 100644
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -61,7 +61,8 @@
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
#undef LINK_SHLIB_SPEC
-#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
+#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
+ %{static-pie:-static -pie --no-dynamic-linker -z text}"
#undef LIB_DEFAULT_SPEC
#define LIB_DEFAULT_SPEC "%(lib_linux)"
@@ -93,8 +94,9 @@
#undef LINK_OS_LINUX_SPEC
#define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
- %{rdynamic:-export-dynamic} \
- -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
+ %{!static-pie: \
+ %{rdynamic:-export-dynamic} \
+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}}"
/* For backward compatibility, we must continue to use the AIX
structure return convention. */
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 1dbb3d9..13b7692 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -395,7 +395,8 @@ extern int dot_symbols;
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux) %(include_extra)"
#undef LINK_SHLIB_SPEC
-#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
+#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
+ %{static-pie:-static -pie --no-dynamic-linker -z text}"
#undef LIB_DEFAULT_SPEC
#define LIB_DEFAULT_SPEC "%(lib_linux)"
@@ -470,13 +471,15 @@ extern int dot_symbols;
#endif
#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
- %{rdynamic:-export-dynamic} \
- -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \
+ %{!static-pie: \
+ %{rdynamic:-export-dynamic} \
+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \
%(link_os_extra_spec32)"
#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
- %{rdynamic:-export-dynamic} \
- -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}} \
+ %{!static-pie: \
+ %{rdynamic:-export-dynamic} \
+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
%(link_os_extra_spec64)"
#undef TOC_SECTION_ASM_OP
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index 03726b4..e381ce9 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -764,11 +764,11 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
"%{shared:; \
pg|p|profile:gcrt1.o%s; \
static:crt1.o%s; \
- " PIE_SPEC ":Scrt1.o%s; \
+ static-pie|" PIE_SPEC ":Scrt1.o%s; \
:crt1.o%s} \
%{mnewlib:ecrti.o%s;:crti.o%s} \
%{static:crtbeginT.o%s; \
- shared|" PIE_SPEC ":crtbeginS.o%s; \
+ shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
:crtbegin.o%s} \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start_preinit.o%s; \
@@ -782,7 +782,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
fvtable-verify=preinit:vtv_end_preinit.o%s; \
fvtable-verify=std:vtv_end.o%s} \
%{static:crtend.o%s; \
- shared|" PIE_SPEC ":crtendS.o%s; \
+ shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
:crtend.o%s} \
%{mnewlib:ecrtn.o%s;:crtn.o%s} \
" CRTOFFLOADEND
@@ -816,7 +816,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__ \