aboutsummaryrefslogtreecommitdiff
path: root/3.4.6
diff options
context:
space:
mode:
authorKevin F. Quinn <kevquinn@gentoo.org>2006-06-25 15:43:51 +0000
committerKevin F. Quinn <kevquinn@gentoo.org>2006-06-25 15:43:51 +0000
commitf0c78dfa0c279e23291e27d4786230ac2815fff9 (patch)
tree690d973d4ab0bcf479bca774a9c2b0abed2aeab6 /3.4.6
parentupdate patches from uclibc svn (diff)
downloadgcc-patches-f0c78dfa0c279e23291e27d4786230ac2815fff9.tar.gz
gcc-patches-f0c78dfa0c279e23291e27d4786230ac2815fff9.tar.bz2
gcc-patches-f0c78dfa0c279e23291e27d4786230ac2815fff9.zip
import patchset from 3.4.5
Diffstat (limited to '3.4.6')
-rw-r--r--3.4.6/pie/def/00_all_gcc-3.4.3-v8.7.6.7-incompat-default.patch11
-rw-r--r--3.4.6/pie/def/01_all_gcc-3.4.3-v8.7.7-pie-generic-default-boundschecking-no.patch14
-rw-r--r--3.4.6/pie/def/01_all_gcc-3.4.3-v8.7.7-pie-generic-default-boundschecking-yes.patch14
-rw-r--r--3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-alpha-default.patch28
-rw-r--r--3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-arm-default.patch27
-rw-r--r--3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-ia64-default.patch28
-rw-r--r--3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-rs6000-default.patch99
-rw-r--r--3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-sparc-default.patch105
-rw-r--r--3.4.6/pie/nondef/02_all_gcc-3.4.3-v8.7.1-pie-rs6000-nondefault.patch22
-rw-r--r--3.4.6/pie/nondef/02_all_gcc-3.4.3-v8.7.6.7-pie-sparc-nondefault.patch22
-rw-r--r--3.4.6/pie/upstream/00_all_gcc-4.0-cvs-incompat.patch11
-rw-r--r--3.4.6/pie/upstream/00_all_gcc-4.0-cvs-mips-pic-for-3.4.3.patch40
-rw-r--r--3.4.6/pie/upstream/00_all_gcc-4.0-cvs-pic.patch117
-rw-r--r--3.4.6/pie/upstream/00_all_gcc-4.0-cvs-start_endfile-for-3.4.4.patch202
-rw-r--r--3.4.6/pie/upstream/03_all_gcc-3.4.0-v8.7.6.1-pie-arm.patch16
15 files changed, 756 insertions, 0 deletions
diff --git a/3.4.6/pie/def/00_all_gcc-3.4.3-v8.7.6.7-incompat-default.patch b/3.4.6/pie/def/00_all_gcc-3.4.3-v8.7.6.7-incompat-default.patch
new file mode 100644
index 0000000..9ac5239
--- /dev/null
+++ b/3.4.6/pie/def/00_all_gcc-3.4.3-v8.7.6.7-incompat-default.patch
@@ -0,0 +1,11 @@
+--- gcc-3.4.3/gcc/gcc.c.def~ Mon Nov 22 17:56:44 2004
++++ gcc-3.4.3/gcc/gcc.c Mon Nov 22 21:18:06 2004
+@@ -768,7 +768,7 @@
+ /* NB: This is shared amongst all front-ends. */
+ static const char *cc1_options =
+ "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
+- %{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}}\
++ %{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic|nopie:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic|nopie are incompatible}}\
+ %{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible}}\
+ %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\
+ %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}\
diff --git a/3.4.6/pie/def/01_all_gcc-3.4.3-v8.7.7-pie-generic-default-boundschecking-no.patch b/3.4.6/pie/def/01_all_gcc-3.4.3-v8.7.7-pie-generic-default-boundschecking-no.patch
new file mode 100644
index 0000000..83ae303
--- /dev/null
+++ b/3.4.6/pie/def/01_all_gcc-3.4.3-v8.7.7-pie-generic-default-boundschecking-no.patch
@@ -0,0 +1,14 @@
+--- gcc-3.4.3/gcc/gcc.c.def~ Mon Nov 22 17:56:44 2004
++++ gcc-3.4.3/gcc/gcc.c Mon Nov 22 21:18:06 2004
+@@ -709,7 +718,11 @@
+
+ static const char *asm_debug;
+ static const char *cpp_spec = CPP_SPEC;
++#ifdef HARDENED_CC1_SPEC_SUFFIX
++static const char *cc1_spec = CC1_SPEC " " HARDENED_CC1_SPEC_SUFFIX;
++#else
+ static const char *cc1_spec = CC1_SPEC;
++#endif
+ static const char *cc1plus_spec = CC1PLUS_SPEC;
+ static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
+ static const char *asm_spec = ASM_SPEC;
diff --git a/3.4.6/pie/def/01_all_gcc-3.4.3-v8.7.7-pie-generic-default-boundschecking-yes.patch b/3.4.6/pie/def/01_all_gcc-3.4.3-v8.7.7-pie-generic-default-boundschecking-yes.patch
new file mode 100644
index 0000000..afc7d2e
--- /dev/null
+++ b/3.4.6/pie/def/01_all_gcc-3.4.3-v8.7.7-pie-generic-default-boundschecking-yes.patch
@@ -0,0 +1,14 @@
+--- gcc-3.4.3/gcc/gcc.c.def~ Mon Nov 22 17:56:44 2004
++++ gcc-3.4.3/gcc/gcc.c Mon Nov 22 21:18:06 2004
+@@ -709,7 +718,11 @@
+
+ static const char *asm_debug;
+ static const char *cpp_spec = CPP_SPEC BOUNDS_CPP_SPEC BC_STRINGS_ONLY_CPP_SPEC;
++#ifdef HARDENED_CC1_SPEC_SUFFIX
++static const char *cc1_spec = CC1_SPEC " " HARDENED_CC1_SPEC_SUFFIX;
++#else
+ static const char *cc1_spec = CC1_SPEC;
++#endif
+ static const char *cc1plus_spec = CC1PLUS_SPEC;
+ static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
+ static const char *asm_spec = ASM_SPEC;
diff --git a/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-alpha-default.patch b/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-alpha-default.patch
new file mode 100644
index 0000000..3240e5b
--- /dev/null
+++ b/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-alpha-default.patch
@@ -0,0 +1,28 @@
+--- gcc-3.4.3/gcc/config/alpha/elf.h.def~ Mon Nov 22 17:56:44 2004
++++ gcc-3.4.3/gcc/config/alpha/elf.h Mon Nov 22 17:59:09 2004
+@@ -391,8 +391,12 @@
+ support for getting C++ file-scope static object constructed
+ before entering `main'. */
+
++#undef HARDENED_STARTFILE_SPEC
+ #undef STARTFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_STARTFILE_SPEC \
++ "%{!shared: %{pg|p:gcrt1.o%s;static|nopie:crt1.o%s;:Scrt1.o%s}}\
++ crti.o%s %{static:crtbeginT.o%s;nopie:crtbegin.o%s;:crtbeginS.o%s}"
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+@@ -407,8 +411,12 @@
+ getting C++ file-scope static object constructed before entering
+ `main', followed by a normal ELF "finalizer" file, `crtn.o'. */
+
++#undef HARDENED_ENDFILE_SPEC
+ #undef ENDFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{static|nopie:crtend.o%s;:crtendS.o%s} crtn.o%s"
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
diff --git a/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-arm-default.patch b/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-arm-default.patch
new file mode 100644
index 0000000..4245517
--- /dev/null
+++ b/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-arm-default.patch
@@ -0,0 +1,27 @@
+--- gcc-3.4.3/gcc/config/arm/linux-elf.h.def~ Mon Nov 22 17:56:44 2004
++++ gcc-3.4.3/gcc/config/arm/linux-elf.h Mon Nov 22 18:01:11 2004
+@@ -93,8 +93,12 @@
+ provides part of the support for getting C++ file-scope static
+ object constructed before entering `main'. */
+
++#undef HARDENED_STARTFILE_SPEC
+ #undef STARTFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_STARTFILE_SPEC \
++ "%{!shared: %{pg|p|profile:gcrt1.o%s;static|nopie:crt1.o%s;:Scrt1.o%s}} \
++ crti.o%s %{static|nopie:crtbegin.o%s;:crtbeginS.o%s}"
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
+ crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+@@ -110,8 +114,11 @@
+ object constructed before entering `main', followed by a normal
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
++#undef HARDENED_ENDFILE_SPEC
+ #undef ENDFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_ENDFILE_SPEC \
++ "%{static|nopie:crtend.o%s;:crtendS.o%s} crtn.o%s"
+ #define ENDFILE_SPEC \
+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+ #else
diff --git a/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-ia64-default.patch b/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-ia64-default.patch
new file mode 100644
index 0000000..fa66483
--- /dev/null
+++ b/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-ia64-default.patch
@@ -0,0 +1,28 @@
+--- gcc-3.4.3/gcc/config/ia64/linux.h.def~ Mon Nov 22 17:56:44 2004
++++ gcc-3.4.3/gcc/config/ia64/linux.h Mon Nov 22 18:04:33 2004
+@@ -17,8 +17,12 @@
+ } while (0)
+
+ /* Need to override linux.h STARTFILE_SPEC, since it has crtbeginT.o in. */
++#undef HARDENED_STARTFILE_SPEC
+ #undef STARTFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_STARTFILE_SPEC \
++ "%{!shared: %{pg|p|profile:gcrt1.o%s;static|nopie:crt1.o%s;:Scrt1.o%s}}\
++ crti.o%s %{static|nopie:crtbegin.o%s;:crtbeginS.o%s}"
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+ crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+@@ -29,8 +33,12 @@
+ #endif
+
+ /* Similar to standard Linux, but adding -ffast-math support. */
++#undef HARDENED_ENDFILE_SPEC
+ #undef ENDFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{static|nopie:crtend.o%s;:crtendS.o%s} crtn.o%s"
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
diff --git a/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-rs6000-default.patch b/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-rs6000-default.patch
new file mode 100644
index 0000000..cea8453
--- /dev/null
+++ b/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-rs6000-default.patch
@@ -0,0 +1,99 @@
+--- gcc-3.4.3/gcc/config/rs6000/sysv4.h.def~ Mon Nov 22 18:42:04 2004
++++ gcc-3.4.3/gcc/config/rs6000/sysv4.h Mon Nov 22 21:11:22 2004
+@@ -824,6 +824,28 @@
+ mcall-gnu :-mbig; \
+ mcall-i960-old :-mlittle}"
+
++#ifdef HAVE_LD_PIE
++#if defined(EFAULT_PIE) || defined(EFAULT_PIE_SSP)
++#define HARDENED_ASM_SPEC "%(asm_cpu) \
++%{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
++%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
++%{mrelocatable} %{mrelocatable-lib} \
++%{!D__KERNEL__: %{!fno-PIC:%{!fno-pic:%{!fno-PIE:%{!fno-pie: %{!nopie:-K PIC} }}}} } \
++%{memb|msdata|msdata=eabi: -memb} \
++%{mlittle|mlittle-endian:-mlittle; \
++ mbig|mbig-endian :-mbig; \
++ mcall-aixdesc | \
++ mcall-freebsd | \
++ mcall-netbsd | \
++ mcall-openbsd | \
++ mcall-linux | \
++ mcall-gnu :-mbig; \
++ mcall-i960-old :-mlittle}"
++#undef ASM_SPEC
++#define ASM_SPEC HARDENED_ASM_SPEC
++#endif
++#endif
++
+ #define CC1_ENDIAN_BIG_SPEC ""
+
+ #define CC1_ENDIAN_LITTLE_SPEC "\
+@@ -1104,7 +1126,12 @@
+ %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
+ %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
+
++#undef HARDENED_STARTFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_STARTFILE_LINUX_SPEC "\
++%{!shared: %{pg|p:gcrt1.o%s;static|nopie:crt1.o%s;:Scrt1.o%s}} \
++%{mnewlib:ecrti.o%s;:crti.o%s} \
++%{static:crtbeginT.o%s;nopie:crtbegin.o%s;:crtbeginS.o%s}"
+ #define STARTFILE_LINUX_SPEC "\
+ %{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
+ %{mnewlib:ecrti.o%s;:crti.o%s} \
+@@ -1116,7 +1143,11 @@
+ %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
++#undef HARDENED_ENDFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_ENDFILE_LINUX_SPEC "\
++%{static|nopie:crtend.o%s;:crtendS.o%s} \
++%{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
+ #define ENDFILE_LINUX_SPEC "\
+ %{shared|pie:crtendS.o%s;:crtend.o%s} \
+ %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
+@@ -1126,6 +1157,15 @@
+ %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
+ #endif
+
++#ifdef HAVE_LD_PIE
++#if defined(EFAULT_PIE) || defined(EFAULT_PIE_SSP)
++#undef STARTFILE_LINUX_SPEC
++#define STARTFILE_LINUX_SPEC HARDENED_STARTFILE_LINUX_SPEC
++#undef ENDFILE_LINUX_SPEC
++#define ENDFILE_LINUX_SPEC HARDENED_ENDFILE_LINUX_SPEC
++#endif
++#endif
++
+ #define LINK_START_LINUX_SPEC ""
+
+ #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+--- gcc-3.4.3/gcc/config/rs6000/linux64.h.def~ Mon Nov 22 18:42:18 2004
++++ gcc-3.4.3/gcc/config/rs6000/linux64.h Mon Nov 22 21:12:01 2004
+@@ -149,6 +149,24 @@
+ %{mcall-netbsd: -mbig} \
+ }}}}"
+
++#ifdef HAVE_LD_PIE
++#if defined(EFAULT_PIE) || defined(EFAULT_PIE_SSP)
++#define HARDENED_ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \
++%{mrelocatable} %{mrelocatable-lib} \
++%{!D__KERNEL__: %{!fno-PIC:%{!fno-pic:%{!fno-PIE:%{!fno-pie: %{!nopie:-K PIC} }}}} } \
++%{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
++%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
++ %{mcall-freebsd: -mbig} \
++ %{mcall-i960-old: -mlittle} \
++ %{mcall-linux: -mbig} \
++ %{mcall-gnu: -mbig} \
++ %{mcall-netbsd: -mbig} \
++}}}}"
++#undef ASM_SPEC32
++#define ASM_SPEC32 HARDENED_ASM_SPEC32
++#endif
++#endif
++
+ #define ASM_SPEC64 "-a64"
+
+ #define ASM_SPEC_COMMON "%(asm_cpu) \
diff --git a/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-sparc-default.patch b/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-sparc-default.patch
new file mode 100644
index 0000000..5548e61
--- /dev/null
+++ b/3.4.6/pie/def/02_all_gcc-3.4.3-v8.7.6.7-pie-sparc-default.patch
@@ -0,0 +1,105 @@
+--- gcc-3.4.3/gcc/config/sparc/linux.h.def~ Mon Nov 22 17:56:44 2004
++++ gcc-3.4.3/gcc/config/sparc/linux.h Mon Nov 22 21:05:10 2004
+@@ -48,6 +48,7 @@
+ provides part of the support for getting C++ file-scope static
+ object constructed before entering `main'. */
+
++#undef HARDENED_STARTFILE_SPEC
+ #undef STARTFILE_SPEC
+ #ifdef USE_GNULIBC_1
+ #define STARTFILE_SPEC \
+@@ -55,6 +56,9 @@
+ %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
+ crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
+ #elif defined HAVE_LD_PIE
++#define HARDENED_STARTFILE_SPEC \
++ "%{!shared: %{pg|p:gcrt1.o%s;static|nopie:crt1.o%s;:Scrt1.o%s}}\
++ crti.o%s %{static:crtbeginT.o%s;nopie:crtbegin.o%s;:crtbeginS.o%s}"
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+@@ -70,8 +74,12 @@
+ object constructed before entering `main', followed by a normal
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
++#undef HARDENED_ENDFILE_SPEC
+ #undef ENDFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{static|nopie:crtend.o%s;:crtendS.o%s} crtn.o%s"
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+@@ -190,6 +198,17 @@
+ "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
+ %{fpic|fPIC|fpie|fPIE|pie:-K PIC} %(asm_cpu) %(asm_relax)"
+
++#ifdef HAVE_LD_PIE
++#if defined(EFAULT_PIE) || defined(EFAULT_PIE_SSP)
++#define HARDENED_ASM_SPEC \
++ "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
++ %{!D__KERNEL__: %{!fno-PIC:%{!fno-pic:%{!fno-PIE:%{!fno-pie: %{!nopie:-K PIC} }}}} } \
++ %(asm_cpu) %(asm_relax)"
++#undef ASM_SPEC
++#define ASM_SPEC HARDENED_ASM_SPEC
++#endif
++#endif
++
+ /* Same as sparc.h */
+ #undef DBX_REGISTER_NUMBER
+ #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
+--- gcc-3.4.3/gcc/config/sparc/linux64.h.def~ Mon Nov 22 18:32:33 2004
++++ gcc-3.4.3/gcc/config/sparc/linux64.h Mon Nov 22 21:09:33 2004
+@@ -71,9 +71,13 @@
+ provides part of the support for getting C++ file-scope static
+ object constructed before entering `main'. */
+
++#undef HARDENED_STARTFILE_SPEC
+ #undef STARTFILE_SPEC
+
+ #ifdef HAVE_LD_PIE
++#define HARDENED_STARTFILE_SPEC \
++ "%{!shared:%{pg|p:gcrt1.o%s;static|nopie:crt1.o%s;:Scrt1.o%s}}\
++ crti.o%s %{static:crtbeginT.o%s;nopie:crtbegin.o%s;:crtbeginS.o%s}"
+ #define STARTFILE_SPEC \
+ "%{!shared:%{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}"
+@@ -89,8 +93,12 @@
+ object constructed before entering `main', followed by a normal
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
++#undef HARDENED_ENDFILE_SPEC
+ #undef ENDFILE_SPEC
+ #ifdef HAVE_LD_PIE
++#define HARDENED_ENDFILE_SPEC \
++ "%{static|nopie:crtend.o%s;:crtendS.o%s} crtn.o%s\
++ %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
+ #define ENDFILE_SPEC \
+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
+ %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
+@@ -294,6 +302,24 @@
+ %{mlittle-endian:-EL} \
+ %(asm_cpu) %(asm_arch) %(asm_relax)"
+
++#ifdef HAVE_LD_PIE
++#if defined(EFAULT_PIE) || defined(EFAULT_PIE_SSP)
++#define HARDENED_ASM_SPEC "\
++%{V} \
++%{v:%{!V:-V}} \
++%{!Qn:-Qy} \
++%{n} \
++%{T} \
++%{Ym,*} \
++%{Wa,*:%*} \
++-s %{!D__KERNEL__: %{!fno-PIC:%{!fno-pic:%{!fno-PIE:%{!fno-pie: %{!nopie:-K PIC} }}}} } \
++%{mlittle-endian:-EL} \
++%(asm_cpu) %(asm_arch) %(asm_relax)"
++#undef ASM_SPEC
++#define ASM_SPEC HARDENED_ASM_SPEC
++#endif
++#endif
++
+ /* Same as sparc.h */
+ #undef DBX_REGISTER_NUMBER
+ #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
diff --git a/3.4.6/pie/nondef/02_all_gcc-3.4.3-v8.7.1-pie-rs6000-nondefault.patch b/3.4.6/pie/nondef/02_all_gcc-3.4.3-v8.7.1-pie-rs6000-nondefault.patch
new file mode 100644
index 0000000..725f81d
--- /dev/null
+++ b/3.4.6/pie/nondef/02_all_gcc-3.4.3-v8.7.1-pie-rs6000-nondefault.patch
@@ -0,0 +1,22 @@
+--- gcc-3.4.0/gcc/config/rs6000/sysv4.h.nondef Tue May 11 12:12:34 2004
++++ gcc-3.4.0/gcc/config/rs6000/sysv4.h Tue May 11 12:41:19 2004
+@@ -817,7 +817,7 @@
+ #define ASM_SPEC "%(asm_cpu) \
+ %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
+ %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
+-%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
++%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE|pie:-K PIC} \
+ %{memb|msdata|msdata=eabi: -memb} \
+ %{mlittle|mlittle-endian:-mlittle; \
+ mbig|mbig-endian :-mbig; \
+--- gcc-3.4.0/gcc/config/rs6000/linux64.h.nondef Thu Mar 11 04:25:06 2004
++++ gcc-3.4.0/gcc/config/rs6000/linux64.h Tue May 11 12:44:26 2004
+@@ -134,7 +134,7 @@
+ #endif
+
+ #define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \
+-%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} \
++%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE|pie:-K PIC} \
+ %{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
+ %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
+ %{mcall-freebsd: -mbig} \
diff --git a/3.4.6/pie/nondef/02_all_gcc-3.4.3-v8.7.6.7-pie-sparc-nondefault.patch b/3.4.6/pie/nondef/02_all_gcc-3.4.3-v8.7.6.7-pie-sparc-nondefault.patch
new file mode 100644
index 0000000..60cee67
--- /dev/null
+++ b/3.4.6/pie/nondef/02_all_gcc-3.4.3-v8.7.6.7-pie-sparc-nondefault.patch
@@ -0,0 +1,22 @@
+--- gcc-3.4.3/gcc/config/sparc/linux.h.mps Mon Nov 22 15:28:32 2004
++++ gcc-3.4.3/gcc/config/sparc/linux.h Mon Nov 22 15:28:51 2004
+@@ -177,7 +177,7 @@
+ #undef ASM_SPEC
+ #define ASM_SPEC \
+ "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
+- %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu) %(asm_relax)"
++ %{fpic|fPIC|fpie|fPIE|pie:-K PIC} %(asm_cpu) %(asm_relax)"
+
+ /* Same as sparc.h */
+ #undef DBX_REGISTER_NUMBER
+--- gcc-3.4.3/gcc/config/sparc/linux64.h.mps Mon Nov 22 15:28:40 2004
++++ gcc-3.4.3/gcc/config/sparc/linux64.h Mon Nov 22 15:29:09 2004
+@@ -281,7 +281,7 @@
+ %{T} \
+ %{Ym,*} \
+ %{Wa,*:%*} \
+--s %{fpic|fPIC|fpie|fPIE:-K PIC} \
++-s %{fpic|fPIC|fpie|fPIE|pie:-K PIC} \
+ %{mlittle-endian:-EL} \
+ %(asm_cpu) %(asm_arch) %(asm_relax)"
+
diff --git a/3.4.6/pie/upstream/00_all_gcc-4.0-cvs-incompat.patch b/3.4.6/pie/upstream/00_all_gcc-4.0-cvs-incompat.patch
new file mode 100644
index 0000000..e5bc302
--- /dev/null
+++ b/3.4.6/pie/upstream/00_all_gcc-4.0-cvs-incompat.patch
@@ -0,0 +1,11 @@
+--- gcc-4.0.old/gcc/gcc.c.mps Sun Nov 14 21:10:35 2004
++++ gcc-4.0/gcc/gcc.c Sun Nov 14 21:43:17 2004
+@@ -794,6 +794,8 @@
+ /* NB: This is shared amongst all front-ends. */
+ static const char *cc1_options =
+ "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
++ %{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}}\
++ %{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible}}\
+ %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\
+ %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}\
+ %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi}\
diff --git a/3.4.6/pie/upstream/00_all_gcc-4.0-cvs-mips-pic-for-3.4.3.patch b/3.4.6/pie/upstream/00_all_gcc-4.0-cvs-mips-pic-for-3.4.3.patch
new file mode 100644
index 0000000..355ede1
--- /dev/null
+++ b/3.4.6/pie/upstream/00_all_gcc-4.0-cvs-mips-pic-for-3.4.3.patch
@@ -0,0 +1,40 @@
+--- gcc-3.4.3/gcc/config/mips/linux.h.upstream~ 2004-11-22 17:02:26.000000000 +0100
++++ gcc-3.4.3/gcc/config/mips/linux.h 2004-11-22 17:06:19.000000000 +0100
+@@ -56,8 +56,11 @@
+ #define TARGET_OS_CPP_BUILTINS() \
+ do { \
+ LINUX_TARGET_OS_CPP_BUILTINS(); \
+- builtin_define ("__PIC__"); \
+- builtin_define ("__pic__"); \
++ if (TARGET_ABICALLS) \
++ { \
++ builtin_define ("__PIC__"); \
++ builtin_define ("__pic__"); \
++ } \
+ builtin_assert ("machine=mips"); \
+ /* The GNU C++ standard library requires this. */ \
+ if (c_dialect_cxx ()) \
+@@ -96,10 +99,7 @@
+ } while (0)
+
+ #undef SUBTARGET_CPP_SPEC
+-#define SUBTARGET_CPP_SPEC "\
+-%{fno-PIC:-U__PIC__ -U__pic__} %{fno-pic:-U__PIC__ -U__pic__} \
+-%{fPIC|fPIE|fpic|fpie:-D__PIC__ -D__pic__} \
+-%{pthread:-D_REENTRANT}"
++#define SUBTARGET_CPP_SPEC "%{pthread:-D_REENTRANT}"
+
+ /* From iris5.h */
+ /* -G is incompatible with -KPIC which is the default, so only allow objects
+@@ -132,10 +132,7 @@
+ #endif
+
+ #undef SUBTARGET_ASM_SPEC
+-#define SUBTARGET_ASM_SPEC "\
+-%{mabi=64: -64} \
+-%{!fno-PIC:%{!fno-pic:-KPIC}} \
+-%{fno-PIC:-non_shared} %{fno-pic:-non_shared}"
++#define SUBTARGET_ASM_SPEC "%{mabi=64: -64} %{!mno-abicalls:-KPIC}"
+
+ /* The MIPS assembler has different syntax for .set. We set it to
+ .dummy to trap any errors. */
diff --git a/3.4.6/pie/upstream/00_all_gcc-4.0-cvs-pic.patch b/3.4.6/pie/upstream/00_all_gcc-4.0-cvs-pic.patch
new file mode 100644
index 0000000..173ac5a
--- /dev/null
+++ b/3.4.6/pie/upstream/00_all_gcc-4.0-cvs-pic.patch
@@ -0,0 +1,117 @@
+diff -urN gcc.old/gcc/config/alpha/linux.h gcc/gcc/config/alpha/linux.h
+--- gcc.old/gcc/config/alpha/linux.h Wed Sep 8 02:17:13 2004
++++ gcc/gcc/config/alpha/linux.h Mon Nov 8 11:04:47 2004
+@@ -36,6 +36,11 @@
+ /* The GNU C++ standard library requires this. */ \
+ if (c_dialect_cxx ()) \
+ builtin_define ("_GNU_SOURCE"); \
++ if (flag_pic) \
++ { \
++ builtin_define ("__PIC__"); \
++ builtin_define ("__pic__"); \
++ } \
+ } while (0)
+
+ #undef LIB_SPEC
+diff -urN gcc.old/gcc/config/arm/linux-elf.h gcc/gcc/config/arm/linux-elf.h
+--- gcc.old/gcc/config/arm/linux-elf.h Sat May 15 14:41:33 2004
++++ gcc/gcc/config/arm/linux-elf.h Mon Nov 8 11:04:47 2004
+@@ -89,7 +89,17 @@
+ %{mbig-endian:-EB}" \
+ SUBTARGET_EXTRA_LINK_SPEC
+
+-#define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
++#define TARGET_OS_CPP_BUILTINS() \
++ do \
++ { \
++ LINUX_TARGET_OS_CPP_BUILTINS(); \
++ if (flag_pic) \
++ { \
++ builtin_define ("__PIC__"); \
++ builtin_define ("__pic__"); \
++ } \
++ } \
++ while (0)
+
+ /* This is how we tell the assembler that two symbols have the same value. */
+ #define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \
+diff -urN gcc.old/gcc/config/arm/linux-gas.h gcc/gcc/config/arm/linux-gas.h
+--- gcc.old/gcc/config/arm/linux-gas.h Tue Mar 16 19:14:32 2004
++++ gcc/gcc/config/arm/linux-gas.h Mon Nov 8 11:04:47 2004
+@@ -28,7 +28,7 @@
+ #define DEFAULT_SIGNED_CHAR 0
+
+ #undef SUBTARGET_CPP_SPEC
+-#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{fPIC|fPIE:-D__PIC__ -D__pic__} %{fpic|fpie:-D__PIC__ -D__pic__}"
++#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
+
+ #undef SIZE_TYPE
+ #define SIZE_TYPE "unsigned int"
+diff -urN gcc.old/gcc/config/pa/pa-linux.h gcc/gcc/config/pa/pa-linux.h
+--- gcc.old/gcc/config/pa/pa-linux.h Sat Nov 29 04:08:11 2003
++++ gcc/gcc/config/pa/pa-linux.h Mon Nov 8 11:04:47 2004
+@@ -58,11 +58,16 @@
+ { \
+ LINUX_TARGET_OS_CPP_BUILTINS(); \
+ builtin_assert ("machine=bigendian"); \
++ if (flag_pic) \
++ { \
++ builtin_define ("__PIC__"); \
++ builtin_define ("__pic__"); \
++ } \
+ } \
+ while (0)
+
+ #undef CPP_SPEC
+-#define CPP_SPEC "%{fPIC|fpic|fPIE|fpie:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
++#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
+
+ #undef LIB_SPEC
+ #define LIB_SPEC \
+diff -urN gcc.old/gcc/config/sparc/linux.h gcc/gcc/config/sparc/linux.h
+--- gcc.old/gcc/config/sparc/linux.h Wed Sep 8 02:17:19 2004
++++ gcc/gcc/config/sparc/linux.h Mon Nov 8 11:04:47 2004
+@@ -29,6 +29,11 @@
+ builtin_assert ("system=linux"); \
+ builtin_assert ("system=unix"); \
+ builtin_assert ("system=posix"); \
++ if (flag_pic) \
++ { \
++ builtin_define ("__PIC__"); \
++ builtin_define ("__pic__"); \
++ } \
+ } \
+ while (0)
+
+@@ -100,7 +105,7 @@
+
+ #undef CPP_SUBTARGET_SPEC
+ #define CPP_SUBTARGET_SPEC \
+-"%{fPIC|fPIE|fpic|fpie:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} \
++"%{posix:-D_POSIX_SOURCE} \
+ %{pthread:-D_REENTRANT} %{mlong-double-128:-D__LONG_DOUBLE_128__}"
+
+ #undef LIB_SPEC
+diff -urN gcc.old/gcc/config/sparc/linux64.h gcc/gcc/config/sparc/linux64.h
+--- gcc.old/gcc/config/sparc/linux64.h Wed Sep 8 02:17:19 2004
++++ gcc/gcc/config/sparc/linux64.h Mon Nov 8 11:04:47 2004
+@@ -30,6 +30,11 @@
+ builtin_assert ("system=linux"); \
+ builtin_assert ("system=unix"); \
+ builtin_assert ("system=posix"); \
++ if (flag_pic) \
++ { \
++ builtin_define ("__PIC__"); \
++ builtin_define ("__pic__"); \
++ } \
+ } \
+ while (0)
+
+@@ -127,7 +132,6 @@
+
+ #undef CPP_SUBTARGET_SPEC
+ #define CPP_SUBTARGET_SPEC "\
+-%{fPIC|fpic|fPIE|fpie:-D__PIC__ -D__pic__} \
+ %{posix:-D_POSIX_SOURCE} \
+ %{pthread:-D_REENTRANT} \
+ "
diff --git a/3.4.6/pie/upstream/00_all_gcc-4.0-cvs-start_endfile-for-3.4.4.patch b/3.4.6/pie/upstream/00_all_gcc-4.0-cvs-start_endfile-for-3.4.4.patch
new file mode 100644
index 0000000..bfee2df
--- /dev/null
+++ b/3.4.6/pie/upstream/00_all_gcc-4.0-cvs-start_endfile-for-3.4.4.patch
@@ -0,0 +1,202 @@
+--- gcc-3.4.4/gcc/config/alpha/elf.h.start_end~ 2003-12-25 16:17:34 +0100
++++ gcc-3.4.4/gcc/config/alpha/elf.h 2005-05-23 12:12:27 +0200
+@@ -399,7 +399,7 @@ void FN (void) \
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
+ /* Provide a ENDFILE_SPEC appropriate for ELF. Here we tack on the
+@@ -408,9 +408,15 @@ void FN (void) \
+ `main', followed by a normal ELF "finalizer" file, `crtn.o'. */
+
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ /* We support #pragma. */
+ #define HANDLE_SYSV_PRAGMA 1
+--- gcc-3.4.4/gcc/config/arm/linux-elf.h.start_end~ 2005-05-23 12:05:44 +0200
++++ gcc-3.4.4/gcc/config/arm/linux-elf.h 2005-05-23 12:12:27 +0200
+@@ -80,12 +80,15 @@
+ object constructed before entering `main'. */
+
+ #undef STARTFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define STARTFILE_SPEC \
+- "%{!shared: \
+- %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
+- %{!p:%{profile:gcrt1.o%s} \
+- %{!profile:crt1.o%s}}}} \
+- crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
++ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
++ crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++#else
++#define STARTFILE_SPEC \
++ "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
++ crti.o%s %{shared:crtbeginS.o%s;:crtbegin.o%s}"
++#endif
+
+ /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
+ the GNU/Linux magical crtend.o file (see crtstuff.c) which
+@@ -94,8 +97,13 @@
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+- "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
++ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ #undef LINK_SPEC
+ #ifdef USE_UCLIBC
+--- gcc-3.4.4/gcc/config/ia64/linux.h.start_end~ 2005-05-23 12:05:42 +0200
++++ gcc-3.4.4/gcc/config/ia64/linux.h 2005-05-23 12:12:27 +0200
+@@ -27,14 +27,20 @@ do { \
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ crti.o%s %{shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
+ /* Similar to standard Linux, but adding -ffast-math support. */
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ /* Define this for shared library support because it isn't in the main
+ linux.h file. */
+--- gcc-3.4.4/gcc/config/rs6000/linux64.h.start_end~ 2005-04-29 02:31:57 +0200
++++ gcc-3.4.4/gcc/config/rs6000/linux64.h 2005-05-23 12:12:27 +0200
+@@ -142,7 +142,7 @@
+ #endif
+
+ #define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \
+-%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
++%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} \
+ %{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
+ %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
+ %{mcall-freebsd: -mbig} \
+--- gcc-3.4.4/gcc/config/rs6000/sysv4.h.start_end~ 2005-05-23 12:05:43 +0200
++++ gcc-3.4.4/gcc/config/rs6000/sysv4.h 2005-05-23 12:17:15 +0200
+@@ -1113,12 +1113,18 @@ extern int fixuplabelno;
+ #define STARTFILE_LINUX_SPEC "\
+ %{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}} \
+ %{mnewlib:ecrti.o%s;:crti.o%s} \
+-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++%{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_LINUX_SPEC "\
+ %{shared|pie:crtendS.o%s;:crtend.o%s} \
+ %{mnewlib:ecrtn.o%s;:crtn.o%s}"
++#else
++#define ENDFILE_LINUX_SPEC "\
++%{shared:crtendS.o%s;:crtend.o%s} \
++%{mnewlib:ecrtn.o%s;:crtn.o%s}"
++#endif
+
+ #define LINK_START_LINUX_SPEC ""
+
+--- gcc-3.4.4/gcc/config/sparc/linux.h.start_end~ 2005-05-23 12:05:44 +0200
++++ gcc-3.4.4/gcc/config/sparc/linux.h 2005-05-23 12:12:27 +0200
+@@ -61,7 +61,7 @@ Boston, MA 02111-1307, USA. */
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
+ /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
+@@ -71,9 +71,15 @@ Boston, MA 02111-1307, USA. */
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ /* This is for -profile to use -lc_p instead of -lc. */
+ #undef CC1_SPEC
+--- gcc-3.4.4/gcc/config/sparc/linux64.h.start_end~ 2005-05-23 12:05:44 +0200
++++ gcc-3.4.4/gcc/config/sparc/linux64.h 2005-05-23 12:12:27 +0200
+@@ -80,7 +80,7 @@ Boston, MA 02111-1307, USA. */
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared:%{pg|p:gcrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}"
++ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbeginS.o%s}"
+ #endif
+
+ /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
+@@ -90,10 +90,15 @@ Boston, MA 02111-1307, USA. */
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
+ #undef ENDFILE_SPEC
+-
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
+ %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
++#else
++#define ENDFILE_SPEC \
++ "%{shared:crtendS.o%s;:crtend.o%s} crtn.o%s\
++ %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
++#endif
+
+ /* The GNU C++ standard library requires that these macros be defined. */
+ #undef CPLUSPLUS_CPP_SPEC
+--- gcc-3.4.4/gcc/config/linux.h.start_end~ 2003-11-29 04:08:10 +0100
++++ gcc-3.4.4/gcc/config/linux.h 2005-05-23 12:12:27 +0200
+@@ -53,7 +53,7 @@ Boston, MA 02111-1307, USA. */
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
+ /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
+@@ -63,8 +63,13 @@ Boston, MA 02111-1307, USA. */
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ /* This is for -profile to use -lc_p instead of -lc. */
+ #ifndef CC1_SPEC
diff --git a/3.4.6/pie/upstream/03_all_gcc-3.4.0-v8.7.6.1-pie-arm.patch b/3.4.6/pie/upstream/03_all_gcc-3.4.0-v8.7.6.1-pie-arm.patch
new file mode 100644
index 0000000..fbc41a0
--- /dev/null
+++ b/3.4.6/pie/upstream/03_all_gcc-3.4.0-v8.7.6.1-pie-arm.patch
@@ -0,0 +1,16 @@
+--- gcc-3.4.0/gcc/config/arm/linux-elf.h.mps Thu May 20 09:11:17 2004
++++ gcc-3.4.0/gcc/config/arm/linux-elf.h Thu May 20 09:12:28 2004
+@@ -91,10 +91,11 @@
+ #define LINK_SPEC "%{h*} %{version:-v} \
+ %{b} %{Wl,*:%*} \
+- %{static:-Bstatic} \
+ %{shared:-shared} \
+ %{symbolic:-Bsymbolic} \
++ %{!shared: %{!static: \
+ %{rdynamic:-export-dynamic} \
+- %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \
++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
++ %{static:-Bstatic}} \
+ -X \
+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
+ SUBTARGET_EXTRA_LINK_SPEC