* 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
+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
%{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}"
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
#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
#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
#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}"
#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
%{!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
%{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 "} \
#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}"
#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
#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
-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__ \
%{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}"
/* 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