From: Jakub Jelinek Date: Wed, 13 Sep 2017 21:22:33 +0000 (+0200) Subject: sysv4.h (STARTFILE_LINUX_SPEC): Add -static-pie support. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7d27d2fa9d7343690c20c2d1e16e6c83df4e3817;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 959e04e895a..1c5b812d628 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2017-09-13 Jakub Jelinek + + * 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 PR middle-end/82154 diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h index 684afd6c190..e4158d26abb 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 1dbb3d94a73..13b769211b1 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 03726b434bd..e381ce90a8c 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__ \