summaryrefslogtreecommitdiff
path: root/system/gcc/0012-static-pie.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-02-28 23:20:33 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-02-28 23:20:33 +0000
commit223093d95abfc2b2161105f2ef73a8287c687d95 (patch)
treec4e06a18734c392ef7bd33243cf7e8071f104dcb /system/gcc/0012-static-pie.patch
parent54003d7ae7f86ebba107ddad7ea6be0fdcaa6259 (diff)
downloadpackages-223093d95abfc2b2161105f2ef73a8287c687d95.tar.gz
packages-223093d95abfc2b2161105f2ef73a8287c687d95.tar.bz2
packages-223093d95abfc2b2161105f2ef73a8287c687d95.tar.xz
packages-223093d95abfc2b2161105f2ef73a8287c687d95.zip
system/gcc: bump to 8.3.0
These patches have been forward-ported to 8: 002_all_default-relro.patch 005_all_default-as-needed.patch 011_all_default-warn-format-security.patch 012_all_default-warn-trampolines.patch We are no longer using fortify-headers, so these patches are no longer needed: 003_all_default-fortify-source.patch 050_all_libiberty-asprintf.patch 053_all_libitm-no-fortify-source.patch These patches no longer appear necessary: 067_all_gcc-poison-system-directories.patch 090_all_pr55930-dependency-tracking.patch 201-cilkrts.patch 203-libgcc_s.patch 207-static-pie.patch These patches have already been applied upstream: 204-linux_libc_has_function.patch 332-gccgo-remove-ustat.patch ada-aarch64-multiarch.patch ada-fixes.patch boehm-gc-musl.patch fix-rs6000-pie.patch gcc-4.8-build-args.patch lra-pentium.patch These patches are no longer necessary because GCJ has been removed: 310-build-gcj-s390x.patch fix-gcj-iconv-musl.patch fix-gcj-musl.patch fix-gcj-stdgnu14-link.patch The rest of the changes are updates from nsz's patchset.
Diffstat (limited to 'system/gcc/0012-static-pie.patch')
-rw-r--r--system/gcc/0012-static-pie.patch138
1 files changed, 138 insertions, 0 deletions
diff --git a/system/gcc/0012-static-pie.patch b/system/gcc/0012-static-pie.patch
new file mode 100644
index 000000000..03a4f68f6
--- /dev/null
+++ b/system/gcc/0012-static-pie.patch
@@ -0,0 +1,138 @@
+From a4aa319f7c19e564dced3daeb7222c9315af936c Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Sat, 18 Aug 2018 23:58:45 +0000
+Subject: [PATCH 12/12] static-pie
+
+in gcc-8 -static means static non-pie, even if -pie or -static-pie
+are specified, -static-pie can be used to build static pie.
+
+in musl toolchains -static -pie always meant static pie, so this
+patch fixes the link specs accordingly, the new -static-pie is just
+an alias to -static -pie.
+---
+ gcc/common.opt | 4 ++--
+ gcc/config/gnu-user.h | 12 +++++-------
+ gcc/config/rs6000/sysv4.h | 11 +++++------
+ gcc/gcc.c | 6 +++---
+ 4 files changed, 15 insertions(+), 18 deletions(-)
+
+diff --git a/gcc/common.opt b/gcc/common.opt
+index b52ef0b38c8..0ce5857e01d 100644
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -3197,11 +3197,11 @@ Driver
+
+ no-pie
+ Driver RejectNegative Negative(shared)
+-Don't create a dynamically linked position independent executable.
++Don't create a position independent executable.
+
+ pie
+ Driver RejectNegative Negative(no-pie)
+-Create a dynamically linked position independent executable.
++Create a position independent executable.
+
+ static-pie
+ Driver RejectNegative Negative(pie)
+diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
+index 8620de3e42d..235328a2642 100644
+--- a/gcc/config/gnu-user.h
++++ b/gcc/config/gnu-user.h
+@@ -52,13 +52,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ #define GNU_USER_TARGET_STARTFILE_SPEC \
+ "%{shared:; \
+ pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
+- static:crt1.o%s; \
+- static-pie:rcrt1.o%s; \
++ static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
+ " PIE_SPEC ":Scrt1.o%s; \
+ :crt1.o%s} \
+ crti.o%s \
+- %{static:crtbeginT.o%s; \
+- shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
++ %{shared|" PIE_SPEC ":crtbeginS.o%s; \
++ static:crtbeginT.o%s; \
+ :crtbegin.o%s} \
+ %{fvtable-verify=none:%s; \
+ fvtable-verify=preinit:vtv_start_preinit.o%s; \
+@@ -92,8 +91,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ "%{fvtable-verify=none:%s; \
+ fvtable-verify=preinit:vtv_end_preinit.o%s; \
+ fvtable-verify=std:vtv_end.o%s} \
+- %{static:crtend.o%s; \
+- shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
++ %{shared|" PIE_SPEC ":crtendS.o%s; \
+ :crtend.o%s} \
+ crtn.o%s \
+ " CRTOFFLOADEND
+@@ -133,7 +131,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
+
+ #if defined(HAVE_LD_EH_FRAME_HDR)
+-#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
++#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
+ #endif
+
+ #undef LINK_GCC_C_SEQUENCE_SPEC
+diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
+index bb19d0dcd41..bb2a2324eb0 100644
+--- a/gcc/config/rs6000/sysv4.h
++++ b/gcc/config/rs6000/sysv4.h
+@@ -763,12 +763,12 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
+ #define STARTFILE_LINUX_SPEC \
+ "%{shared:; \
+ pg|p|profile:gcrt1.o%s; \
+- static:crt1.o%s; \
+- static-pie|" PIE_SPEC ":Scrt1.o%s; \
++ static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
++ " PIE_SPEC ":Scrt1.o%s; \
+ :crt1.o%s} \
+ %{mnewlib:ecrti.o%s;:crti.o%s} \
+- %{static:crtbeginT.o%s; \
+- shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
++ %{shared|" PIE_SPEC ":crtbeginS.o%s; \
++ static:crtbeginT.o%s; \
+ :crtbegin.o%s} \
+ %{fvtable-verify=none:%s; \
+ fvtable-verify=preinit:vtv_start_preinit.o%s; \
+@@ -781,8 +781,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
+ "%{fvtable-verify=none:%s; \
+ fvtable-verify=preinit:vtv_end_preinit.o%s; \
+ fvtable-verify=std:vtv_end.o%s} \
+- %{static:crtend.o%s; \
+- shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
++ %{shared|" PIE_SPEC ":crtendS.o%s; \
+ :crtend.o%s} \
+ %{mnewlib:ecrtn.o%s;:crtn.o%s} \
+ " CRTOFFLOADEND
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+index eb1610ba8b0..87560afb03c 100644
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -900,7 +900,7 @@ proper position among the other output files. */
+ #define NO_FPIE_AND_FPIC_SPEC NO_FPIE_SPEC "|" NO_FPIC_SPEC
+ #define FPIE_OR_FPIC_SPEC NO_FPIE_AND_FPIC_SPEC ":;"
+ #else
+-#define PIE_SPEC "pie"
++#define PIE_SPEC "pie|static-pie"
+ #define FPIE1_SPEC "fpie"
+ #define NO_FPIE1_SPEC FPIE1_SPEC ":;"
+ #define FPIE2_SPEC "fPIE"
+@@ -924,12 +924,12 @@ proper position among the other output files. */
+ #ifndef LINK_PIE_SPEC
+ #ifdef HAVE_LD_PIE
+ #ifndef LD_PIE_SPEC
+-#define LD_PIE_SPEC "-pie"
++#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}"
+ #endif
+ #else
+ #define LD_PIE_SPEC ""
+ #endif
+-#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
++#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
+ #endif
+
+ #ifndef LINK_BUILDID_SPEC
+--
+2.17.1
+