aboutsummaryrefslogtreecommitdiff
path: root/4.8.1
diff options
context:
space:
mode:
authorRyan Hill <rhill@gentoo.org>2013-06-04 05:21:14 +0000
committerRyan Hill <rhill@gentoo.org>2013-06-04 05:21:14 +0000
commit07f0f3dd2921767c94f853ab68814fb11f7acd45 (patch)
treec92272981263d8e4e0b9affed1a3c8872eef7106 /4.8.1
parentAdd gcc 4.8.1 piepatchset (diff)
downloadgcc-patches-07f0f3dd2921767c94f853ab68814fb11f7acd45.tar.gz
gcc-patches-07f0f3dd2921767c94f853ab68814fb11f7acd45.tar.bz2
gcc-patches-07f0f3dd2921767c94f853ab68814fb11f7acd45.zip
Initial 4.8.1 patchset based of latest 4.8.0 patchset.
Diffstat (limited to '4.8.1')
-rw-r--r--4.8.1/gentoo/10_all_default-fortify-source.patch28
-rw-r--r--4.8.1/gentoo/11_all_default-warn-format-security.patch36
-rw-r--r--4.8.1/gentoo/12_all_default-warn-trampolines.patch24
-rw-r--r--4.8.1/gentoo/15_all_libgfortran-Werror.patch17
-rw-r--r--4.8.1/gentoo/16_all_libgomp-Werror.patch17
-rw-r--r--4.8.1/gentoo/25_all_alpha-mieee-default.patch31
-rw-r--r--4.8.1/gentoo/26_all_alpha-asm-mcpu.patch16
-rw-r--r--4.8.1/gentoo/29_all_arm_armv4t-default.patch16
-rw-r--r--4.8.1/gentoo/30_all_arm_armv4-no-thumb-fix-link.patch54
-rw-r--r--4.8.1/gentoo/34_all_ia64_note.GNU-stack.patch92
-rw-r--r--4.8.1/gentoo/38_all_sh_pr24836_all-archs.patch27
-rw-r--r--4.8.1/gentoo/42_all_superh_default-multilib.patch24
-rw-r--r--4.8.1/gentoo/48_all_x86_pr53113_libitm-avx.patch28
-rw-r--r--4.8.1/gentoo/50_all_libiberty-asprintf.patch18
-rw-r--r--4.8.1/gentoo/51_all_libiberty-pic.patch10
-rw-r--r--4.8.1/gentoo/52_all_netbsd-Bsymbolic.patch12
-rw-r--r--4.8.1/gentoo/67_all_gcc-poison-system-directories.patch201
-rw-r--r--4.8.1/gentoo/74_all_gcc48_cloog-dl.patch537
-rw-r--r--4.8.1/gentoo/92_all_freebsd-pie.patch71
-rw-r--r--4.8.1/gentoo/README.history20
-rw-r--r--4.8.1/pie/01_all_gcc48_configure.patch266
-rw-r--r--4.8.1/pie/02_all_gcc48_config.in.patch32
-rw-r--r--4.8.1/pie/03_all_gcc48_Makefile.in.patch130
-rw-r--r--4.8.1/pie/05_all_gcc48_gcc.c.patch25
-rw-r--r--4.8.1/pie/15_all_gcc44_decl-tls-model.patch20
-rw-r--r--4.8.1/pie/16_all_gcc47_nopie_option.patch16
-rw-r--r--4.8.1/pie/20_all_gcc46_config_crtbeginp.patch36
-rw-r--r--4.8.1/pie/24_all_gcc44_invoke.texi.patch44
-rw-r--r--4.8.1/pie/33_all_gcc48_config_rs6000.patch47
-rw-r--r--4.8.1/pie/34_all_gcc48_config_i386.patch56
-rw-r--r--4.8.1/pie/35_all_gcc48_config_arm.patch35
-rw-r--r--4.8.1/pie/36_all_gcc48_config_mips.patch61
-rw-r--r--4.8.1/pie/37_all_gcc48_config_ia64.patch30
-rw-r--r--4.8.1/pie/40_all_gcc48_config_esp.patch135
-rw-r--r--4.8.1/pie/README18
-rw-r--r--4.8.1/pie/README.Changelog388
-rw-r--r--4.8.1/pie/README.Gentoo.patches28
-rw-r--r--4.8.1/pie/README.history319
-rw-r--r--4.8.1/uclibc/90_all_100-uclibc-conf.patch33
-rw-r--r--4.8.1/uclibc/90_all_301-missing-execinfo_h.patch11
-rw-r--r--4.8.1/uclibc/90_all_302-c99-snprintf.patch13
-rw-r--r--4.8.1/uclibc/90_all_305-libmudflap-susv3-legacy.patch49
42 files changed, 3071 insertions, 0 deletions
diff --git a/4.8.1/gentoo/10_all_default-fortify-source.patch b/4.8.1/gentoo/10_all_default-fortify-source.patch
new file mode 100644
index 0000000..a71711a
--- /dev/null
+++ b/4.8.1/gentoo/10_all_default-fortify-source.patch
@@ -0,0 +1,28 @@
+Enable -D_FORTIFY_SOURCE=2 by default.
+
+--- a/gcc/c-family/c-cppbuiltin.c
++++ b/gcc/c-family/c-cppbuiltin.c
+@@ -853,6 +853,9 @@ c_cpp_builtins (cpp_reader *pfile)
+ builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
+ builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
+
++ /* Fortify Source enabled by default w/optimization. */
++ cpp_define (pfile, "_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0)");
++
+ /* Misc. */
+ if (flag_gnu89_inline)
+ cpp_define (pfile, "__GNUC_GNU_INLINE__");
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -6568,6 +6568,11 @@ also turns on the following optimization flags:
+ Please note the warning under @option{-fgcse} about
+ invoking @option{-O2} on programs that use computed gotos.
+
++NOTE: In Gentoo, @option{-D_FORTIFY_SOURCE=2} is set by default, and is
++activated when @option{-O} is set to 2 or higher. This enables additional
++compile-time and run-time checks for several libc functions. To disable,
++specify either @option{-U_FORTIFY_SOURCE} or @option{-D_FORTIFY_SOURCE=0}.
++
+ @item -O3
+ @opindex O3
+ Optimize yet more. @option{-O3} turns on all optimizations specified
diff --git a/4.8.1/gentoo/11_all_default-warn-format-security.patch b/4.8.1/gentoo/11_all_default-warn-format-security.patch
new file mode 100644
index 0000000..2314699
--- /dev/null
+++ b/4.8.1/gentoo/11_all_default-warn-format-security.patch
@@ -0,0 +1,36 @@
+Enable -Wformat and -Wformat-security by default.
+
+--- a/gcc/c-family/c.opt
++++ b/gcc/c-family/c.opt
+@@ -400,7 +400,7 @@ C ObjC C++ ObjC++ Var(warn_format_nonliteral) Warning LangEnabledBy(C ObjC C++ O
+ Warn about format strings that are not literals
+
+ Wformat-security
+-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
++C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
+ Warn about possible security problems with format functions
+
+ Wformat-y2k
+@@ -412,7 +412,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
+ Warn about zero-length formats
+
+ Wformat=
+-C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0)
++C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0)
+ Warn about printf/scanf/strftime/strfmon format string anomalies
+
+ Wignored-qualifiers
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -3362,6 +3362,11 @@ currently a subset of what @option{-Wformat-nonliteral} warns about, but
+ in future warnings may be added to @option{-Wformat-security} that are not
+ included in @option{-Wformat-nonliteral}.)
+
++In Gentoo this option is enabled by default for C, C++, ObjC, ObjC++.
++To disable, use @option{-Wno-format-security}, or disable all format
++warnings with @option{-Wformat=0}. To make format security warnings
++fatal, specify @option{-Werror=format-security}.
++
+ @item -Wformat-y2k
+ @opindex Wformat-y2k
+ @opindex Wno-format-y2k
diff --git a/4.8.1/gentoo/12_all_default-warn-trampolines.patch b/4.8.1/gentoo/12_all_default-warn-trampolines.patch
new file mode 100644
index 0000000..2fd4051
--- /dev/null
+++ b/4.8.1/gentoo/12_all_default-warn-trampolines.patch
@@ -0,0 +1,24 @@
+Enable -Wtrampolines by default.
+
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -640,7 +640,7 @@ Common Var(warn_system_headers) Warning
+ Do not suppress warnings from system headers
+
+ Wtrampolines
+-Common Var(warn_trampolines) Warning
++Common Var(warn_trampolines) Init(1) Warning
+ Warn whenever a trampoline is generated
+
+ Wtype-limits
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -4007,6 +4007,8 @@ headers---for that, @option{-Wunknown-pragmas} must also be used.
+ for most targets, it is made up of code and thus requires the stack
+ to be made executable in order for the program to work properly.
+
++ This warning is enabled by default in Gentoo.
++
+ @item -Wfloat-equal
+ @opindex Wfloat-equal
+ @opindex Wno-float-equal
diff --git a/4.8.1/gentoo/15_all_libgfortran-Werror.patch b/4.8.1/gentoo/15_all_libgfortran-Werror.patch
new file mode 100644
index 0000000..5f15373
--- /dev/null
+++ b/4.8.1/gentoo/15_all_libgfortran-Werror.patch
@@ -0,0 +1,17 @@
+libgfortran does not respect --disable-werror
+
+https://bugs.gentoo.org/433435
+http://gcc.gnu.org/PR54724
+
+
+--- a/libgfortran/configure
++++ b/libgfortran/configure
+@@ -5764,7 +5764,7 @@ fi
+
+ # Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC.
+ if test "x$GCC" = "xyes"; then
+- AM_FCFLAGS="-I . -Wall -Werror -fimplicit-none -fno-repack-arrays -fno-underscoring"
++ AM_FCFLAGS="-I . -Wall -fimplicit-none -fno-repack-arrays -fno-underscoring"
+ ## We like to use C99 routines when available. This makes sure that
+ ## __STDC_VERSION__ is set such that libc includes make them available.
+ AM_CFLAGS="-std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings"
diff --git a/4.8.1/gentoo/16_all_libgomp-Werror.patch b/4.8.1/gentoo/16_all_libgomp-Werror.patch
new file mode 100644
index 0000000..d6a355d
--- /dev/null
+++ b/4.8.1/gentoo/16_all_libgomp-Werror.patch
@@ -0,0 +1,17 @@
+libgomp does not respect --disable-werror
+
+https://bugs.gentoo.org/229059
+http://gcc.gnu.org/PR38436
+
+
+--- a/libgomp/configure
++++ b/libgomp/configure
+@@ -4282,7 +4282,7 @@ save_CFLAGS="$CFLAGS"
+
+ # Add -Wall -Werror if we are using GCC.
+ if test "x$GCC" = "xyes"; then
+- XCFLAGS="$XCFLAGS -Wall -Werror"
++ XCFLAGS="$XCFLAGS -Wall"
+ fi
+
+ # Find other programs we need.
diff --git a/4.8.1/gentoo/25_all_alpha-mieee-default.patch b/4.8.1/gentoo/25_all_alpha-mieee-default.patch
new file mode 100644
index 0000000..9f99434
--- /dev/null
+++ b/4.8.1/gentoo/25_all_alpha-mieee-default.patch
@@ -0,0 +1,31 @@
+Set the default behavior on alpha to use -mieee since the large majority of
+time we want this (bad/weird things can happen with packages built without
+it).
+
+To satisfy those people who may not want -mieee forced on them all the time,
+we also provide -mno-ieee.
+
+Patch by Mike Frysinger <vapier@gentoo.org>
+
+--- a/gcc/config/alpha/alpha.h
++++ b/gcc/config/alpha/alpha.h
+@@ -96,6 +96,8 @@ along with GCC; see the file COPYING3. If not see
+ while (0)
+ #endif
+
++#define CPP_SPEC "%{!no-ieee:-mieee}"
++
+ /* Run-time compilation parameters selecting different hardware subsets. */
+
+ /* Which processor to schedule for. The cpu attribute defines a list that
+--- a/gcc/config/alpha/alpha.opt
++++ b/gcc/config/alpha/alpha.opt
+@@ -39,7 +39,7 @@ Target RejectNegative Mask(IEEE_CONFORMANT)
+ Request IEEE-conformant math library routines (OSF/1)
+
+ mieee
+-Target Report RejectNegative Mask(IEEE)
++Target Report Mask(IEEE)
+ Emit IEEE-conformant code, without inexact exceptions
+
+ mieee-with-inexact
diff --git a/4.8.1/gentoo/26_all_alpha-asm-mcpu.patch b/4.8.1/gentoo/26_all_alpha-asm-mcpu.patch
new file mode 100644
index 0000000..593431c
--- /dev/null
+++ b/4.8.1/gentoo/26_all_alpha-asm-mcpu.patch
@@ -0,0 +1,16 @@
+https://bugs.gentoo.org/170146
+http://gcc.gnu.org/ml/gcc-patches/2009-11/msg00403.html
+
+alpha: turn -mcpu=<cpu> into -m<cpu> for assembler all the time
+
+--- a/gcc/config/alpha/elf.h
++++ b/gcc/config/alpha/elf.h
+@@ -46,7 +46,7 @@ along with GCC; see the file COPYING3. If not see
+ #define CC1_SPEC "%{G*}"
+
+ #undef ASM_SPEC
+-#define ASM_SPEC "%{G*} %{relax:-relax} %{!gstabs*:-no-mdebug}%{gstabs*:-mdebug}"
++#define ASM_SPEC "%{G*} %{relax:-relax} %{!gstabs*:-no-mdebug}%{gstabs*:-mdebug} %{mcpu=*:-m%*}"
+
+ #undef IDENT_ASM_OP
+ #define IDENT_ASM_OP "\t.ident\t"
diff --git a/4.8.1/gentoo/29_all_arm_armv4t-default.patch b/4.8.1/gentoo/29_all_arm_armv4t-default.patch
new file mode 100644
index 0000000..4616cf9
--- /dev/null
+++ b/4.8.1/gentoo/29_all_arm_armv4t-default.patch
@@ -0,0 +1,16 @@
+gcc defaults to armv5t for all targets even armv4t
+
+http://sourceware.org/ml/crossgcc/2008-05/msg00009.html
+
+
+--- a/gcc/config/arm/linux-eabi.h
++++ b/gcc/config/arm/linux-eabi.h
+@@ -45,7 +45,7 @@
+ The ARM10TDMI core is the default for armv5t, so set
+ SUBTARGET_CPU_DEFAULT to achieve this. */
+ #undef SUBTARGET_CPU_DEFAULT
+-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
+
+ /* TARGET_BIG_ENDIAN_DEFAULT is set in
+ config.gcc for big endian configurations. */
diff --git a/4.8.1/gentoo/30_all_arm_armv4-no-thumb-fix-link.patch b/4.8.1/gentoo/30_all_arm_armv4-no-thumb-fix-link.patch
new file mode 100644
index 0000000..3cbd216
--- /dev/null
+++ b/4.8.1/gentoo/30_all_arm_armv4-no-thumb-fix-link.patch
@@ -0,0 +1,54 @@
+From 73aa8c34427a4282930ca8667165d844ee698859 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Fri, 19 Apr 2013 16:32:28 -0400
+Subject: [PATCH] gcc: arm: linux-eabi: fix handling of armv4 bx fixups when
+ linking
+
+The bpabi.h header already sets up defines to automatically use the
+--fix-v4bx flag with the assembler & linker as needed, and creates a
+default assembly & linker spec which uses those. Unfortunately, the
+linux-eabi.h header clobbers the LINK_SPEC define and doesn't include
+the v4bx define when setting up its own. So while the assembler spec
+is retained and works fine to generate the right relocs, building for
+armv4 targets doesn't invoke the linker correctly so all the relocs
+get processed as if we had an armv4t target.
+
+You can see this with -dumpspecs when configuring gcc for an armv4
+target and using --with-arch=armv4:
+$ armv4l-unknown-linux-gnueabi-gcc -dumpspecs |& grep -B 1 fix-v4bx
+*subtarget_extra_asm_spec:
+.... %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx} ...
+
+With this fix in place, we also get the link spec:
+$ armv4l-unknown-linux-gnueabi-gcc -dumpspecs |& grep -B 1 fix-v4bx
+*link:
+... %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx} ...
+
+And all my hello world tests / glibc builds automatically turn the
+bx insn into the 'mov pc, lr' insn and all is right in the world.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+
+2013-04-19 Mike Frysinger <vapier@gentoo.org>
+
+ * config/arm/linux-eabi.h (LINK_SPEC): Add TARGET_FIX_V4BX_SPEC.
+---
+ gcc/config/arm/linux-eabi.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
+index 4a425c8..8b7ebb2 100644
+--- a/gcc/config/arm/linux-eabi.h
++++ b/gcc/config/arm/linux-eabi.h
+@@ -80,7 +80,7 @@
+ /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
+ use the GNU/Linux version, not the generic BPABI version. */
+ #undef LINK_SPEC
+-#define LINK_SPEC BE8_LINK_SPEC \
++#define LINK_SPEC TARGET_FIX_V4BX_SPEC BE8_LINK_SPEC \
+ LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
+ LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
+
+--
+1.8.2.1
+
diff --git a/4.8.1/gentoo/34_all_ia64_note.GNU-stack.patch b/4.8.1/gentoo/34_all_ia64_note.GNU-stack.patch
new file mode 100644
index 0000000..219fe9f
--- /dev/null
+++ b/4.8.1/gentoo/34_all_ia64_note.GNU-stack.patch
@@ -0,0 +1,92 @@
+http://gcc.gnu.org/PR21098
+
+
+2004-09-20 Jakub Jelinek <jakub@redhat.com>
+
+ * config/rs6000/ppc-asm.h: Add .note.GNU-stack section also
+ on ppc64-linux.
+
+ * config/ia64/lib1funcs.asm: Add .note.GNU-stack section on
+ ia64-linux.
+ * config/ia64/crtbegin.asm: Likewise.
+ * config/ia64/crtend.asm: Likewise.
+ * config/ia64/crti.asm: Likewise.
+ * config/ia64/crtn.asm: Likewise.
+
+2004-05-14 Jakub Jelinek <jakub@redhat.com>
+
+ * config/ia64/linux.h (TARGET_ASM_FILE_END): Define.
+
+
+--- a/gcc/config/ia64/linux.h
++++ b/gcc/config/ia64/linux.h
+@@ -24,6 +24,8 @@ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
++
+ /* This is for -profile to use -lc_p instead of -lc. */
+ #undef CC1_SPEC
+ #define CC1_SPEC "%{profile:-p} %{G*}"
+--- a/gcc/config/rs6000/ppc-asm.h
++++ b/gcc/config/rs6000/ppc-asm.h
+@@ -352,7 +352,7 @@ GLUE(.L,name): \
+ #endif
+ #endif
+
+-#if defined __linux__ && !defined __powerpc64__
++#if defined __linux__
+ .section .note.GNU-stack
+ .previous
+ #endif
+--- a/libgcc/config/ia64/crtbegin.S
++++ b/libgcc/config/ia64/crtbegin.S
+@@ -252,3 +252,7 @@ __do_jv_register_classes:
+ .weak __cxa_finalize
+ #endif
+ .weak _Jv_RegisterClasses
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+--- a/libgcc/config/ia64/crtend.S
++++ b/libgcc/config/ia64/crtend.S
+@@ -119,3 +119,6 @@ __do_global_ctors_aux:
+
+ br.ret.sptk.many rp
+ .endp __do_global_ctors_aux
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+--- a/libgcc/config/ia64/crti.S
++++ b/libgcc/config/ia64/crti.S
+@@ -49,5 +49,8 @@ _fini:
+ .save rp, r33
+ mov r33 = b0
+ .body
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+
+ # end of crti.S
+--- a/libgcc/config/ia64/crtn.S
++++ b/libgcc/config/ia64/crtn.S
+@@ -39,5 +39,8 @@
+ .restore sp
+ mov r12 = r35
+ br.ret.sptk.many b0
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+
+ # end of crtn.S
+--- a/libgcc/config/ia64/lib1funcs.S
++++ b/libgcc/config/ia64/lib1funcs.S
+@@ -793,3 +793,6 @@ __floattitf:
+ .endp __floattitf
+ #endif
+ #endif
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
diff --git a/4.8.1/gentoo/38_all_sh_pr24836_all-archs.patch b/4.8.1/gentoo/38_all_sh_pr24836_all-archs.patch
new file mode 100644
index 0000000..06fd90a
--- /dev/null
+++ b/4.8.1/gentoo/38_all_sh_pr24836_all-archs.patch
@@ -0,0 +1,27 @@
+gcc/configure doesn't handle all possible SH architectures
+
+http://gcc.gnu.org/PR24836
+
+
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -22753,7 +22753,7 @@ foo: .long 25
+ tls_first_minor=14
+ tls_as_opt="-m64 -Aesame --fatal-warnings"
+ ;;
+- sh-*-* | sh[34]-*-*)
++ sh-*-* | sh[34]*-*-*)
+ conftest_s='
+ .section ".tdata","awT",@progbits
+ foo: .long 25
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -2924,7 +2924,7 @@ foo: .long 25
+ tls_first_minor=14
+ tls_as_opt="-m64 -Aesame --fatal-warnings"
+ ;;
+- sh-*-* | sh[34]-*-*)
++ sh-*-* | sh[34]*-*-*)
+ conftest_s='
+ .section ".tdata","awT",@progbits
+ foo: .long 25
diff --git a/4.8.1/gentoo/42_all_superh_default-multilib.patch b/4.8.1/gentoo/42_all_superh_default-multilib.patch
new file mode 100644
index 0000000..8b638d9
--- /dev/null
+++ b/4.8.1/gentoo/42_all_superh_default-multilib.patch
@@ -0,0 +1,24 @@
+The gcc-3.x toolchains would contain all the targets by default. With gcc-4,
+you have to actually list out the multilibs you want or you will end up with
+just one when using targets like 'sh4-linux-gnu'.
+
+The resulting toolchain can't even build a kernel as the kernel needs to build
+with the nofpu flag to be sure that no fpu ops are generated.
+
+Here we restore the gcc-3.x behavior; the additional overhead of building all
+of these multilibs by default is negligible.
+
+https://bugs.gentoo.org/140205
+https://bugs.gentoo.org/320251
+
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -2455,7 +2455,7 @@ sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
+ if test "$sh_multilibs" = "default" ; then
+ case ${target} in
+ sh64-superh-linux* | \
+- sh[1234]*) sh_multilibs=${sh_cpu_target} ;;
++ sh[1234]*) sh_multilibs=$(echo $(sed -n '/^[[:space:]]*case ${sh_multilib} in/,/)/{s:case ${sh_multilib} in::;s: | *:,:g;s:[\\)]::g;p}' ${srcdir}/config.gcc) | sed 's: ::g') ;;
+ sh64* | sh5*) sh_multilibs=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu ;;
+ sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;;
+ sh*-*-linux*) sh_multilibs=m1,m3e,m4 ;;
diff --git a/4.8.1/gentoo/48_all_x86_pr53113_libitm-avx.patch b/4.8.1/gentoo/48_all_x86_pr53113_libitm-avx.patch
new file mode 100644
index 0000000..b176530
--- /dev/null
+++ b/4.8.1/gentoo/48_all_x86_pr53113_libitm-avx.patch
@@ -0,0 +1,28 @@
+libitm checks for AVX support in the assembler and adds -mavx to x86_avx.cc
+which defines the needed typedefs. User CFLAGS can override -mavx however,
+so also use the fallback typedef if __AVX__ isn't defined.
+
+https://bugs.gentoo.org/417271
+http://gcc.gnu.org/PR53113
+
+
+--- a/libitm/config/x86/x86_avx.cc
++++ b/libitm/config/x86/x86_avx.cc
+@@ -29,7 +29,7 @@
+
+ extern "C" {
+
+-#ifndef HAVE_AS_AVX
++#if !defined (HAVE_AS_AVX) || !defined(__AVX__)
+ // If we don't have an AVX capable assembler, we didn't set -mavx on the
+ // command-line either, which means that libitm.h defined neither this type
+ // nor the functions in this file. Define the type and unconditionally
+@@ -40,7 +40,7 @@ typedef float _ITM_TYPE_M256 __attribute__((vector_size(32), may_alias));
+ // Re-define the memcpy implementations so that we can frob the
+ // interface to deal with possibly missing AVX instruction set support.
+
+-#ifdef HAVE_AS_AVX
++#if defined(HAVE_AS_AVX) && defined(__AVX__)
+ #define RETURN(X) return X
+ #define STORE(X,Y) X = Y
+ #define OUTPUT(T) _ITM_TYPE_##T
diff --git a/4.8.1/gentoo/50_all_libiberty-asprintf.patch b/4.8.1/gentoo/50_all_libiberty-asprintf.patch
new file mode 100644
index 0000000..9ad4a92
--- /dev/null
+++ b/4.8.1/gentoo/50_all_libiberty-asprintf.patch
@@ -0,0 +1,18 @@
+2008-07-25 Magnus Granberg <zorry@ume.nu>
+
+ * include/libiberty.h (asprintf): Don't declare if defined as a macro
+
+--- a/include/libiberty.h
++++ b/include/libiberty.h
+@@ -609,8 +609,11 @@ extern int pwait (int, int *, int);
+ /* Like sprintf but provides a pointer to malloc'd storage, which must
+ be freed by the caller. */
+
++/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */
++#ifndef asprintf
+ extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
+ #endif
++#endif
+
+ #if !HAVE_DECL_VASPRINTF
+ /* Like vsprintf but provides a pointer to malloc'd storage, which
diff --git a/4.8.1/gentoo/51_all_libiberty-pic.patch b/4.8.1/gentoo/51_all_libiberty-pic.patch
new file mode 100644
index 0000000..b6160a7
--- /dev/null
+++ b/4.8.1/gentoo/51_all_libiberty-pic.patch
@@ -0,0 +1,10 @@
+--- a/libiberty/Makefile.in
++++ b/libiberty/Makefile.in
+@@ -246,6 +246,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
+ $(AR) $(AR_FLAGS) $(TARGETLIB) \
+ $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
+ $(RANLIB) $(TARGETLIB); \
++ cp $(TARGETLIB) ../ ; \
+ cd ..; \
+ else true; fi
+
diff --git a/4.8.1/gentoo/52_all_netbsd-Bsymbolic.patch b/4.8.1/gentoo/52_all_netbsd-Bsymbolic.patch
new file mode 100644
index 0000000..4db281e
--- /dev/null
+++ b/4.8.1/gentoo/52_all_netbsd-Bsymbolic.patch
@@ -0,0 +1,12 @@
+https://bugs.gentoo.org/122698
+
+--- a/gcc/config/netbsd-elf.h
++++ b/gcc/config/netbsd-elf.h
+@@ -70,6 +70,7 @@ along with GCC; see the file COPYING3. If not see
+ #define NETBSD_LINK_SPEC_ELF \
+ "%{assert*} %{R*} %{rpath*} \
+ %{shared:-shared} \
++ %{symbolic:-Bsymbolic} \
+ %{!shared: \
+ -dc -dp \
+ %{!nostdlib: \
diff --git a/4.8.1/gentoo/67_all_gcc-poison-system-directories.patch b/4.8.1/gentoo/67_all_gcc-poison-system-directories.patch
new file mode 100644
index 0000000..72b7e0d
--- /dev/null
+++ b/4.8.1/gentoo/67_all_gcc-poison-system-directories.patch
@@ -0,0 +1,201 @@
+grabbed from openembedded
+
+Upstream-Status: Inappropriate [distribution: codesourcery]
+
+ gcc/
+ 2008-07-02 Joseph Myers <joseph@codesourcery.com>
+ * c-incpath.c: Include toplev.h.
+ (merge_include_chains): Use warning instead of cpp_error for
+ system directory poisoning diagnostic.
+ * Makefile.in (c-incpath.o): Depend on toplev.h.
+ * gcc.c (LINK_COMMAND_SPEC): Pass
+ --error-poison-system-directories if
+ -Werror=poison-system-directories.
+
+ 2007-06-13 Joseph Myers <joseph@codesourcery.com>
+ * common.opt (--Wno-poison-system-directories): New.
+ * doc/invoke.texi (-Wno-poison-system-directories): Document.
+ * c-incpath.c: Include flags.h.
+ (merge_include_chains): Check flag_poison_system_directories.
+ * gcc.c (LINK_COMMAND_SPEC): Pass --no-poison-system-directories
+ to linker if -Wno-poison-system-directories.
+ * Makefile.in (c-incpath.o): Depend on $(FLAGS_H).
+
+ 2007-03-20 Daniel Jacobowitz <dan@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+ * configure.ac (--enable-poison-system-directories): New option.
+ * configure, config.in: Regenerate.
+ * c-incpath.c (merge_include_chains): If
+ ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of
+ /usr/include, /usr/local/include or /usr/X11R6/include.
+
+
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -2018,7 +2018,7 @@ attribs.o : attribs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
+
+ incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
+ intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
+- $(MACHMODE_H)
++ $(MACHMODE_H) $(FLAGS_H) toplev.h
+
+ CFLAGS-prefix.o += -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s)
+ prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h prefix.h \
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -595,6 +595,10 @@ Wpedantic
+ Common Var(pedantic) Warning
+ Issue warnings needed for strict compliance to the standard
+
++Wpoison-system-directories
++Common Var(flag_poison_system_directories) Init(1) Warning
++Warn for -I and -L options using system directories if cross compiling
++
+ Wshadow
+ Common Var(warn_shadow) Warning
+ Warn when one local variable shadows another
+--- a/gcc/config.in
++++ b/gcc/config.in
+@@ -138,6 +138,12 @@
+ #endif
+
+
++/* Define to warn for use of native system header directories */
++#ifndef USED_FOR_TARGET
++#undef ENABLE_POISON_SYSTEM_DIRECTORIES
++#endif
++
++
+ /* Define if you want all operations on RTL (the basic data structure of the
+ optimizer and back end) to be checked for dynamic type safety at runtime.
+ This is quite expensive. */
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -917,6 +917,7 @@ with_gc
+ with_system_zlib
+ enable_maintainer_mode
+ enable_version_specific_runtime_libs
++enable_poison_system_directories
+ enable_plugin
+ enable_libquadmath_support
+ with_linker_hash_style
+@@ -1630,6 +1631,8 @@ Optional Features:
+ --enable-version-specific-runtime-libs
+ specify that runtime libraries should be installed
+ in a compiler-specific directory
++ --enable-poison-system-directories
++ warn for use of native system header directories
+ --enable-plugin enable plugin support
+ --disable-libquadmath-support
+ disable libquadmath support for Fortran
+@@ -27103,6 +27106,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
+ fi
+
+
++# Check whether --enable-poison-system-directories was given.
++if test "${enable_poison_system_directories+set}" = set; then :
++ enableval=$enable_poison_system_directories;
++else
++ enable_poison_system_directories=no
++fi
++
++if test "x${enable_poison_system_directories}" = "xyes"; then
++
++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
++
++fi
++
+ # Substitute configuration variables
+
+
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -5063,6 +5063,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
+ [specify that runtime libraries should be
+ installed in a compiler-specific directory])])
+
++AC_ARG_ENABLE([poison-system-directories],
++ AS_HELP_STRING([--enable-poison-system-directories],
++ [warn for use of native system header directories]),,
++ [enable_poison_system_directories=no])
++if test "x${enable_poison_system_directories}" = "xyes"; then
++ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
++ [1],
++ [Define to warn for use of native system header directories])
++fi
++
+ # Substitute configuration variables
+ AC_SUBST(subdirs)
+ AC_SUBST(srcdir)
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -258,6 +258,7 @@ Objective-C and Objective-C++ Dialects}.
+ -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
+ -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
+ -Wpointer-arith -Wno-pointer-to-int-cast @gol
++-Wno-poison-system-directories @gol
+ -Wredundant-decls -Wno-return-local-addr @gol
+ -Wreturn-type -Wsequence-point -Wshadow @gol
+ -Wsign-compare -Wsign-conversion -Wsizeof-pointer-memaccess @gol
+@@ -4023,6 +4024,14 @@ should check to see whether the two values have ranges that overlap; and
+ this is done with the relational operators, so equality comparisons are
+ probably mistaken.
+
++@item -Wno-poison-system-directories
++@opindex Wno-poison-system-directories
++Do not warn for @option{-I} or @option{-L} options using system
++directories such as @file{/usr/include} when cross compiling. This
++option is intended for use in chroot environments when such
++directories contain the correct headers and libraries for the target
++system rather than the host.
++
+ @item -Wtraditional @r{(C and Objective-C only)}
+ @opindex Wtraditional
+ @opindex Wno-traditional
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -740,6 +740,8 @@ proper position among the other output files. */
+ "%{fuse-ld=*:-fuse-ld=%*}\
+ %X %{o*} %{e*} %{N} %{n} %{r}\
+ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
++ %{Wno-poison-system-directories:--no-poison-system-directories}\
++ %{Werror=poison-system-directories:--error-poison-system-directories}\
+ %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
+ %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
+ %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
+--- a/gcc/incpath.c
++++ b/gcc/incpath.c
+@@ -28,6 +28,7 @@
+ #include "intl.h"
+ #include "incpath.h"
+ #include "cppdefault.h"
++#include "diagnostic.h"
+
+ /* Microsoft Windows does not natively support inodes.
+ VMS has non-numeric inodes. */
+@@ -382,6 +382,25 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
+ }
+ fprintf (stderr, _("End of search list.\n"));
+ }
++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
++ if (flag_poison_system_directories)
++ {
++ struct cpp_dir *p;
++
++ for (p = heads[QUOTE]; p; p = p->next)
++ {
++ if ((!strncmp (p->name, "/usr/include", 12))
++ || (!strncmp (p->name, "/usr/local/include", 18))
++ || (!strncmp (p->name, "/usr/X11R6/include", 18))
++ || (!strncmp (p->name, "/sw/include", 11))
++ || (!strncmp (p->name, "/opt/include", 12)))
++ warning (OPT_Wpoison_system_directories,
++ "include location \"%s\" is unsafe for "
++ "cross-compilation",
++ p->name);
++ }
++ }
++#endif
+ }
+
+ /* Use given -I paths for #include "..." but not #include <...>, and
diff --git a/4.8.1/gentoo/74_all_gcc48_cloog-dl.patch b/4.8.1/gentoo/74_all_gcc48_cloog-dl.patch
new file mode 100644
index 0000000..0fb55b0
--- /dev/null
+++ b/4.8.1/gentoo/74_all_gcc48_cloog-dl.patch
@@ -0,0 +1,537 @@
+dlopen cloog-isl library rather than link to it directly. This prevents
+cloog upgrades that change the soname from breaking the compiler.
+
+http://pkgs.fedoraproject.org/cgit/gcc.git/tree/gcc48-cloog-dl.patch
+
+
+In FreeBSD dlopen is part of libc so we can't just hardcode -ldl.
+
+2013-03-30 Ryan Hill <dirtyepic@gentoo.org>
+
+ * configure.ac (DL_LIB): Check how to dlopen.
+ * configure: Regenerate.
+ * Makefile.in (BACKENDLIBS): Use DL_LIB.
+
+
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -1020,7 +1020,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY)
+ # and the system's installed libraries.
+ LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \
+ $(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)
+-BACKENDLIBS = $(CLOOGLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
++BACKENDLIBS = $(if $(CLOOGLIBS),@DL_LIB@) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
+ $(ZLIB)
+ # Any system libraries needed just for GNAT.
+ SYSLIBS = @GNAT_LIBEXC@
+@@ -3443,6 +3443,15 @@ $(common_out_object_file): $(common_out_file) $(CONFIG_H) $(SYSTEM_H) \
+ $(DIAGNOSTIC_CORE_H) $(FLAGS_H) $(OPTS_H) $(TM_H) $(TM_P_H) $(MACHMODE_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
+ $< $(OUTPUT_OPTION)
++
++graphite%.o : \
++ ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS))
++graphite.o : \
++ ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS))
++graphite%.o : \
++ ALL_CXXFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CXXFLAGS))
++graphite.o : \
++ ALL_CXXFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CXXFLAGS))
+ #
+ # Generate header and source files from the machine description,
+ # and compile them.
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -602,6 +602,7 @@ ac_subst_vars='LTLIBOBJS
+ LIBOBJS
+ enable_plugin
+ pluginlibs
++DL_LIB
+ CLOOGINC
+ CLOOGLIBS
+ ISLINC
+@@ -27263,6 +27264,7 @@ $as_echo "unable to check" >&6; }
+ fi
+
+ # Check -ldl
++ DL_LIB=
+ saved_LIBS="$LIBS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
+ $as_echo_n "checking for library containing dlopen... " >&6; }
+@@ -27322,9 +27324,11 @@ fi
+
+ if test x"$ac_cv_search_dlopen" = x"-ldl"; then
+ pluginlibs="$pluginlibs -ldl"
++ DL_LIB=$ac_cv_search_dlopen
+ fi
+ LIBS="$saved_LIBS"
+
++
+ # Check that we can build shared objects with -fPIC -shared
+ saved_LDFLAGS="$LDFLAGS"
+ saved_CFLAGS="$CFLAGS"
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -5212,12 +5212,15 @@ if test x"$enable_plugin" = x"yes"; then
+ fi
+
+ # Check -ldl
++ DL_LIB=
+ saved_LIBS="$LIBS"
+ AC_SEARCH_LIBS([dlopen], [dl])
+ if test x"$ac_cv_search_dlopen" = x"-ldl"; then
+ pluginlibs="$pluginlibs -ldl"
++ DL_LIB=$ac_cv_search_dlopen
+ fi
+ LIBS="$saved_LIBS"
++ AC_SUBST(DL_LIB)
+
+ # Check that we can build shared objects with -fPIC -shared
+ saved_LDFLAGS="$LDFLAGS"
+--- a/gcc/graphite-clast-to-gimple.c
++++ b/gcc/graphite-clast-to-gimple.c
+@@ -910,7 +910,7 @@ compute_bounds_for_loop (struct clast_for *loop, mpz_t low, mpz_t up)
+ from STMT_FOR. */
+
+ static tree
+-type_for_clast_for (struct clast_for *stmt_for, ivs_params_p ip)
++type_for_clast_for (struct clast_for *stmt_fora, ivs_params_p ip)
+ {
+ mpz_t bound_one, bound_two;
+ tree lb_type, ub_type;
+@@ -918,8 +918,8 @@ type_for_clast_for (struct clast_for *stmt_for, ivs_params_p ip)
+ mpz_init (bound_one);
+ mpz_init (bound_two);
+
+- lb_type = type_for_clast_expr (stmt_for->LB, ip, bound_one, bound_two);
+- ub_type = type_for_clast_expr (stmt_for->UB, ip, bound_one, bound_two);
++ lb_type = type_for_clast_expr (stmt_fora->LB, ip, bound_one, bound_two);
++ ub_type = type_for_clast_expr (stmt_fora->UB, ip, bound_one, bound_two);
+
+ mpz_clear (bound_one);
+ mpz_clear (bound_two);
+--- a/gcc/graphite-poly.h
++++ b/gcc/graphite-poly.h
+@@ -22,6 +22,369 @@ along with GCC; see the file COPYING3. If not see
+ #ifndef GCC_GRAPHITE_POLY_H
+ #define GCC_GRAPHITE_POLY_H
+
++#include <isl/aff.h>
++#include <isl/schedule.h>
++#include <isl/ilp.h>
++#include <isl/flow.h>
++#include <isl/options.h>
++#include <cloog/isl/cloog.h>
++#include <dlfcn.h>
++#define DYNSYMS \
++ DYNSYM (clast_pprint); \
++ DYNSYM (cloog_clast_create_from_input); \
++ DYNSYM (cloog_clast_free); \
++ DYNSYM (cloog_domain_from_isl_set); \
++ DYNSYM (cloog_input_alloc); \
++ DYNSYM (cloog_isl_state_malloc); \
++ DYNSYM (cloog_options_free); \
++ DYNSYM (cloog_options_malloc); \
++ DYNSYM (cloog_scattering_from_isl_map); \
++ DYNSYM (cloog_state_free); \
++ DYNSYM (cloog_union_domain_add_domain); \
++ DYNSYM (cloog_union_domain_alloc); \
++ DYNSYM (cloog_union_domain_set_name); \
++ DYNSYM (isl_aff_add_coefficient_si); \
++ DYNSYM (isl_aff_add_constant); \
++ DYNSYM (isl_aff_free); \
++ DYNSYM (isl_aff_get_coefficient); \
++ DYNSYM (isl_aff_get_space); \
++ DYNSYM (isl_aff_mod); \
++ DYNSYM (isl_aff_set_coefficient_si); \
++ DYNSYM (isl_aff_set_constant_si); \
++ DYNSYM (isl_aff_zero_on_domain); \
++ DYNSYM (isl_band_free); \
++ DYNSYM (isl_band_get_children); \
++ DYNSYM (isl_band_get_partial_schedule); \
++ DYNSYM (isl_band_has_children); \
++ DYNSYM (isl_band_list_free); \
++ DYNSYM (isl_band_list_get_band); \
++ DYNSYM (isl_band_list_get_ctx); \
++ DYNSYM (isl_band_list_n_band); \
++ DYNSYM (isl_band_member_is_zero_distance); \
++ DYNSYM (isl_band_n_member); \
++ DYNSYM (isl_basic_map_add_constraint); \
++ DYNSYM (isl_basic_map_project_out); \
++ DYNSYM (isl_basic_map_universe); \
++ DYNSYM (isl_constraint_set_coefficient); \
++ DYNSYM (isl_constraint_set_coefficient_si); \
++ DYNSYM (isl_constraint_set_constant); \
++ DYNSYM (isl_constraint_set_constant_si); \
++ DYNSYM (isl_ctx_alloc); \
++ DYNSYM (isl_ctx_free); \
++ DYNSYM (isl_equality_alloc); \
++ DYNSYM (isl_id_alloc); \
++ DYNSYM (isl_id_copy); \
++ DYNSYM (isl_id_free); \
++ DYNSYM (isl_inequality_alloc); \
++ DYNSYM (isl_local_space_copy); \
++ DYNSYM (isl_local_space_free); \
++ DYNSYM (isl_local_space_from_space); \
++ DYNSYM (isl_local_space_range); \
++ DYNSYM (isl_map_add_constraint); \
++ DYNSYM (isl_map_add_dims); \
++ DYNSYM (isl_map_align_params); \
++ DYNSYM (isl_map_apply_range); \
++ DYNSYM (isl_map_copy); \
++ DYNSYM (isl_map_dim); \
++ DYNSYM (isl_map_dump); \
++ DYNSYM (isl_map_equate); \
++ DYNSYM (isl_map_fix_si); \
++ DYNSYM (isl_map_flat_product); \
++ DYNSYM (isl_map_flat_range_product); \
++ DYNSYM (isl_map_free); \
++ DYNSYM (isl_map_from_basic_map); \
++ DYNSYM (isl_map_from_pw_aff); \
++ DYNSYM (isl_map_from_union_map); \
++ DYNSYM (isl_map_get_ctx); \
++ DYNSYM (isl_map_get_space); \
++ DYNSYM (isl_map_get_tuple_id); \
++ DYNSYM (isl_map_insert_dims); \
++ DYNSYM (isl_map_intersect); \
++ DYNSYM (isl_map_intersect_domain); \
++ DYNSYM (isl_map_intersect_range); \
++ DYNSYM (isl_map_is_empty); \
++ DYNSYM (isl_map_lex_ge); \
++ DYNSYM (isl_map_lex_le); \
++ DYNSYM (isl_map_n_out); \
++ DYNSYM (isl_map_range); \
++ DYNSYM (isl_map_set_tuple_id); \
++ DYNSYM (isl_map_universe); \
++ DYNSYM (isl_options_set_on_error); \
++ DYNSYM (isl_options_set_schedule_fuse); \
++ DYNSYM (isl_options_set_schedule_max_constant_term); \
++ DYNSYM (isl_options_set_schedule_maximize_band_depth); \
++ DYNSYM (isl_printer_free); \
++ DYNSYM (isl_printer_print_aff); \
++ DYNSYM (isl_printer_print_constraint); \
++ DYNSYM (isl_printer_print_map); \
++ DYNSYM (isl_printer_print_set); \
++ DYNSYM (isl_printer_to_file); \
++ DYNSYM (isl_pw_aff_add); \
++ DYNSYM (isl_pw_aff_alloc); \
++ DYNSYM (isl_pw_aff_copy); \
++ DYNSYM (isl_pw_aff_eq_set); \
++ DYNSYM (isl_pw_aff_free); \
++ DYNSYM (isl_pw_aff_from_aff); \
++ DYNSYM (isl_pw_aff_ge_set); \
++ DYNSYM (isl_pw_aff_gt_set); \
++ DYNSYM (isl_pw_aff_is_cst); \
++ DYNSYM (isl_pw_aff_le_set); \
++ DYNSYM (isl_pw_aff_lt_set); \
++ DYNSYM (isl_pw_aff_mod); \
++ DYNSYM (isl_pw_aff_mul); \
++ DYNSYM (isl_pw_aff_ne_set); \
++ DYNSYM (isl_pw_aff_nonneg_set); \
++ DYNSYM (isl_pw_aff_set_tuple_id); \
++ DYNSYM (isl_pw_aff_sub); \
++ DYNSYM (isl_pw_aff_zero_set); \
++ DYNSYM (isl_schedule_free); \
++ DYNSYM (isl_schedule_get_band_forest); \
++ DYNSYM (isl_set_add_constraint); \
++ DYNSYM (isl_set_add_dims); \
++ DYNSYM (isl_set_apply); \
++ DYNSYM (isl_set_coalesce); \
++ DYNSYM (isl_set_copy); \
++ DYNSYM (isl_set_dim); \
++ DYNSYM (isl_set_fix_si); \
++ DYNSYM (isl_set_free); \
++ DYNSYM (isl_set_from_cloog_domain); \
++ DYNSYM (isl_set_get_space); \
++ DYNSYM (isl_set_get_tuple_id); \
++ DYNSYM (isl_set_intersect); \
++ DYNSYM (isl_set_is_empty); \
++ DYNSYM (isl_set_max); \
++ DYNSYM (isl_set_min); \
++ DYNSYM (isl_set_nat_universe); \
++ DYNSYM (isl_set_project_out); \
++ DYNSYM (isl_set_set_tuple_id); \
++ DYNSYM (isl_set_universe); \
++ DYNSYM (isl_space_add_dims); \
++ DYNSYM (isl_space_alloc); \
++ DYNSYM (isl_space_copy); \
++ DYNSYM (isl_space_dim); \
++ DYNSYM (isl_space_domain); \
++ DYNSYM (isl_space_find_dim_by_id); \
++ DYNSYM (isl_space_free); \
++ DYNSYM (isl_space_from_domain); \
++ DYNSYM (isl_space_get_tuple_id); \
++ DYNSYM (isl_space_params_alloc); \
++ DYNSYM (isl_space_range); \
++ DYNSYM (isl_space_set_alloc); \
++ DYNSYM (isl_space_set_dim_id); \
++ DYNSYM (isl_space_set_tuple_id); \
++ DYNSYM (isl_union_map_add_map); \
++ DYNSYM (isl_union_map_align_params); \
++ DYNSYM (isl_union_map_apply_domain); \
++ DYNSYM (isl_union_map_apply_range); \
++ DYNSYM (isl_union_map_compute_flow); \
++ DYNSYM (isl_union_map_copy); \
++ DYNSYM (isl_union_map_empty); \
++ DYNSYM (isl_union_map_flat_range_product); \
++ DYNSYM (isl_union_map_foreach_map); \
++ DYNSYM (isl_union_map_free); \
++ DYNSYM (isl_union_map_from_map); \
++ DYNSYM (isl_union_map_get_ctx); \
++ DYNSYM (isl_union_map_get_space); \
++ DYNSYM (isl_union_map_gist_domain); \
++ DYNSYM (isl_union_map_gist_range); \
++ DYNSYM (isl_union_map_intersect_domain); \
++ DYNSYM (isl_union_map_is_empty); \
++ DYNSYM (isl_union_map_subtract); \
++ DYNSYM (isl_union_map_union); \
++ DYNSYM (isl_union_set_add_set); \
++ DYNSYM (isl_union_set_compute_schedule); \
++ DYNSYM (isl_union_set_copy); \
++ DYNSYM (isl_union_set_empty); \
++ DYNSYM (isl_union_set_from_set); \
++ DYNSYM (stmt_ass); \
++ DYNSYM (stmt_block); \
++ DYNSYM (stmt_for); \
++ DYNSYM (stmt_guard); \
++ DYNSYM (stmt_root); \
++ DYNSYM (stmt_user);
++extern struct cloog_pointers_s__
++{
++ bool inited;
++ void *h;
++#define DYNSYM(x) __typeof (x) *p_##x
++ DYNSYMS
++#undef DYNSYM
++} cloog_pointers__;
++
++#define cloog_block_alloc (*cloog_pointers__.p_cloog_block_alloc)
++#define clast_pprint (*cloog_pointers__.p_clast_pprint)
++#define cloog_clast_create_from_input (*cloog_pointers__.p_cloog_clast_create_from_input)
++#define cloog_clast_free (*cloog_pointers__.p_cloog_clast_free)
++#define cloog_domain_from_isl_set (*cloog_pointers__.p_cloog_domain_from_isl_set)
++#define cloog_input_alloc (*cloog_pointers__.p_cloog_input_alloc)
++#define cloog_isl_state_malloc (*cloog_pointers__.p_cloog_isl_state_malloc)
++#define cloog_options_free (*cloog_pointers__.p_cloog_options_free)
++#define cloog_options_malloc (*cloog_pointers__.p_cloog_options_malloc)
++#define cloog_scattering_from_isl_map (*cloog_pointers__.p_cloog_scattering_from_isl_map)
++#define cloog_state_free (*cloog_pointers__.p_cloog_state_free)
++#define cloog_union_domain_add_domain (*cloog_pointers__.p_cloog_union_domain_add_domain)
++#define cloog_union_domain_alloc (*cloog_pointers__.p_cloog_union_domain_alloc)
++#define cloog_union_domain_set_name (*cloog_pointers__.p_cloog_union_domain_set_name)
++#define isl_aff_add_coefficient_si (*cloog_pointers__.p_isl_aff_add_coefficient_si)
++#define isl_aff_add_constant (*cloog_pointers__.p_isl_aff_add_constant)
++#define isl_aff_free (*cloog_pointers__.p_isl_aff_free)
++#define isl_aff_get_coefficient (*cloog_pointers__.p_isl_aff_get_coefficient)
++#define isl_aff_get_space (*cloog_pointers__.p_isl_aff_get_space)
++#define isl_aff_mod (*cloog_pointers__.p_isl_aff_mod)
++#define isl_aff_set_coefficient_si (*cloog_pointers__.p_isl_aff_set_coefficient_si)
++#define isl_aff_set_constant_si (*cloog_pointers__.p_isl_aff_set_constant_si)
++#define isl_aff_zero_on_domain (*cloog_pointers__.p_isl_aff_zero_on_domain)
++#define isl_band_free (*cloog_pointers__.p_isl_band_free)
++#define isl_band_get_children (*cloog_pointers__.p_isl_band_get_children)
++#define isl_band_get_partial_schedule (*cloog_pointers__.p_isl_band_get_partial_schedule)
++#define isl_band_has_children (*cloog_pointers__.p_isl_band_has_children)
++#define isl_band_list_free (*cloog_pointers__.p_isl_band_list_free)
++#define isl_band_list_get_band (*cloog_pointers__.p_isl_band_list_get_band)
++#define isl_band_list_get_ctx (*cloog_pointers__.p_isl_band_list_get_ctx)
++#define isl_band_list_n_band (*cloog_pointers__.p_isl_band_list_n_band)
++#define isl_band_member_is_zero_distance (*cloog_pointers__.p_isl_band_member_is_zero_distance)
++#define isl_band_n_member (*cloog_pointers__.p_isl_band_n_member)
++#define isl_basic_map_add_constraint (*cloog_pointers__.p_isl_basic_map_add_constraint)
++#define isl_basic_map_project_out (*cloog_pointers__.p_isl_basic_map_project_out)
++#define isl_basic_map_universe (*cloog_pointers__.p_isl_basic_map_universe)
++#define isl_constraint_set_coefficient (*cloog_pointers__.p_isl_constraint_set_coefficient)
++#define isl_constraint_set_coefficient_si (*cloog_pointers__.p_isl_constraint_set_coefficient_si)
++#define isl_constraint_set_constant (*cloog_pointers__.p_isl_constraint_set_constant)
++#define isl_constraint_set_constant_si (*cloog_pointers__.p_isl_constraint_set_constant_si)
++#define isl_ctx_alloc (*cloog_pointers__.p_isl_ctx_alloc)
++#define isl_ctx_free (*cloog_pointers__.p_isl_ctx_free)
++#define isl_equality_alloc (*cloog_pointers__.p_isl_equality_alloc)
++#define isl_id_alloc (*cloog_pointers__.p_isl_id_alloc)
++#define isl_id_copy (*cloog_pointers__.p_isl_id_copy)
++#define isl_id_free (*cloog_pointers__.p_isl_id_free)
++#define isl_inequality_alloc (*cloog_pointers__.p_isl_inequality_alloc)
++#define isl_local_space_copy (*cloog_pointers__.p_isl_local_space_copy)
++#define isl_local_space_free (*cloog_pointers__.p_isl_local_space_free)
++#define isl_local_space_from_space (*cloog_pointers__.p_isl_local_space_from_space)
++#define isl_local_space_range (*cloog_pointers__.p_isl_local_space_range)
++#define isl_map_add_constraint (*cloog_pointers__.p_isl_map_add_constraint)
++#define isl_map_add_dims (*cloog_pointers__.p_isl_map_add_dims)
++#define isl_map_align_params (*cloog_pointers__.p_isl_map_align_params)
++#define isl_map_apply_range (*cloog_pointers__.p_isl_map_apply_range)
++#define isl_map_copy (*cloog_pointers__.p_isl_map_copy)
++#define isl_map_dim (*cloog_pointers__.p_isl_map_dim)
++#define isl_map_dump (*cloog_pointers__.p_isl_map_dump)
++#define isl_map_equate (*cloog_pointers__.p_isl_map_equate)
++#define isl_map_fix_si (*cloog_pointers__.p_isl_map_fix_si)
++#define isl_map_flat_product (*cloog_pointers__.p_isl_map_flat_product)
++#define isl_map_flat_range_product (*cloog_pointers__.p_isl_map_flat_range_product)
++#define isl_map_free (*cloog_pointers__.p_isl_map_free)
++#define isl_map_from_basic_map (*cloog_pointers__.p_isl_map_from_basic_map)
++#define isl_map_from_pw_aff (*cloog_pointers__.p_isl_map_from_pw_aff)
++#define isl_map_from_union_map (*cloog_pointers__.p_isl_map_from_union_map)
++#define isl_map_get_ctx (*cloog_pointers__.p_isl_map_get_ctx)
++#define isl_map_get_space (*cloog_pointers__.p_isl_map_get_space)
++#define isl_map_get_tuple_id (*cloog_pointers__.p_isl_map_get_tuple_id)
++#define isl_map_insert_dims (*cloog_pointers__.p_isl_map_insert_dims)
++#define isl_map_intersect (*cloog_pointers__.p_isl_map_intersect)
++#define isl_map_intersect_domain (*cloog_pointers__.p_isl_map_intersect_domain)
++#define isl_map_intersect_range (*cloog_pointers__.p_isl_map_intersect_range)
++#define isl_map_is_empty (*cloog_pointers__.p_isl_map_is_empty)
++#define isl_map_lex_ge (*cloog_pointers__.p_isl_map_lex_ge)
++#define isl_map_lex_le (*cloog_pointers__.p_isl_map_lex_le)
++#define isl_map_n_out (*cloog_pointers__.p_isl_map_n_out)
++#define isl_map_range (*cloog_pointers__.p_isl_map_range)
++#define isl_map_set_tuple_id (*cloog_pointers__.p_isl_map_set_tuple_id)
++#define isl_map_universe (*cloog_pointers__.p_isl_map_universe)
++#define isl_options_set_on_error (*cloog_pointers__.p_isl_options_set_on_error)
++#define isl_options_set_schedule_fuse (*cloog_pointers__.p_isl_options_set_schedule_fuse)
++#define isl_options_set_schedule_max_constant_term (*cloog_pointers__.p_isl_options_set_schedule_max_constant_term)
++#define isl_options_set_schedule_maximize_band_depth (*cloog_pointers__.p_isl_options_set_schedule_maximize_band_depth)
++#define isl_printer_free (*cloog_pointers__.p_isl_printer_free)
++#define isl_printer_print_aff (*cloog_pointers__.p_isl_printer_print_aff)
++#define isl_printer_print_constraint (*cloog_pointers__.p_isl_printer_print_constraint)
++#define isl_printer_print_map (*cloog_pointers__.p_isl_printer_print_map)
++#define isl_printer_print_set (*cloog_pointers__.p_isl_printer_print_set)
++#define isl_printer_to_file (*cloog_pointers__.p_isl_printer_to_file)
++#define isl_pw_aff_add (*cloog_pointers__.p_isl_pw_aff_add)
++#define isl_pw_aff_alloc (*cloog_pointers__.p_isl_pw_aff_alloc)
++#define isl_pw_aff_copy (*cloog_pointers__.p_isl_pw_aff_copy)
++#define isl_pw_aff_eq_set (*cloog_pointers__.p_isl_pw_aff_eq_set)
++#define isl_pw_aff_free (*cloog_pointers__.p_isl_pw_aff_free)
++#define isl_pw_aff_from_aff (*cloog_pointers__.p_isl_pw_aff_from_aff)
++#define isl_pw_aff_ge_set (*cloog_pointers__.p_isl_pw_aff_ge_set)
++#define isl_pw_aff_gt_set (*cloog_pointers__.p_isl_pw_aff_gt_set)
++#define isl_pw_aff_is_cst (*cloog_pointers__.p_isl_pw_aff_is_cst)
++#define isl_pw_aff_le_set (*cloog_pointers__.p_isl_pw_aff_le_set)
++#define isl_pw_aff_lt_set (*cloog_pointers__.p_isl_pw_aff_lt_set)
++#define isl_pw_aff_mod (*cloog_pointers__.p_isl_pw_aff_mod)
++#define isl_pw_aff_mul (*cloog_pointers__.p_isl_pw_aff_mul)
++#define isl_pw_aff_ne_set (*cloog_pointers__.p_isl_pw_aff_ne_set)
++#define isl_pw_aff_nonneg_set (*cloog_pointers__.p_isl_pw_aff_nonneg_set)
++#define isl_pw_aff_set_tuple_id (*cloog_pointers__.p_isl_pw_aff_set_tuple_id)
++#define isl_pw_aff_sub (*cloog_pointers__.p_isl_pw_aff_sub)
++#define isl_pw_aff_zero_set (*cloog_pointers__.p_isl_pw_aff_zero_set)
++#define isl_schedule_free (*cloog_pointers__.p_isl_schedule_free)
++#define isl_schedule_get_band_forest (*cloog_pointers__.p_isl_schedule_get_band_forest)
++#define isl_set_add_constraint (*cloog_pointers__.p_isl_set_add_constraint)
++#define isl_set_add_dims (*cloog_pointers__.p_isl_set_add_dims)
++#define isl_set_apply (*cloog_pointers__.p_isl_set_apply)
++#define isl_set_coalesce (*cloog_pointers__.p_isl_set_coalesce)
++#define isl_set_copy (*cloog_pointers__.p_isl_set_copy)
++#define isl_set_dim (*cloog_pointers__.p_isl_set_dim)
++#define isl_set_fix_si (*cloog_pointers__.p_isl_set_fix_si)
++#define isl_set_free (*cloog_pointers__.p_isl_set_free)
++#define isl_set_from_cloog_domain (*cloog_pointers__.p_isl_set_from_cloog_domain)
++#define isl_set_get_space (*cloog_pointers__.p_isl_set_get_space)
++#define isl_set_get_tuple_id (*cloog_pointers__.p_isl_set_get_tuple_id)
++#define isl_set_intersect (*cloog_pointers__.p_isl_set_intersect)
++#define isl_set_is_empty (*cloog_pointers__.p_isl_set_is_empty)
++#define isl_set_max (*cloog_pointers__.p_isl_set_max)
++#define isl_set_min (*cloog_pointers__.p_isl_set_min)
++#define isl_set_nat_universe (*cloog_pointers__.p_isl_set_nat_universe)
++#define isl_set_project_out (*cloog_pointers__.p_isl_set_project_out)
++#define isl_set_set_tuple_id (*cloog_pointers__.p_isl_set_set_tuple_id)
++#define isl_set_universe (*cloog_pointers__.p_isl_set_universe)
++#define isl_space_add_dims (*cloog_pointers__.p_isl_space_add_dims)
++#define isl_space_alloc (*cloog_pointers__.p_isl_space_alloc)
++#define isl_space_copy (*cloog_pointers__.p_isl_space_copy)
++#define isl_space_dim (*cloog_pointers__.p_isl_space_dim)
++#define isl_space_domain (*cloog_pointers__.p_isl_space_domain)
++#define isl_space_find_dim_by_id (*cloog_pointers__.p_isl_space_find_dim_by_id)
++#define isl_space_free (*cloog_pointers__.p_isl_space_free)
++#define isl_space_from_domain (*cloog_pointers__.p_isl_space_from_domain)
++#define isl_space_get_tuple_id (*cloog_pointers__.p_isl_space_get_tuple_id)
++#define isl_space_params_alloc (*cloog_pointers__.p_isl_space_params_alloc)
++#define isl_space_range (*cloog_pointers__.p_isl_space_range)
++#define isl_space_set_alloc (*cloog_pointers__.p_isl_space_set_alloc)
++#define isl_space_set_dim_id (*cloog_pointers__.p_isl_space_set_dim_id)
++#define isl_space_set_tuple_id (*cloog_pointers__.p_isl_space_set_tuple_id)
++#define isl_union_map_add_map (*cloog_pointers__.p_isl_union_map_add_map)
++#define isl_union_map_align_params (*cloog_pointers__.p_isl_union_map_align_params)
++#define isl_union_map_apply_domain (*cloog_pointers__.p_isl_union_map_apply_domain)
++#define isl_union_map_apply_range (*cloog_pointers__.p_isl_union_map_apply_range)
++#define isl_union_map_compute_flow (*cloog_pointers__.p_isl_union_map_compute_flow)
++#define isl_union_map_copy (*cloog_pointers__.p_isl_union_map_copy)
++#define isl_union_map_empty (*cloog_pointers__.p_isl_union_map_empty)
++#define isl_union_map_flat_range_product (*cloog_pointers__.p_isl_union_map_flat_range_product)
++#define isl_union_map_foreach_map (*cloog_pointers__.p_isl_union_map_foreach_map)
++#define isl_union_map_free (*cloog_pointers__.p_isl_union_map_free)
++#define isl_union_map_from_map (*cloog_pointers__.p_isl_union_map_from_map)
++#define isl_union_map_get_ctx (*cloog_pointers__.p_isl_union_map_get_ctx)
++#define isl_union_map_get_space (*cloog_pointers__.p_isl_union_map_get_space)
++#define isl_union_map_gist_domain (*cloog_pointers__.p_isl_union_map_gist_domain)
++#define isl_union_map_gist_range (*cloog_pointers__.p_isl_union_map_gist_range)
++#define isl_union_map_intersect_domain (*cloog_pointers__.p_isl_union_map_intersect_domain)
++#define isl_union_map_is_empty (*cloog_pointers__.p_isl_union_map_is_empty)
++#define isl_union_map_subtract (*cloog_pointers__.p_isl_union_map_subtract)
++#define isl_union_map_union (*cloog_pointers__.p_isl_union_map_union)
++#define isl_union_set_add_set (*cloog_pointers__.p_isl_union_set_add_set)
++#define isl_union_set_compute_schedule (*cloog_pointers__.p_isl_union_set_compute_schedule)
++#define isl_union_set_copy (*cloog_pointers__.p_isl_union_set_copy)
++#define isl_union_set_empty (*cloog_pointers__.p_isl_union_set_empty)
++#define isl_union_set_from_set (*cloog_pointers__.p_isl_union_set_from_set)
++#define stmt_ass (*cloog_pointers__.p_stmt_ass)
++#define stmt_block (*cloog_pointers__.p_stmt_block)
++#define stmt_for (*cloog_pointers__.p_stmt_for)
++#define stmt_guard (*cloog_pointers__.p_stmt_guard)
++#define stmt_root (*cloog_pointers__.p_stmt_root)
++#define stmt_user (*cloog_pointers__.p_stmt_user)
++
+ typedef struct poly_dr *poly_dr_p;
+
+ typedef struct poly_bb *poly_bb_p;
+--- a/gcc/graphite.c
++++ b/gcc/graphite.c
+@@ -65,6 +65,34 @@ along with GCC; see the file COPYING3. If not see
+
+ CloogState *cloog_state;
+
++__typeof (cloog_pointers__) cloog_pointers__;
++
++static bool
++init_cloog_pointers (void)
++{
++ void *h;
++
++ if (cloog_pointers__.inited)
++ return cloog_pointers__.h != NULL;
++ h = dlopen ("libcloog-isl.so.4", RTLD_LAZY);
++ cloog_pointers__.h = h;
++ if (h == NULL)
++ return false;
++#define DYNSYM(x) \
++ do \
++ { \
++ union { __typeof (cloog_pointers__.p_##x) p; void *q; } u; \
++ u.q = dlsym (h, #x); \
++ if (u.q == NULL) \
++ return false; \
++ cloog_pointers__.p_##x = u.p; \
++ } \
++ while (0)
++ DYNSYMS
++#undef DYNSYM
++ return true;
++}
++
+ /* Print global statistics to FILE. */
+
+ static void
+@@ -263,6 +291,15 @@ graphite_transform_loops (void)
+ if (parallelized_function_p (cfun->decl))
+ return;
+
++ if (number_of_loops () <= 1)
++ return;
++
++ if (!init_cloog_pointers ())
++ {
++ sorry ("Graphite loop optimizations cannot be used");
++ return;
++ }
++
+ ctx = isl_ctx_alloc ();
+ isl_options_set_on_error(ctx, ISL_ON_ERROR_ABORT);
+ if (!graphite_initialize (ctx))
diff --git a/4.8.1/gentoo/92_all_freebsd-pie.patch b/4.8.1/gentoo/92_all_freebsd-pie.patch
new file mode 100644
index 0000000..4905db7
--- /dev/null
+++ b/4.8.1/gentoo/92_all_freebsd-pie.patch
@@ -0,0 +1,71 @@
+https://bugs.gentoo.org/415185
+http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00555.html
+
+From: Alexis Ballier <aballier@gentoo.org>
+To: gcc-patches@gcc.gnu.org
+Cc: Alexis Ballier <aballier@gentoo.org>
+Date: Tue, 8 May 2012 09:53:43 -0400
+Subject: [PATCH] gcc/config/freebsd-spec.h: Fix building PIE executables. Link them with crt{begin,end}S.o and Scrt1.o which are PIC instead of crt{begin,end}.o and crt1.o which are not. Spec synced from gnu-user.h.
+
+gcc/config/i386/freebsd.h: Likewise.
+---
+ gcc/config/freebsd-spec.h | 9 +++------
+ gcc/config/i386/freebsd.h | 9 +++------
+ 2 files changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/gcc/config/freebsd-spec.h b/gcc/config/freebsd-spec.h
+index 770a3d1..2808582 100644
+--- a/gcc/config/freebsd-spec.h
++++ b/gcc/config/freebsd-spec.h
+@@ -64,11 +64,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ before entering `main'. */
+
+ #define FBSD_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}"
+
+ /* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on
+ the magical crtend.o file (see crtstuff.c) which provides part of
+@@ -77,7 +74,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ `crtn.o'. */
+
+ #define FBSD_ENDFILE_SPEC \
+- "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
++ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+
+ /* Provide a LIB_SPEC appropriate for FreeBSD as configured and as
+ required by the user-land thread model. Before __FreeBSD_version
+diff --git a/gcc/config/i386/freebsd.h b/gcc/config/i386/freebsd.h
+index 649274d..dd69e43 100644
+--- a/gcc/config/i386/freebsd.h
++++ b/gcc/config/i386/freebsd.h
+@@ -67,11 +67,8 @@ along with GCC; see the file COPYING3. If not see
+
+ #undef STARTFILE_SPEC
+ #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}"
+
+ /* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on
+ the magical crtend.o file (see crtstuff.c) which provides part of
+@@ -81,7 +78,7 @@ along with GCC; see the file COPYING3. If not see
+
+ #undef ENDFILE_SPEC
+ #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"
+
+ /* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support
+ for the special GCC options -static and -shared, which allow us to
+--
+1.7.8.6
diff --git a/4.8.1/gentoo/README.history b/4.8.1/gentoo/README.history
new file mode 100644
index 0000000..a70c391
--- /dev/null
+++ b/4.8.1/gentoo/README.history
@@ -0,0 +1,20 @@
+1.0 03 Jun 2013
+ + 10_all_default-fortify-source.patch
+ + 11_all_default-warn-format-security.patch
+ + 12_all_default-warn-trampolines.patch
+ + 15_all_libgfortran-Werror.patch
+ + 16_all_libgomp-Werror.patch
+ + 25_all_alpha-mieee-default.patch
+ + 26_all_alpha-asm-mcpu.patch
+ + 29_all_arm_armv4t-default.patch
+ + 30_all_arm_armv4-no-thumb-fix-link.patch
+ + 34_all_ia64_note.GNU-stack.patch
+ + 38_all_sh_pr24836_all-archs.patch
+ + 42_all_superh_default-multilib.patch
+ + 48_all_x86_pr53113_libitm-avx.patch
+ + 50_all_libiberty-asprintf.patch
+ + 51_all_libiberty-pic.patch
+ + 52_all_netbsd-Bsymbolic.patch
+ + 67_all_gcc-poison-system-directories.patch
+ + 74_all_gcc48_cloog-dl.patch
+ + 92_all_freebsd-pie.patch
diff --git a/4.8.1/pie/01_all_gcc48_configure.patch b/4.8.1/pie/01_all_gcc48_configure.patch
new file mode 100644
index 0000000..1d3b429
--- /dev/null
+++ b/4.8.1/pie/01_all_gcc48_configure.patch
@@ -0,0 +1,266 @@
+2013-04-01 Magnus Granberg <zorry@gentoo.org>
+
+ * configure.ac Add --enable-esp. Add -fno-stack-protector
+ to stage1_cflags.
+ * configure Regenerated
+ * gcc/configure.ac Add --enable-esp and define ENABLE_ESP.
+ Check if we support crtbeginP and define ENABLE_CRTBEGINP.
+ * gcc/configure Regenerated
+
+--- a/configure.ac 2011-11-29 22:36:43.000000000 +0100
++++ b/configure.ac 2011-12-07 23:29:26.125712475 +0100
+@@ -419,6 +419,26 @@ if test "${ENABLE_LIBADA}" != "yes" ; th
+ noconfigdirs="$noconfigdirs gnattools"
+ fi
+
++# Check whether --enable-esp was given and target have the support.
++AC_ARG_ENABLE([esp],
++[AS_HELP_STRING([--enable-esp],
++ [Enable Stack protector and Position independent executable as
++ default if we have suppot for it when compiling
++ and link with -z relro and -z now as default.
++ Linux targets supported i*86, x86_64, x32,
++ powerpc, powerpc64, ia64, arm and mips.])],
++[
++ case $target in
++ i?86*-*-linux* | x86_64-*-linux* | powerpc*-*-linux* | mips-*-linux* | arm*-*-linux* | ia64-*-linux*)
++ enable_esp=yes
++ ;;
++ *)
++ AC_MSG_WARN([*** --enable-esp is not supported on this $target target.])
++ ;;
++ esac
++])
++AC_SUBST([enable_esp])
++
+ AC_ARG_ENABLE(libssp,
+ [AS_HELP_STRING([--enable-libssp], [build libssp directory])],
+ ENABLE_LIBSSP=$enableval,
+@@ -3211,6 +3230,11 @@ if test "$GCC" = yes -a "$ENABLE_BUILD_W
+ CFLAGS="$saved_CFLAGS"
+ fi
+
++# Disable -fstack-protector on stage1
++if test x$enable_esp = xyes; then
++ stage1_cflags="$stage1_cflags -fno-stack-protector"
++fi
++
+ AC_SUBST(stage1_cflags)
+
+ # Enable --enable-checking in stage1 of the compiler.
+--- a/gcc/configure.ac 2011-11-18 11:52:32.000000000 +0100
++++ b/gcc/configure.ac 2012-10-02 17:39:15.649526241 +0200
+@@ -5130,6 +5237,55 @@ if test x"${LINKER_HASH_STYLE}" != x; th
+ [The linker hash style])
+ fi
+
++# --------------
++# Esp checks
++# --------------
++
++# Check whether --enable-esp was given and target have the support.
++AC_ARG_ENABLE([esp],
++[AS_HELP_STRING([--enable-esp],
++ [Enable Stack protector and Position independent executable as
++ default if we have suppot for it when compiling
++ and link with -z now as default.
++ Linux targets supported i*86, x86_64, x32,
++ powerpc, powerpc64, ia64, arm and mips.])],
++ enable_esp=$enableval,
++ enable_esp=no)
++if test $enable_esp = yes ; then
++ AC_MSG_CHECKING(if $target support esp)
++ case "$target" in
++ i?86*-*-linux* | x86_64-*-linux* | powerpc*-*-linux* | mips-*-linux* | arm*-*-linux* | ia64-*-linux*)
++ enable_esp=yes
++ AC_DEFINE(ENABLE_ESP, 1,
++ [Define if your target support esp and you have enable it.])
++ ;;
++ *)
++ enable_esp=no
++ ;;
++ esac
++AC_MSG_RESULT($enable_esp)
++fi
++AC_SUBST([enable_esp])
++if test $enable_esp = yes ; then
++ AC_MSG_CHECKING(checking for crtbeginP.o support)
++ if test x$enable_esp = xyes ; then
++ case "$target" in
++ ia64*-*-linux*)
++ enable_crtbeginP=no ;;
++ *-*-linux*)
++ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then
++ enable_crtbeginP=yes
++ AC_DEFINE(ENABLE_CRTBEGINP, 1,
++ [Define if your compiler will support crtbeginP.])
++ fi
++ ;;
++ *) enable_crtbeginP=no ;;
++ esac
++ fi
++ AC_MSG_RESULT($enable_crtbeginP)
++fi
++AC_SUBST([enable_crtbeginP])
++
+ # Configure the subdirectories
+ # AC_CONFIG_SUBDIRS($subdirs)
+
+--- a/configure 2013-02-05 23:36:20.000000000 +0100
++++ b/configure 2013-02-12 01:59:04.000000000 +0100
+@@ -670,6 +670,7 @@
+ CFLAGS
+ CC
+ EXTRA_CONFIGARGS_LIBJAVA
++enable_esp
+ target_subdir
+ host_subdir
+ build_subdir
+@@ -748,6 +749,7 @@
+ enable_libquadmath
+ enable_libquadmath_support
+ enable_libada
++enable_esp
+ enable_libssp
+ enable_libstdcxx
+ enable_static_libjava
+@@ -1464,6 +1466,11 @@
+ --disable-libquadmath-support
+ disable libquadmath support for Fortran
+ --enable-libada build libada directory
++ --enable-esp Enable Stack protector and Position independent
++ executable as default if we have suppot for it when
++ compiling and link with and -z now as default.
++ Linux targets supported i*86, x86_64, x32,
++ powerpc, powerpc64, ia64, arm and mips.
+ --enable-libssp build libssp directory
+ --disable-libstdcxx do not build libstdc++-v3 directory
+ --enable-static-libjava[=ARG]
+@@ -3068,6 +3075,24 @@
+ noconfigdirs="$noconfigdirs gnattools"
+ fi
+
++# Check whether --enable-esp was given and target have the support.
++# Check whether --enable-esp was given.
++if test "${enable_esp+set}" = set; then :
++ enableval=$enable_esp;
++ case $target in
++ i?86*-*-linux* | x86_64-*-linux* | powerpc*-*-linux* | mips*-*-linux* | arm*-*-linux* | ia64-*-linux*)
++ enable_esp=yes
++ ;;
++ *)
++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** --enable-esp is not supported on this $target target." >&5
++$as_echo "$as_me: WARNING: *** --enable-esp is not supported on this $target target." >&2;}
++ ;;
++ esac
++
++fi
++
++
++
+ # Check whether --enable-libssp was given.
+ if test "${enable_libssp+set}" = set; then :
+ enableval=$enable_libssp; ENABLE_LIBSSP=$enableval
+@@ -14453,6 +14478,11 @@
+ esac ;;
+ esac
+
++# Disable -fstack-protector on stage1
++if test x$enable_esp = xyes; then
++ stage1_cflags="$stage1_cflags -fno-stack-protector"
++fi
++
+
+
+ # Enable --enable-checking in stage1 of the compiler.
+--- a/gcc/configure 2013-02-01 21:26:24.000000000 +0100
++++ b/gcc/configure 2013-02-12 01:59:20.000000000 +0100
+@@ -600,6 +600,8 @@
+
+ ac_subst_vars='LTLIBOBJS
+ LIBOBJS
++enable_crtbeginP
++enable_esp
+ enable_plugin
+ pluginlibs
+ CLOOGINC
+@@ -920,6 +922,7 @@
+ enable_plugin
+ enable_libquadmath_support
+ with_linker_hash_style
++enable_esp
+ '
+ ac_precious_vars='build_alias
+ host_alias
+@@ -1633,6 +1636,11 @@
+ --enable-plugin enable plugin support
+ --disable-libquadmath-support
+ disable libquadmath support for Fortran
++ --enable-esp Enable Stack protector and Position independent
++ executable as default if we have suppot for it when
++ compiling and link with -z now as default.
++ Linux targets supported i*86, x86_64, x32,
++ powerpc, powerpc64, ia64, arm and mips.
+
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+@@ -27419,6 +27427,59 @@
+
+ fi
+
++# --------------
++# Esp checks
++# --------------
++
++# Check whether --enable-esp was given and target have the support.
++# Check whether --enable-esp was given.
++if test "${enable_esp+set}" = set; then :
++ enableval=$enable_esp; enable_esp=$enableval
++else
++ enable_esp=no
++fi
++
++if test $enable_esp = yes ; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $target support esp" >&5
++$as_echo_n "checking if $target support esp... " >&6; }
++ case "$target" in
++ i?86*-*-linux* | x86_64-*-linux* | powerpc*-*-linux* | mips*-*-linux* | arm*-*-linux* | ia64-*-linux*)
++ enable_esp=yes
++
++$as_echo "#define ENABLE_ESP 1" >>confdefs.h
++
++ ;;
++ *)
++ enable_esp=no
++ ;;
++ esac
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_esp" >&5
++$as_echo "$enable_esp" >&6; }
++fi
++
++if test $enable_esp = yes ; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking checking for crtbeginP.o support" >&5
++$as_echo_n "checking checking for crtbeginP.o support... " >&6; }
++ if test x$enable_esp = xyes ; then
++ case "$target" in
++ ia64*-*-linux*)
++ enable_crtbeginP=no ;;
++ *-*-linux*)
++ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then
++ enable_crtbeginP=yes
++
++$as_echo "#define ENABLE_CRTBEGINP 1" >>confdefs.h
++
++ fi
++ ;;
++ *) enable_crtbeginP=no ;;
++ esac
++ fi
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_crtbeginP" >&5
++$as_echo "$enable_crtbeginP" >&6; }
++fi
++
++
+ # Configure the subdirectories
+ # AC_CONFIG_SUBDIRS($subdirs)
+
diff --git a/4.8.1/pie/02_all_gcc48_config.in.patch b/4.8.1/pie/02_all_gcc48_config.in.patch
new file mode 100644
index 0000000..3b4747b
--- /dev/null
+++ b/4.8.1/pie/02_all_gcc48_config.in.patch
@@ -0,0 +1,32 @@
+2013-02-13 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config.in Add ENABLE_CRTBEGINP, ENABLE_ESP
+
+--- gcc/config.in 2009-04-21 11:08:08.000000000 +0200
++++ gcc/config.in 2009-05-12 00:10:08.000000000 +0200
+@@ -46,6 +46,12 @@
+ #endif
+
+
++/* Define to 1 to enable crtbeginP.o. */
++#ifndef USED_FOR_TARGET
++#undef ENABLE_CRTBEGINP
++#endif
++
++
+ /* Define to 1 to specify that we are using the BID decimal floating point
+ format instead of DPD */
+ #ifndef USED_FOR_TARGET
+@@ -65,6 +65,12 @@
+ #endif
+
+
++/* Define to 1 to enable esp. */
++#ifndef USED_FOR_TARGET
++#undef ENABLE_ESP
++#endif
++
++
+ /* Define to 1 to enable fixed-point arithmetic extension to C. */
+ #ifndef USED_FOR_TARGET
+ #undef ENABLE_FIXED_POINT
diff --git a/4.8.1/pie/03_all_gcc48_Makefile.in.patch b/4.8.1/pie/03_all_gcc48_Makefile.in.patch
new file mode 100644
index 0000000..9f6c520
--- /dev/null
+++ b/4.8.1/pie/03_all_gcc48_Makefile.in.patch
@@ -0,0 +1,130 @@
+2012-01-17 Magnus Granberg <zorry@gentoo.org>
+
+ * Makefile.in We add -fno-stack-protector to BOOT_CFLAGS, LIBCFLAGS and
+ LIBCXXFLAGS if enable_esp yes.
+ * gcc/Makefile.in Add -fno-PIE. to ALL_CFLAGS and
+ ALL_CXXFLAGS if enable_esp yes.
+ Echo enable_esp and enable_crtbeginP to tmp-libgcc.mvars.
+ * libgcc/Makefile.in Add crtbeginP.o to EXTRA_PARTS if enable_crtbeginP yes
+ We add new file crtbeginP.o if enable_crtbeginP yes
+ Add -fno-PIE. to CRTSTUFF_CFLAGS.
+
+--- a/Makefile.in 2010-01-22 08:35:38.000000000 -0500
++++ b/Makefile.in 2010-02-07 15:10:59.000000000 -0500
+@@ -350,9 +350,17 @@
+ BUILD_PREFIX = @BUILD_PREFIX@
+ BUILD_PREFIX_1 = @BUILD_PREFIX_1@
+
++# Some stuff don't compile with SSP
++enable_esp = @enable_esp@
++ifeq ($(enable_esp),yes)
++ESP_NOSSP_CFLAGS = -fno-stack-protector
++else
++ESP_NOSSP_CFLAGS=
++endif
++
+ # Flags to pass to stage2 and later makes. They are defined
+ # here so that they can be overridden by Makefile fragments.
+-BOOT_CFLAGS= -g -O2
++BOOT_CFLAGS= -g -O2 $(ESP_NOSSP_CFLAGS)
+ BOOT_LDFLAGS=
+ BOOT_ADAFLAGS=-gnatpg -gnata
+
+@@ -403,9 +403,9 @@
+
+ CFLAGS = @CFLAGS@
+ LDFLAGS = @LDFLAGS@
+-LIBCFLAGS = $(CFLAGS)
++LIBCFLAGS = $(CFLAGS) $(ESP_NOSSP_CFLAGS)
+ CXXFLAGS = @CXXFLAGS@
+-LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
++LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates $(ESP_NOSSP_CFLAGS)
+ GOCFLAGS = $(CFLAGS)
+
+ TFLAGS =
+--- a/gcc/Makefile.in 2011-11-09 02:20:14.000000000 +0100
++++ b/gcc/Makefile.in 2011-12-24 22:28:08.864804375 +0100
+@@ -247,6 +247,14 @@ LINKER_FLAGS = $(CFLAGS)
+ endif
+ endif
+
++# We don't want to compile the compiler with -fPIE, it make PCH fail.
++enable_esp = @enable_esp@
++ifeq ($(enable_esp),yes)
++ESP_NOPIE_CFLAGS = -fno-PIE
++else
++ESP_NOPIE_CFLAGS=
++endif
++
+ # -------------------------------------------
+ # Programs which operate on the build machine
+ # -------------------------------------------
+@@ -974,12 +982,13 @@ INTERNAL_CFLAGS = -DIN_GCC @CROSS@
+
+ # This is the variable actually used when we compile. If you change this,
+ # you probably want to update BUILD_CFLAGS in configure.ac
+-ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \
++ALL_CFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) \
+ $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@
+
+ # The C++ version.
+-ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \
+- $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) $(WARN_CXXFLAGS) @DEFS@
++ALL_CXXFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) \
++ $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) \
++ $(WARN_CXXFLAGS) @DEFS@
+
+ # Likewise. Put INCLUDES at the beginning: this way, if some autoconf macro
+ # puts -I options in CPPFLAGS, our include files in the srcdir will always
+@@ -1814,6 +1823,8 @@ libgcc.mvars: config.status Makefile spe
+ echo GCC_CFLAGS = '$(GCC_CFLAGS)' >> tmp-libgcc.mvars
+ echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars
+ echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars
++ echo enable_esp = '$(enable_esp)' >> tmp-libgcc.mvars
++ echo enable_crtbeginP = '@enable_crtbeginP@' >> tmp-libgcc.mvars
+
+ mv tmp-libgcc.mvars libgcc.mvars
+
+--- a/libgcc/Makefile.in 2011-11-22 04:01:02.000000000 +0100
++++ b/libgcc/Makefile.in 2011-12-25 15:18:22.449610631 +0100
+@@ -219,6 +219,17 @@ else
+ DECNUMINC =
+ endif
+
++ifeq ($(enable_esp),yes)
++ESP_NOPIE_CFLAGS = -fno-PIE
++else
++ESP_NOPIE_CFLAGS=
++endif
++
++# We add crtbeginP.o to the EXTRA_PARTS list if enable_crtbeginP = yes
++ifeq ($(enable_crtbeginP),yes)
++EXTRA_PARTS += crtbeginP.o
++endif
++
+ # Options to use when compiling libgcc2.a.
+ #
+ LIBGCC2_DEBUG_CFLAGS = -g
+@@ -279,7 +290,7 @@ INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CF
+ CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
+ -finhibit-size-directive -fno-inline -fno-exceptions \
+ -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
+- -fno-stack-protector \
++ -fno-stack-protector $(ESP_NOPIE_CFLAGS) \
+ $(INHIBIT_LIBC_CFLAGS)
+
+ # Extra flags to use when compiling crt{begin,end}.o.
+@@ -966,6 +977,13 @@ crtendS$(objext): $(srcdir)/crtstuff.c
+ # This is a version of crtbegin for -static links.
+ crtbeginT$(objext): $(srcdir)/crtstuff.c
+ $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O
++
++# This is a version of crtbegin for -static -fPIE links.
++ifeq ($(enable_crtbeginP),yes)
++crtbeginP$(objext): $(srcdir)/crtstuff.c
++ $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
++ -c $< -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O
++endif
+ endif
+
+ ifeq ($(CUSTOM_CRTIN),)
diff --git a/4.8.1/pie/05_all_gcc48_gcc.c.patch b/4.8.1/pie/05_all_gcc48_gcc.c.patch
new file mode 100644
index 0000000..b92607b
--- /dev/null
+++ b/4.8.1/pie/05_all_gcc48_gcc.c.patch
@@ -0,0 +1,25 @@
+2013-03-24 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/gcc.c include esp.h
+ static const char *cc1_spec We set that in esp.h if ENABLE_ESP.
+
+--- gcc/gcc.c 2010-01-21 10:29:30.000000000 -0500
++++ gcc/gcc.c 2010-01-29 23:29:16.000000000 -0500
+@@ -44,6 +44,7 @@
+ #include "opts.h"
+ #include "params.h"
+ #include "vec.h"
++#include "config/esp.h" /* for --enable-esp support */
+ #include "filenames.h"
+
+ /* By default there is no special suffix for target executables. */
+@@ -822,7 +823,9 @@
+
+ static const char *asm_debug;
+ static const char *cpp_spec = CPP_SPEC;
++#ifndef ENABLE_ESP
+ 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 *link_ssp_spec = LINK_SSP_SPEC;
diff --git a/4.8.1/pie/15_all_gcc44_decl-tls-model.patch b/4.8.1/pie/15_all_gcc44_decl-tls-model.patch
new file mode 100644
index 0000000..09438a0
--- /dev/null
+++ b/4.8.1/pie/15_all_gcc44_decl-tls-model.patch
@@ -0,0 +1,20 @@
+2009-06-13 Magnus Granberg <zorry@ume.nu>
+
+ b.g.o #232601
+ * gcc/varasm.c (decl_tls_model): Check flag_pic instead of flag_shlib.
+
+--- gcc/varasm.c 2009-03-17 21:18:21.000000000 +0100
++++ gcc/varasm.c 2009-04-29 03:10:09.000000000 +0200
+@@ -5607,7 +5607,11 @@
+ bool is_local;
+
+ is_local = targetm.binds_local_p (decl);
+- if (!flag_shlib)
++ #ifdef ENABLE_ESP
++ if (!flag_pic)
++ #else
++ if (!flag_shlib)
++ #endif
+ {
+ if (is_local)
+ kind = TLS_MODEL_LOCAL_EXEC;
diff --git a/4.8.1/pie/16_all_gcc47_nopie_option.patch b/4.8.1/pie/16_all_gcc47_nopie_option.patch
new file mode 100644
index 0000000..ed9a961
--- /dev/null
+++ b/4.8.1/pie/16_all_gcc47_nopie_option.patch
@@ -0,0 +1,16 @@
+2012-01-24 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/common.opt Add -nopie
+
+--- a/gcc/common.opt 2011-11-23 19:51:17.000000000 +0100
++++ b//gcc/common.opt 2012-01-24 16:56:24.302224357 +0100
+@@ -2280,6 +2280,9 @@ Driver
+ nodefaultlibs
+ Driver
+
++nopie
++Driver
++
+ nostartfiles
+ Driver
+
diff --git a/4.8.1/pie/20_all_gcc46_config_crtbeginp.patch b/4.8.1/pie/20_all_gcc46_config_crtbeginp.patch
new file mode 100644
index 0000000..0e716b0
--- /dev/null
+++ b/4.8.1/pie/20_all_gcc46_config_crtbeginp.patch
@@ -0,0 +1,36 @@
+2011-03-05 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/gnu-user.h If ENABLE_CRTBEGINP, -static and -pie use crtbegineP.o.
+ * gcc/config/rs6000/sysv4.h If ENABLE_CRTBEGINP, -static and -pie use crtbegineP.o.
+
+--- gcc/config/gnu-user.h 2009-04-10 01:23:07.000000000 +0200
++++ gcc/config/gnu-user.h 2009-09-08 04:08:06.000000000 +0200
+@@ -39,7 +39,11 @@
+ provides part of the support for getting C++ file-scope static
+ object constructed before entering `main'. */
+
+-#if defined HAVE_LD_PIE
++#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINP)
++#define GNU_USER_TARGET_STARTFILE_SPEC \
++ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} crti.o%s \
++ %{static:%{pie:crtbeginP.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}"
++#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINP)
+ #define GNU_USER_TARGET_STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile: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}"
+--- gcc/config/rs6000/sysv4.h 2009-04-10 01:23:07.000000000 +0200
++++ gcc/config/rs6000/sysv4.h 2009-09-08 04:41:50.000000000 +0200
+@@ -883,7 +883,12 @@
+ %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
+ %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
+
+-#ifdef HAVE_LD_PIE
++#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINP)
++#define STARTFILE_LINUX_SPEC "\
++%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
++%{mnewlib:ecrti.o%s;:crti.o%s} \
++%{static:%{pie:crtbeginP.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}"
++#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINP)
+ #define STARTFILE_LINUX_SPEC "\
+ %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
+ %{mnewlib:ecrti.o%s;:crti.o%s} \
diff --git a/4.8.1/pie/24_all_gcc44_invoke.texi.patch b/4.8.1/pie/24_all_gcc44_invoke.texi.patch
new file mode 100644
index 0000000..15b3417
--- /dev/null
+++ b/4.8.1/pie/24_all_gcc44_invoke.texi.patch
@@ -0,0 +1,44 @@
+2009-09-11 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/doc/invoke.texi Add NOTES about -fstack-protector-all, -pie and
+ -fPIE/-fpie when --enable-esp is enable, this options is on by default.
+
+--- gcc/doc/invoke.texi 2009-04-01 09:18:47.000000000 +0200
++++ gcc/doc/invoke.texi 2009-06-18 14:08:38.000000000 +0200
+@@ -7134,6 +7134,11 @@
+ @opindex fstack-protector-all
+ Like @option{-fstack-protector} except that all functions are protected.
+
++NOTE: When --enable-esp this option is enabled by default
++for C, C++, ObjC, ObjC++, if neither @option{-fno-stack-protector}
++or @option{-nostdlib} or @option{-nodefaultlibs} or
++@option{-fstack-protector} are found.
++
+ @item -fsection-anchors
+ @opindex fsection-anchors
+ Try to reduce the number of symbolic address calculations by using
+@@ -7960,6 +7965,12 @@
+ that were used to generate code (@option{-fpie}, @option{-fPIE},
+ or model suboptions) when you specify this option.
+
++NOTE: When --enable-esp this option is enabled by default
++for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE}
++or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or
++@option{-nostartfiles} or @option{-shared} or @option{-pg} or @option{-p}
++are found.
++
+ @item -rdynamic
+ @opindex rdynamic
+ Pass the flag @option{-export-dynamic} to the ELF linker, on targets
+@@ -15889,6 +15910,11 @@
+ @code{__pie__} and @code{__PIE__}. The macros have the value 1
+ for @option{-fpie} and 2 for @option{-fPIE}.
+
++NOTE: When --enable-esp this option is enabled by default
++for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE}
++or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or
++@option{-nostartfiles} or @option{-shared} are found.
++
+ @item -fno-jump-tables
+ @opindex fno-jump-tables
+ Do not use jump tables for switch statements even where it would be
diff --git a/4.8.1/pie/33_all_gcc48_config_rs6000.patch b/4.8.1/pie/33_all_gcc48_config_rs6000.patch
new file mode 100644
index 0000000..25e704f
--- /dev/null
+++ b/4.8.1/pie/33_all_gcc48_config_rs6000.patch
@@ -0,0 +1,47 @@
+2013-03-26 Peter S. Mazinger <ps.m@gmx.net>, Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/rs6000/linux64.h (ASM_SPEC32): Change %{fpic:-K PIC} %{fPIC:-K PIC}
+ to %{fpic|fPIC|fpie|fPIE:-K PIC}
+ * gcc/config/rs6000/sysv4.h (DRIVER_SELF_SPECS): Add ESP_DRIVER_SELF_SPECS.
+ (SUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS.
+
+--- a/gcc/config/rs6000/linux64.h.psm 2009-04-10 01:23:07.000000000 +0200
++++ b/gcc/config/rs6000/linux64.h 2009-09-23 12:34:26.000000000 +0200
+@@ -162,7 +162,7 @@
+ #endif
+
+ #define ASM_SPEC32 "-a32 \
+-%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
++%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} \
+ %{memb} %{!memb: %{msdata=eabi: -memb}} \
+ %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
+ %{mcall-freebsd: -mbig} \
+--- a/gcc/config/rs6000/sysv4.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/rs6000/sysv4.h 2013-03-26 01:30:33.257003189 +0100
+@@ -627,8 +627,13 @@ extern int fixuplabelno;
+
+ #define LINK_OS_DEFAULT_SPEC ""
+
++#ifdef ENABLE_ESP
++#define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
++ %<msingle-float %<mdouble-float}", ESP_DRIVER_SELF_SPECS
++#else
+ #define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
+ %<msingle-float %<mdouble-float}"
++#endif
+
+ /* Override rs6000.h definition. */
+ #undef CPP_SPEC
+@@ -933,7 +938,11 @@ ncrtn.o%s"
+ { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \
+ { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \
+ { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }, \
+- SUBSUBTARGET_EXTRA_SPECS
++ SUBSUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS
++
++#ifndef ENABLE_ESP
++#define ESP_EXTRA_SPECS
++#endif
+
+ #define SUBSUBTARGET_EXTRA_SPECS
+
diff --git a/4.8.1/pie/34_all_gcc48_config_i386.patch b/4.8.1/pie/34_all_gcc48_config_i386.patch
new file mode 100644
index 0000000..9f0f7a3
--- /dev/null
+++ b/4.8.1/pie/34_all_gcc48_config_i386.patch
@@ -0,0 +1,56 @@
+2013-03-24 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/i386/gnu-user-common.h (DRIVER_SELF_SPECS): Add ESP_DRIVER_SELF_SPEC.
+ * gcc/config/i386/gnu-user.h (SUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS.
+ * gcc/config/i386/i386.h (SUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS.
+
+--- a/gcc/config/i386/gnu-user-common.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/i386/gnu-user-common.h 2013-02-14 00:51:44.689637605 +0100
+@@ -70,3 +70,7 @@ along with GCC; see the file COPYING3.
+
+ /* Static stack checking is supported by means of probes. */
+ #define STACK_CHECK_STATIC_BUILTIN 1
++
++#ifdef ENABLE_ESP
++#define DRIVER_SELF_SPECS ESP_DRIVER_SELF_SPEC
++#endif
+--- a/gcc/config/i386/gnu-user.h 2011-05-05 14:32:50.000000000 +0200
++++ b/gcc/config/i386/gnu-user.h 2012-07-09 14:28:38.726289455 +0200
+@@ -93,9 +93,16 @@ along with GCC; see the file COPYING3.
+ "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
+
+ #undef SUBTARGET_EXTRA_SPECS
++#ifdef ENABLE_ESP
+ #define SUBTARGET_EXTRA_SPECS \
+ { "link_emulation", GNU_USER_LINK_EMULATION },\
+- { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
++ { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }, \
++ ESP_EXTRA_SPECS
++#else
++#define SUBTARGET_EXTRA_SPECS \
++ { "link_emulation", GNU_USER_LINK_EMULATION },\
++ { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
++#endif
+
+ #undef LINK_SPEC
+ #define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
+--- a/gcc/config/i386/i386.h 2011-11-24 23:11:12.000000000 +0100
++++ b/gcc/config/i386/i386.h 2012-07-09 14:21:24.575276517 +0200
+@@ -617,13 +617,16 @@ enum target_cpu_default
+ Do not define this macro if it does not need to do anything. */
+
+ #ifndef SUBTARGET_EXTRA_SPECS
++#ifdef ENABLE_ESP
++#define SUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS
++#else
+ #define SUBTARGET_EXTRA_SPECS
+ #endif
++#endif
+
+ #define EXTRA_SPECS \
+ { "cc1_cpu", CC1_CPU_SPEC }, \
+ SUBTARGET_EXTRA_SPECS
+-
+
+ /* Set the value of FLT_EVAL_METHOD in float.h. When using only the
+ FPU, assume that the fpcw is set to extended precision; when using
diff --git a/4.8.1/pie/35_all_gcc48_config_arm.patch b/4.8.1/pie/35_all_gcc48_config_arm.patch
new file mode 100644
index 0000000..5aecc6b
--- /dev/null
+++ b/4.8.1/pie/35_all_gcc48_config_arm.patch
@@ -0,0 +1,35 @@
+2013-06-03 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/arm/arm.h (DRIVER_SELF_SPECS): Add ESP_DRIVER_SELF_SPEC.
+ * gcc/config/arm/elf.h (SUBSUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS.
+
+--- a/gcc/config/arm/arm.h 2013-01-15 17:17:28.000000000 +0100
++++ b/gcc/config/arm/arm.h 2013-02-18 22:45:18.327284928 +0100
+@@ -2326,6 +2326,11 @@ extern const char *host_detect_local_cpu
+ # define MCPU_MTUNE_NATIVE_SPECS ""
+ #endif
+
+-#define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS
+-
++#ifdef ENABLE_ESP
++# define DRIVER_SELF_SPECS \
++ MCPU_MTUNE_NATIVE_SPECS, \
++ ESP_DRIVER_SELF_SPEC
++#else
++# define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS
++#endif
+ #endif /* ! GCC_ARM_H */
+--- a/gcc/config/arm/elf.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/arm/elf.h 2013-05-19 02:15:49.595855825 +0200
+@@ -49,7 +49,11 @@
+ #endif
+
+ #undef SUBSUBTARGET_EXTRA_SPECS
++#ifdef ENABLE_ESP
++#define SUBSUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS
++#else
+ #define SUBSUBTARGET_EXTRA_SPECS
++#endif
+
+ #ifndef ASM_SPEC
+ #define ASM_SPEC "\
diff --git a/4.8.1/pie/36_all_gcc48_config_mips.patch b/4.8.1/pie/36_all_gcc48_config_mips.patch
new file mode 100644
index 0000000..a924f85
--- /dev/null
+++ b/4.8.1/pie/36_all_gcc48_config_mips.patch
@@ -0,0 +1,61 @@
+2013-04-01 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/mips/gnu-user.h (DRIVER_SELF_SPECS): Add ESP_DRIVER_SELF_SPEC.
+ * gcc/config/mips/gnu-user64.h (DRIVER_SELF_SPECS): Add ESP_DRIVER_SELF_SPEC.
+ * gcc/config/mips/mips.h (SUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS.
+
+--- a/gcc/config/mips/gnu-user.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/mips/gnu-user.h 2013-03-10 22:37:33.743176388 +0100
+@@ -125,9 +125,16 @@ extern const char *host_detect_local_cpu
+ "%{mabi=64:%{!msym32:%<mplt}}"
+
+ #undef DRIVER_SELF_SPECS
++#ifdef ENABLE_ESP
+ #define DRIVER_SELF_SPECS \
+ BASE_DRIVER_SELF_SPECS, \
++ ESP_DRIVER_SELF_SPEC, \
+ LINUX_DRIVER_SELF_SPECS
++# else
++#define DRIVER_SELF_SPECS \
++ BASE_DRIVER_SELF_SPECS, \
++ LINUX_DRIVER_SELF_SPECS
++#endif
+
+ /* Similar to standard Linux, but adding -ffast-math support. */
+ #undef GNU_USER_TARGET_MATHFILE_SPEC
+--- a/gcc/config/mips/gnu-user64.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/mips/gnu-user64.h 2013-03-10 22:32:11.209166777 +0100
+@@ -26,9 +26,16 @@ along with GCC; see the file COPYING3.
+ " %{!mabi=*: -" MULTILIB_ABI_DEFAULT "}"
+
+ #undef DRIVER_SELF_SPECS
++#ifdef ENABLE_ESP
+ #define DRIVER_SELF_SPECS \
+ BASE_DRIVER_SELF_SPECS, \
++ ESP_DRIVER_SELF_SPEC, \
+ LINUX64_DRIVER_SELF_SPECS
++# else
++#define DRIVER_SELF_SPECS \
++ BASE_DRIVER_SELF_SPECS, \
++ LINUX64_DRIVER_SELF_SPECS
++#endif
+
+ #undef GNU_USER_TARGET_LINK_SPEC
+ #define GNU_USER_TARGET_LINK_SPEC "\
+--- a/gcc/config/mips/mips.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/mips/mips.h 2013-03-24 16:59:01.474513910 +0100
+@@ -1197,9 +1197,13 @@ struct mips_cpu_info {
+ SUBTARGET_EXTRA_SPECS
+
+ #ifndef SUBTARGET_EXTRA_SPECS
++#ifdef ENABLE_ESP
++#define SUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS
++#else
+ #define SUBTARGET_EXTRA_SPECS
+ #endif
+-
++#endif
++
+ #define DBX_DEBUGGING_INFO 1 /* generate stabs (OSF/rose) */
+ #define DWARF2_DEBUGGING_INFO 1 /* dwarf2 debugging info */
+
diff --git a/4.8.1/pie/37_all_gcc48_config_ia64.patch b/4.8.1/pie/37_all_gcc48_config_ia64.patch
new file mode 100644
index 0000000..ba71922
--- /dev/null
+++ b/4.8.1/pie/37_all_gcc48_config_ia64.patch
@@ -0,0 +1,30 @@
+2013-06-03 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/ia64/linux.h Define DRIVER_SELF_SPECS ESP_DRIVER_SELF_SPEC.
+ * gcc/config/ia64/ia64.h (SUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS.
+
+--- a/gcc/config/ia64/linux.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/ia64/linux.h 2013-03-16 22:50:10.363049291 +0100
+@@ -88,3 +88,7 @@ do { \
+
+ /* Define this to be nonzero if static stack checking is supported. */
+ #define STACK_CHECK_STATIC_BUILTIN 1
++
++#ifdef ENABLE_ESP
++#define DRIVER_SELF_SPECS ESP_DRIVER_SELF_SPEC
++#endif
+--- a/gcc/config/ia64/ia64.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/ia64/ia64.h 2013-03-26 02:03:21.052061828 +0100
+@@ -41,8 +41,12 @@ do { \
+ } while (0)
+
+ #ifndef SUBTARGET_EXTRA_SPECS
++#ifdef ENABLE_ESP
++#define SUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS
++#else
+ #define SUBTARGET_EXTRA_SPECS
+ #endif
++#endif
+
+ #define EXTRA_SPECS \
+ { "asm_extra", ASM_EXTRA_SPEC }, \
diff --git a/4.8.1/pie/40_all_gcc48_config_esp.patch b/4.8.1/pie/40_all_gcc48_config_esp.patch
new file mode 100644
index 0000000..83630f2
--- /dev/null
+++ b/4.8.1/pie/40_all_gcc48_config_esp.patch
@@ -0,0 +1,135 @@
+2013-02-14 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/esp.h New file to support --enable-esp
+ Version 20130214.1
+
+--- gcc/config/esp.h 2010-04-09 16:14:00.000000000 +0200
++++ gcc/config/esp.h 2012-06-23 01:00:31.248348491 +0200
+@@ -0,0 +1,127 @@
++/* License terms see GNU GENERAL PUBLIC LICENSE Version 3.
++ * Version 20130214.1
++ * Magnus Granberg (Zorry) <zorry@gentoo.org> */
++#ifndef GCC_ESP_H
++#define GCC_ESP_H
++
++/* This file will add -fstack-protector-all, -fPIE, -pie and -z now
++ as default if the defines and the spec allow it.
++ Added a hack for gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass
++ to support older hardened GCC patches and we don't need to change the code on gcc-specs-* and _filter-hardened.
++ This will add some unsupported upstream commands options as -nopie and -nonow.
++ -D__KERNEL__ is added so we don't have -fPIE, -pie and -fstack-protector-all when building kernels.
++ ESP_CC1_SPEC is added to CC1_SPEC.
++ ESP_CC1_STRICT_OVERFLOW_SPEC is added so we don't disable the strict-overflow check.
++ ESP_LINK_PIE_CHECK_SPEC check for -pie, -p, -pg, -profile and -static.
++ ENABLE_CRTBEGINP add support for crtbeginP.o, build -static with -fPIE or -fpie.
++*/
++#ifdef ENABLE_ESP
++
++ /* Hack to support gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass */
++ #define ESP_CC1_SPEC " %(esp_cc1_ssp) %(esp_cc1_pie) %(esp_cc1_strict_overflow)"
++ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP )
++ #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: }}"
++ #else
++ #define ESP_CC1_SSP_SPEC ""
++ #endif
++ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP )
++ #define ESP_CC1_PIE_SPEC "%{!nopie: }"
++ #else
++ #define ESP_CC1_PIE_SPEC ""
++ #endif
++ #define ESP_CC1_STRICT_OVERFLOW_SPEC "%{!fstrict-overflow:%{!fno-strict-overflow: -fno-strict-overflow}}"
++
++ /* ESP_LINK_SPEC is added to LINK_PIE_SPEC if esp is enable
++ -z now will be added if we don't have -vanilla spec. We do a -pie incompatible check
++ Don't remove the specs in the end */
++ #define ESP_LINK_SPEC "%(esp_link_now) %(esp_link_pie_check) "
++ #define ESP_LINK_NOW_SPEC "%{!nonow:-z now}"
++
++ /* We use ESP_ESP_DRIVER_SELF_SPEC to add pie and ssp command-line options. */
++ #define ESP_DRIVER_SELF_SPEC "%{D__KERNEL__:;:%{!nopie:%(esp_options_pie) \
++ %(esp_link_pie)} %(esp_options_ssp) }"
++
++ /* This will add -fstack-protector-all if we don't have -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector
++ -fstack-protector-all and we have EFAULT_SSP or EFAULT_PIE_SSP defined. */
++ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP )
++ #define ESP_OPTIONS_SSP_SPEC \
++ "%{nostdlib|nodefaultlibs|fno-stack-protector| \
++ fstack-protector|fstack-protector-all:;:-fstack-protector-all}"
++ #else
++ #define ESP_OPTIONS_SSP_SPEC ""
++ #endif
++
++ /* If EFAULT_PIE or EFAULT_PIE_SSP is defined we will add -fPIE -pie */
++ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP )
++
++ /* This will add -fPIE if we don't have -pie -fpic -fPIC -fpie -fPIE -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static
++ -nostdlib -nostartfiles. */
++ /* With ENABLE_CRTBEGINP we don't need to check for -static */
++ #ifdef ENABLE_CRTBEGINP
++ #define ESP_OPTIONS_PIE_SPEC \
++ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \
++ %{!shared: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }"
++ #else
++ #define ESP_OPTIONS_PIE_SPEC \
++ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \
++ %{!shared: %{!static: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }}"
++ #endif
++
++ /* This will add -pie if we don't have -pie -A -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static -r -nostdlib
++ -nostartfiles */
++ /* With ENABLE_CRTBEGINP we don't need to check for -static
++ and we add -pie only to get the start and endfiles. -pie will not go to the linker. */
++ #ifdef ENABLE_CRTBEGINP
++ #define ESP_LINK_PIE_SPEC \
++ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!r: \
++ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}"
++ #else
++ #define ESP_LINK_PIE_SPEC \
++ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r: \
++ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}}"
++ #endif
++
++ /* This will check if -pie is set when (-static) -pg -p -profile. If set it will make gcc print out
++ "-pie and (static)|pg|p|profile are incompatible when linking" */
++ /* With ENABLE_CRTBEGINP we don't need to check for -static */
++ #ifdef ENABLE_CRTBEGINP
++ #define ESP_LINK_PIE_CHECK_SPEC \
++ "%{pie:%{pg|p|profile:%e-pie and -pg|p|profile are incompatible when linking}}"
++ #else
++ #define ESP_LINK_PIE_CHECK_SPEC \
++ "%{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible when linking}}"
++ #endif
++
++ /* We don't pass -pie to the linker when -static. */
++ #ifdef ENABLE_CRTBEGINP
++ #define LINK_PIE_SPEC "%{!static:%{pie:-pie}} %(esp_link)"
++ #else
++ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)"
++ #endif
++
++ #else
++ #define ESP_OPTIONS_PIE_SPEC ""
++ #define ESP_LINK_PIE_CHECK_SPEC ""
++ #define ESP_LINK_PIE_SPEC ""
++ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)"
++ #endif
++
++ /* We add extra spec name's to the EXTRA_SPECS list */
++ #define ESP_EXTRA_SPECS \
++ { "esp_cc1", ESP_CC1_SPEC }, \
++ { "esp_cc1_pie", ESP_CC1_PIE_SPEC }, \
++ { "esp_cc1_ssp", ESP_CC1_SSP_SPEC }, \
++ { "esp_cc1_strict_overflow", ESP_CC1_STRICT_OVERFLOW_SPEC }, \
++ { "esp_link", ESP_LINK_SPEC }, \
++ { "esp_link_now", ESP_LINK_NOW_SPEC }, \
++ { "esp_link_pie", ESP_LINK_PIE_SPEC }, \
++ { "esp_link_pie_check", ESP_LINK_PIE_CHECK_SPEC }, \
++ { "esp_driver_self", ESP_DRIVER_SELF_SPEC }, \
++ { "esp_options_pie", ESP_OPTIONS_PIE_SPEC }, \
++ { "esp_options_ssp", ESP_OPTIONS_SSP_SPEC }
++
++ static const char *esp_driver_self_spec = ESP_DRIVER_SELF_SPEC;
++ static const char *cc1_spec = CC1_SPEC ESP_CC1_SPEC;
++
++#endif
++#endif /* End GCC_ESP_H */
diff --git a/4.8.1/pie/README b/4.8.1/pie/README
new file mode 100644
index 0000000..5d0bc13
--- /dev/null
+++ b/4.8.1/pie/README
@@ -0,0 +1,18 @@
+This work started with bugs #94325 #100689 #106222 #149292 #149649 and the overlay on http://overlays.gentoo.org/dev/kevquinn.
+By Kevin K. Quinn, Peter S. Mazinger, Natanael Copa, Alexander Gabert, Solar, PaX Team, SpanKY and mentor.
+
+The work stalled. Some threads on the Gentoo forum started to do their own fixes to get it working.
+Xake started the thread where most of the new work is done: "How long until hardened and toolchain will produce a hardened gcc4?"
+http://forums.gentoo.org/viewtopic-t-668885.html. I joined the thread and started to code.
+
+We started with the pieworld code from kevquinn's overlay. The PIE and minispecs part hit the tree later on.
+With GCC 4.4.0 I was willing to do some code cleanup, use built-in specs and add it as --enable-esp in the
+configure command line. On GCC 4.8.0 we use DRIVER_SELF_SPECS for the specs.
+
+Thank you all:
+Kevin K. Quinn, Peter S. Mazinger, Natanael Copa, Alexander Gabert, Solar, PaX Team, SpanKY, Xake, Dwokfur,
+KernelOfTruth, SteveL, nixnut, Hopeless, forsaken1, XioXous, obrut<-, mv, qjim, Tommy[D], Genewb, radegand,
+unk, neuron, alexxy, hellboi64, likewhoa, g0rg0n, costel78, polsas, 7v5w7go9ub0o, uberpinguin, Naib, cilly,
+bonsaikitten, kerframil, agaffney, Gordon Malm, blueness, Matthias Klose, Kees Cook, mentor, Anarchy,
+devurandom and everyone else for helping to test, suggestions, fixes and anything else we have missed.
+/2013-03-31 Magnus Grenberg (Zorry) <zorry@gentoo.org>
diff --git a/4.8.1/pie/README.Changelog b/4.8.1/pie/README.Changelog
new file mode 100644
index 0000000..c207757
--- /dev/null
+++ b/4.8.1/pie/README.Changelog
@@ -0,0 +1,388 @@
+0.5.6 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/ia64/linux.h Change ESP_DRIVER_SELF_SPECS To ESP_DRIVER_SELF_SPEC
+ * gcc/config/arm/elf.h (SUBSUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS.
+
+0.5.5 Magnus Granberg <zorry@gentoo.org>
+
+ * configure.ac Add mips
+ * configure Regenerated
+ * gcc/configure.ac Clean up the checksand add mips.
+ * gcc/configure Regenerated
+ * gcc/config.in Remove ENABLE_ESP_SSP
+ * gcc/Makefile.in Bumped for 4.8.0 release
+ * gcc/gcc.c Remove ESP_EXTRA_SPECS and
+ ESP_COMMAND_OPTIONS_SPEC
+ * gcc/config/rs6000/sysv4.h Add ESP_DRIVER_SELF_SPEC
+ and ESP_EXTRA_SPECS
+ * gcc/config/i386/gnu-user-common.h Add ESP_DRIVER_SELF_SPEC
+ * gcc/config/i386/gnu-user.h Add ESP_DRIVER_SELF_SPEC
+ * gcc/config/i386/i386.h Add ESP_DRIVER_SELF_SPEC
+ * gcc/config/arm/arm.h Add ESP_DRIVER_SELF_SPEC and
+ ESP_EXTRA_SPECS
+ * gcc/config/mips/gnu-user.h Add ESP_DRIVER_SELF_SPEC
+ * gcc/config/mips/gnu-user64.h Add ESP_DRIVER_SELF_SPEC
+ * gcc/config/mips/mips.h Add ESP_EXTRA_SPECS
+ * gcc/config/ia64/linux.h Add ESP_DRIVER_SELF_SPECS
+ * gcc/config/ia64/ia64.h Add ESP_EXTRA_SPECS
+ * gcc/config/esp.h Bump for ESP_DRIVER_SELF_SPEC support
+
+0.5.4 Magnus Granberg <zorry@gentoo.org>
+
+ #436924
+ * configure.ac Add --enable-esp. Add -fno-stack-protector
+ to stage1_cflags.
+ * gcc/configure.ac Add --enable-esp and check if SSP works.
+ Define ENABLE_ESP ENABLE_ESP_SSP.
+ Check if we support crtbeginP and define ENABLE_CRTBEGINP.
+ * gcc/configure Fix a typo
+
+0.5.3 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/configure Clean up the checks and added
+ check for uclibc ssp support.
+ * gcc/config.in Add define for ENABLE_ESP_SSP
+ * gcc/esp.h Check for ENABLE_ESP_SSP
+
+0.5.2 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/common.opt Add -nopie
+
+0.5.1 Magnus Granberg <zorry@gentoo.org>
+
+ * configure Bumped for 4.7.0 release
+ * gcc/configure Bumped for 4.7.0 release and
+ added some checks.
+ * gcc/Makefile Bumped for 4.7.0 release
+ * gcc/gcc.c Bumped for 4.7.0 release
+ * libgcc/Makefile Bumped for 4.7.0 release
+
+0.5.0 Magnus Granberg <zorry@gentoo.org>
+
+ #393321
+ * gcc/Makefile.in Rename crtbeginTS.o to crtbeginP.o
+ * gcc/config/gnu-user.h Rename crtbeginTS.o to crtbeginP.o
+ * gcc/config/rs6000/sysv4.h Rename crtbeginTS.o to crtbeginP.o
+ * gcc/esp.h Rename crtbeginTS.o to crtbeginP.o
+ * gcc/configure Rename crtbeginTS.o to crtbeginP.o
+ * gcc/config.in Rename crtbeginTS.o to crtbeginP.o
+ * libgcc/Makefile.in Rename crtbeginTS.o to crtbeginP.o
+
+0.4.9 Magnus Granberg <zorry@gentoo.org>
+
+ #380823
+ * gcc/Makefile.in added ESP_NOPIE_CFLAGS to ALL_CXXFLAGS
+
+0.4.8 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/objc/lang-specs.h Bumped for gcc 4.6.0 release
+ * gcc/objcp/lang-specs.h Bumped for gcc 4.6.0 release
+ * gcc/cp/lang-specs.h Bumped for gcc 4.6.0 release
+
+0.4.7 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/gcc.c Add %(esp_options) and %(esp_cpp_options)
+ * gcc/esp.h Use the esp.h patch from gcc-4.4 patchset
+ * gcc/config/rs6000/linux64.h Bumed for >2011-02-26 snapshot
+ * gcc/objc/lang-specs.h Add %(esp_options)
+ * gcc/objcp/lang-specs.h Add %(esp_options)
+ * gcc/cp/lang-specs.h Add %(esp_options)
+ * gcc/config/gnu-user.h Add crtbeginTS.o support
+
+0.4.6 Magnus Granberg <zorry@gentoo.org>
+
+ * Makefile.in Bumped for gcc 4.6
+ * gcc/Makefile.in Bumped for gcc 4.6
+ added ESP_NOPIE_CFLAGS to ALL_CFLAGS
+ remove any ESP_NOSSP_CFLAGS
+ remove any ESP_NOPIE_CFLAGS from crt* when not needed
+ * gcc/gcc.c Bumped for gcc 4.6
+ moved espf_options_ssp to espf_command_options_spec
+ * gcc/esp.h Added espf_options_ssp to espf_cc1_command_spec
+ * gcc/config/rs6000/linux64.h Bumped for gcc 4.6
+ * gcc/config/linux.h Bumped for gcc 4.6
+
+0.4.5 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/rs6000/sysv4.h Fix a typo in the static spec rules
+
+0.4.4 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/esp.h Renamed ESP_CC1_STRICT_SPEC to ESP_CC1_STRICT_OVERFLOW_SPEC
+ Renamed ESP_OPTIONS_PIE_CHECK_SPEC to ESP_LINK_PIE_CHECK_SPEC
+
+0.4.3 Magnus Granberg <zorry@gentoo.org>
+
+ #299061 b.g.o
+ * gcc/gcc.c removed the pie incompatible specs rule call
+ * gcc/esp.h Move the -pie incompatible check to esp_link
+ remove the -shared incompatible check
+
+0.4.2 Magnus granberg <zorry@gentoo.org>
+
+ * configure remove the changes from 0.4.1
+ * Makefile.in remove the changes from 0.4.1 remove -fstack-protector check.
+ * gcc/configure remove the changes from 0.4.1
+ * gcc/config.in remove the changes from 0.4.1 remove HAVE_GCC_SSP
+ * gcc/Makefile remove the changes from 0.4.1
+ * gcc/esp.h change HAVE_GCC_LD_PIE to (EFAULT_PIE || EFAULT_PIE_SSP)
+ change HAVE_GCC_SSP to (EFAULT_SSP || EFAULT_PIE_SSP)
+ * libmudflap/Makefiles.in remove the changes from 0.4.1
+
+0.4.1 Magnus Granberg <zorry@gentoo.org>
+
+ *configure removed check for --enable-esp removed enable_esp
+ added check for --enable-esp=(no|all|nopie|nossp). added enable_esp_set
+ *Makefile.in renamed enable_esp to enable_esp_set
+ *gcc/configure removed check for --enable-esp removed enable_esp
+ added check for --enable-esp=(no|all|nopie|nossp). added enable_esp_set
+ added a -fPIE -pie check. change AC_COMPILE_IFELSE to AC_LINK_IFELSE in the
+ -fstack-protector check.
+ * gcc/config.in Added HAVE_GCC_LD_PIE
+ *gcc/Makefile.in renamed enable_esp to enable_esp_set
+ *gcc/esp.h Renamed HAVE_LD_PIE to HAVE_GCC_LD_PIE
+ Added HAVE_GCC_LD_PIE to #define ESP_CC1_PIE_SPEC. Move ESP_COMMAND_OPTIONS_SPEC
+ * libmudflap/Makefiles.in In enable_esp change ifeq to ifdef.
+
+ #293843 b.g.o
+ *gcc/esp.h Added -nonow to the -z now specs.
+
+0.4.0 Anthony G. Basile <basile@opensource.dyc.edu>
+
+ rename espf to esp and change espf-patchset to piepatchset
+
+0.3.9 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/configure Added check for TLS on the target in the SSP check.
+
+ #149292 b.g.o
+ * gcc/config/i386/linux.h Removed uclibc don't support TLS on stack-protector
+ * gcc/config/i386/linux64.h Removed uclibc don't support TLS on stack-protector
+ * gcc/config/rs6000/linux.h Removed uclibc don't support TLS on stack-protector
+ * gcc/config/i386/linux.h Removed uclibc don't support TLS on stack-protector
+ * gcc/config/sparc/linux.h Removed uclibc don't support TLS on stack-protector
+ * gcc/config/sparc/linux64.h Removed uclibc don't support TLS on stack-protector
+
+0.3.8 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/configure Redone the -fstack-protector check.
+ * gcc/config.in Added HAVE_GCC_SSP
+ * gcc/gcc.c Removed code for espf_link_spec in X
+ * gcc/espf.h Added ifdef HAVE_GCC_SSP, change code for espf_link_spec and link_pie_spec
+
+0.3.7_beta Anthony G. Basile <basile@opensource.dyc.edu>
+
+ * gcc/configure Check if -fstack-protector is supported by gcc on ARCH
+ Updated AC_SUBST enable_espf
+ * gcc/Makefile.in Remove the fix for $(out_object_file): ix86_split_to_parts() stack smashing attack b.g.o #149292.
+ * gcc/gcc.c Updaded the .c .cc compiler specs.
+
+0.3.6 Magnus Granberg <zorry@ume.nu>
+
+ * configure Check --enable-espf change ppc* to powerpc*, powerpc64 and add ia64.
+ * gcc/configure Don't check for -z,relro on ia64. Disable crtbeginTS for ia64.
+ * gcc/espf.h ia64 don't support -fstack-protector*
+
+0.3.5 Maguns Granberg <zorry@ume.nu>
+
+ * gcc/espf.h Change the specs for crtbegin.TS.o.
+ * gcc/gcc.c Rename espf_cc1_options to espf_options_pie_check.
+ * gcc/config/linux.h Fix typos ENABLE_CRTBEGINS to ENABLE_CRTBEGINTS
+ * gcc/config/rs6000/linux64.h ASM_SPEC32: %{fpic:-K PIC} %{fPIC:-K PIC} to
+ %{fpic|fPIC|fpie|fPIE:-K PIC}
+
+0.3.4 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/configure Add crtbeginTS.o support.
+ * gcc/Makefile.in Add crtbeginTS.o support.
+ * gcc/gcc.c Add espf_cc1_options.
+ * gcc/espf.h Added espf_cc1_options, crtbeginTS.o support,
+ espf_cc1_options and espf_cc1_strictoverflow.
+ * gcc/config.in Add crtbeginTS.o support.
+ * gcc/config/linux.h Add crtbeginTS.o support.
+ * gcc/config/rs6000/sysv4.h Add crtbeginTS.o support.
+ * gcc/doc/invoke.texi Add NOTES about -fstack-protector-all,
+ -pie and -fPIE.
+ * libgcc/Makefile.in Add crtbeginTS.o support.
+
+0.3.3 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/opts.c change #ifdef ENABLE_ESPF to #ifndef ENABLE_ESPF
+
+0.3.2 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/opts.c disable flag_delete_null_pointer_checks >= -O2
+ * gcc/espf.h add ESPF_CC1_SSP_SPEC and ESPF_CC1_PIE_SPEC to fix bugs on -vanilla spec
+
+ #149292 b.g.o
+ * gcc/config/i386/linux.h uclibc don't support TLS on stack-protector
+ * gcc/config/i386/linux64.h uclibc don't support TLS on stack-protector
+ * gcc/config/rs6000/linux.h uclibc don't support TLS on stack-protector
+ * gcc/config/i386/linux.h uclibc don't support TLS on stack-protector
+ * gcc/config/sparc/linux.h uclibc don't support TLS on stack-protector
+ * gcc/config/sparc/linux64.h uclibc don't support TLS on stack-protector
+
+0.3.1 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/cp/Make-lang.in cc1plus: pch test fail when cc1plus is compile with -fPIE.
+ * gcc/configure fix --enable-espf when USE"-hardened"
+
+4.4.1-espf-0.3.0 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/espf.h add ESPF_LINK_SPEC ESPF_LINK_NOW_SPEC
+ * gcc/gcc.c move do_self_spec (espf_command_options_spec)
+ do_spec_1() add espf_link_spec
+
+0.3.0 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/objc/lang-specs.h Add %(espf_options)
+ * gcc/objcp/lang-specs.h Add %(espf_options)
+ * gcc/cp/lang-specs.h Add %(espf_options)
+ * gcc/config.in removed ENABLE_LIBSSP
+ * Makefile.in We add -fno-stack-protector to
+ BOOT_CFLAGS, LIBCFLAGS and LIBCXXFLAGS
+ cc1: pch.exp test fail when cc1 is compile with -fPIE
+ * libmudflap/Makefiles.in Add -fno-stack-protector -U_FORTIFY_SOURCE
+ to AM_CFLAGS
+ * configure add --enable-espf
+ add -fno-stack-protector to stage1_cflags
+ add targes ppc* arm sparc*
+ * gcc/configure change code for check --enable-espf
+ * libmudflap/configure add enable_espf
+ * gcc/espf.h ESPF_CC1_OPTIONS_SPEC renamed to ESPF_OPTIONS_SPEC
+ add ESPF_CPP_OPTIONS_SPEC ESPF_COMMAND_OPTIONS_SPEC
+ ESPF_CC1_OPTIONS_SSP_SPEC renamed to ESPF_OPTIONS_SSP_SPEC
+ ESPF_COMPILER_COMMAND_PIE_SPEC renamed to ESPF_OPTIONS_PIE_SPEC
+ ESPF_LINK_COMMAND_PIE_SPEC renamed to ESPF_LINK_PIE_SPEC
+ add !p !pg to ESPF_LINK_PIE_SPEC
+ removed ESPF_LINK_SPEC ESPF_CC1_OPTIONS_PIE_INCOMPATIBLE_SPEC
+ * gcc/gcc.c cpp_options add %(espf_cpp_options)
+ compiler spec add %(espf_options)
+ change code for ESPF_EXTRA_SPECS
+ process_command(): Check for lazy, or now
+ do_spec_1(): Add -z now and -z relro
+ main() add do_self_spec (espf_command_options_spec)
+ removed do_self_spec (espf_cc1_command_spec) do_self_spec (espf_link_command_spec)
+
+0.2.9 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/espf.h add ESPF_COMPILER_COMMAND_PIE_SPEC
+ add ESPF_LINK_COMMAND_PIE_SPEC
+ change ESPF_COMPILER_COMMAND_SPEC ESPF_LINK_COMMAND_SPEC
+
+0.2.8 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/configure removed check crtbeginTS.o
+ * gcc/espf.h added notes
+ add ESPF_CC1_SPEC
+ removed ESPF_CPP_UNIQUE_OPTIONS espf_override_options()
+ * gcc/gcc.c cc1_spec Set it to CC1_SPEC if ! ENABLE_ESPF
+ * gcc/toplev.c removed ESPF_OVERRIDE_OPTIONS
+
+0.2.7 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/opts.c (decode_options): Remove flag_strict_overflow as opt2
+ * gcc/config.in removed HAVE_CRTBEGINTS
+ * gcc/Makefile removed crtbeginTS.o
+ * libgcc/Makefile.in removed crtbeginTS.o
+ * gcc/config/i386/i386.h removed espf_override_options ESPF_EXTRA_SPECS
+ * gcc/config/linux.h remoevd crtbeginTS.o
+ * gcc/espf.h ESPF_CC1_OPTIONS_PIE_SPEC renamed to ESPF_CC1_COMMAND_SPEC
+ * gcc/gcc.c add ESPF_EXTRA_SPECS
+ main() add do_self_spec (espf_cc1_command_spec)
+
+0.2.6 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/config/i386/i386.h add espf_override_options() to OVERRIDE_OPTIONS
+ * gcc/espf.h add espf_override_options()
+ * gcc/toplev.c add ESPF_OVERRIDE_OPTIONS
+
+0.2.5 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/config/i386/i386.h removed espf_cc1
+ * gcc/config/i386/linux.h removed espf_cc1 %(crtend_gen)
+ * gcc/config/i386/x86-64.h removed espf_cc1 %(crtend_gen)
+ * gcc/config/linux.h removed espf_cc1 %(crtfile_gen)
+ %(crtbegin_t_gen) %(crtend_gen)
+ add crtbeginTS.o
+ * gcc/config.in removed TARGET_LIBC_PROVIDES_PIE
+ add HAVE_CRTBEGINTS
+ * gcc/Makefile.in add ESPF_NOPIE_CFLAGS ESPF_NOSSP_CFLAGS to
+ CRTSTUFF_T_CFLAGS
+ add ESPF_NOSSP_CFLAGS to CRTSTUFF_T_CFLAGS_S
+ * espf.h ESPF_CC1_SPEC renamed to ESPF_CC1_OPTIONS_SPEC
+ add ESPF_LINK_SPEC
+ ESPF_CC1_SSP_SPEC renamed to ESPF_CC1_OPTIONS_SSP_SPEC
+ ESPF_CC1_PIE_SPEC renamed to ESPF_CC1_OPTIONS_PIE_SPEC
+ ESPF_CC1_OPTIONS_SPEC renamed to ESPF_CC1_OPTIONS_PIE_INCOMPATIBLE_SPEC
+ LINK_PIE_SPEC renamed to ESPF_LINK_COMMAND_SPEC
+ removed ESPF_CC1_STRICT_SPEC CRTFILE_GEN_SPEC CRTBEGIN_GEN_SPEC
+ CRTBEGIN_T_GEN_SPEC CRTEND_GEN_SPEC
+ * gcc/configure remove TARGET_LIBC_PROVIDES_PIE
+ define HAVE_CRTBEGINTS
+ * gcc/gcc.c LINK_COMMAND_SPEC add %(espf_link)
+ main() add do_self_spec (espf_link_command_spec)
+
+0.2.4 Magnus Granberg <zorry@ume.nu>
+
+ libgcc/Makefile.in clean specs
+
+0.2.3 Magnus Granberg <zorry@ume.nu>
+
+ *gcc/espf.h add ESPF_CC1_STRICT_SPEC
+
+0.2.2 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/config/i386/i386.h Add espf_cc1
+ Add ESPF_EXTRA_SPECS
+ * gcc/config/i386/linux.h Add espf_cc1
+ * gcc/config/i386/x86-64.h Add espf_cc1
+ * gcc/config/linux.h Add espf_cc1
+ * gcc/Makefile.in add crtbeginTS.o to EXTRA_PARTS list
+ * libgcc/Makefile.in add crtbeginTS.o to EXTRA_PARTS list
+ * gcc/configure add define ENABLE_LIBSSP
+ * gcc/gcc.c %(fortify_default) renamed to %(espf_cpp_unique_options)
+ %(pie_incompatible) renamed to %(espf_cc1_options)
+ removed ESPF_EXTRA_SPECS
+ * gcc/espf.h ESPF_DEFAULT_SPEC renamed to ESPF_CC1_SPEC
+ SSP_DEFAULT_SPEC renamed to ESPF_CC1_SSP_SPEC
+ FORTIFY_DEFAULT_SPEC renamed to ESPF_CPP_UNIQUE_OPTIONS
+ PIE_DEFAULT_SPEC renamed to ESPF_CC1_PIE_SPEC
+ PIE_INCOMPATIBLE_SPEC renamed to ESPF_CC1_OPTIONS_SPEC
+ add new CRTFILE_GEN_SPEC CRTBEGIN_T_GEN_SPEC CRTEND_GEN_SPEC if !
+ TARGET_LIBC_PROVIDES_PIE
+
+4.4.0-espf-0.2.1 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/gcc.c include: espf.h
+ cc1_spec = CC1_SPEC if not ENABLE_ESPF
+ cpp_unique_options add %(fortify_default)
+ cc1_options add %(pie_incompatible)
+ EXTRA_SPECS add ESPF_EXTRA_SPECS
+ * libgcc/Makefile.in add crtbeginTs.o
+ gcc/Makefile.in add ESPF_NOPIE_CFLAGS and ESPF_NOSSP_CFLAGS
+ LIBGCC2_CFLAGS add ESPF_NOSSP_CFLAGS
+ CRTSTUFF_CFLAGS add ESPF_NOPIE_CFLAGS and ESPF_NOSSP_CFLAGS
+ crtbegin* add crtbeginTS
+ $(out_object_file): ix86_split_to_parts() stack smashing attack b.g.o #149292
+ * libgcc/configure add enable_espf
+ * gcc/config/linux.h add %(crtfile_gen) %(crtbegin_t_gen) %(crtend_gen)
+ * gcc/config/i386/linux.h add %(crtend_gen)
+ * gcc/config/i386/linux64.h add %(crtend_gen)
+ * gcc/config.gcc extra_parts add crtbeginTS.o
+ * libgcc/config.host extra_parts add crtbeginTS.o
+ * gcc/configure check -z relro
+ check -z now
+ check FORTIFY_SOURCES level 2
+ check Scrt1.o
+ check --enable-espf
+ check crtbeginTS.o
+ * gcc/espf.h new file
+ * gcc/varasm.c (decl_tls_model): Check flag_pic instead of flag_shlib
+ * gcc/config.in add ENABLE_LIBSSP
+ add ENABLE_ESPF
+ add TARGET_LIBC_PROVIDES_FORTIFY2
+ add TARGET_LIBC_PROVIDES_PIE
+ * configure define ENABLE_LIBSSP
+
+gcc-4.3.3-piepatches-v10.2.1
diff --git a/4.8.1/pie/README.Gentoo.patches b/4.8.1/pie/README.Gentoo.patches
new file mode 100644
index 0000000..db43079
--- /dev/null
+++ b/4.8.1/pie/README.Gentoo.patches
@@ -0,0 +1,28 @@
+ ================
+ === W[hat]TF ===
+ ================
+
+Gentoo patchsets that have grown too large to keep on the rsync mirrors have
+been moved to our git tree. From there, we bundle up all the whee little
+patches into a tarball and distribute it via our public mirroring system.
+
+If you want specific info about a patch (like wtf it does or whose great idea
+it was to change the code), read the patch ! We try to fill out the top of
+them with useful info such as what it does, why it's needed, bug reports,
+original creators, etc... For simple patches, we reserve the right to assume
+your IQ is greater than absolute 0 and figure out what it does w/out an
+explanation. If, by some miracle of science, it falls below the absolute 0
+mark, you should help mankind by finding some scientists and letting them
+probe you with their ... erm ... probes.
+
+ =================
+ === W[here]TF ===
+ =================
+
+For those with git access
+git://git.overlays.gentoo.org/proj/hardened-gccpatchset.git
+
+For those w/out git access, this URL should help you:
+http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-gccpatchset.git;a=summary
+
+It should be pretty easy to find your way around, you're a big boy after all.
diff --git a/4.8.1/pie/README.history b/4.8.1/pie/README.history
new file mode 100644
index 0000000..fd07898
--- /dev/null
+++ b/4.8.1/pie/README.history
@@ -0,0 +1,319 @@
+0.5.6 03 Jun 2013
+ U 35_all_gcc48_config_arm.patches
+ U 37_all_gcc48_config_ia64.patch
+0.5.5 31 Mar 2013
+ - 01_all_gcc47_configure.patch
+ + 01_all_gcc48_configure.patch
+ - 02_all_gcc47_config.in.patch
+ + 02_all_gcc48_config.in.patch
+ - 03_all_gcc47_Makefile.in.patch
+ + 03_all_gcc48_Makefile.in.patch
+ - 05_all_gcc47_gcc.c.patch
+ - 05_all_gcc48_gcc.c.patch
+ - 33_all_gcc46_config_rs6000_linux64.h.patch
+ + 33_all_gcc48_config_rs6000.patch
+ - 34_all_gcc47_config_all_gnu_user.patch
+ + 34_all_gcc48_config_i386.patch
+ + 35_all_gcc48_config_arm.patch
+ + 36_all_gcc48_config_mips.patch
+ + 37_all_gcc48_config_ia64.patch
+ - 35_all_gcc47_config_esp.h.patch
+ - 35_all_gcc48_config_esp.h.patch
+ U README
+0.5.4 02 Oct 2012
+ U 01_all_gcc47_configure.patch
+ + 01_all_gcc47_configure.ac.patch
+0.5.3 06 Apr 2012
+ U 01_all_gcc47_configure.patch
+ + 02_all_gcc47_config.in.patch
+ - 02_all_gcc45_config.in.patch
+ + 06_all_gcc46_esp.h.patch
+ - 06_all_gcc45_esp.h.patch
+0.5.2 24 Jan 2012
+ + 16_all_gcc47_nopie_option.patch
+0.5.1 17 Jan 2012
+ + 01_all_gcc47_configure.patch
+ - 10_all_gcc45_configure.patch
+ + 03_all_gcc47_Makefile.in.patch
+ - 12_all_gcc46_Makefile.in.patch
+ + 02_all_gcc45_config.in.patch
+ - 11_all_gcc45_config.in.patch
+ + 05_all_gcc46_gcc.c.patch
+ - 20_all_gcc46_gcc.c.patch
+ + 06_all_gcc45_esp.h.patch
+ - 30_all_gcc45_esp.h.patch
+ + 10_all_gcc46_default-ssp.patch
+ - 22_all_gcc46-default-ssp.patch
+ + 15_all_gcc44_decl-tls-model.patch
+ - 21_all_gcc44_decl-tls-model.patch
+ + 20_all_gcc46_config_crtbeginp.patch
+ - 35_all_gcc46_config_crtbegints.patch
+ + 24_all_gcc44_invoke.texi.patch
+ + 60_all_gcc44_invoke.texi.patch
+0.5.0 07 Dec 2011
+ + 35_all_gcc46_config_crtbeginp.patch
+ - 35_all_gcc46_config_crtbegints.patch
+ U 10_all_gcc45_configure.patch
+ U 12_all_gcc46_Makefile.in.patch
+ + 11_all_gcc45_config.in.patch
+ - 11_all_gcc44_config.in.patch
+ + 30_all_gcc45_esp.h.patch
+ - 30_all_gcc44_esp.h.patch
+0.4.9 09 Nov 2011
+ U 12_all_gcc46_Makefile.in.patch
+0.4.8 26 Mar 2011
+ U 22_all_gcc46-default-ssp.patch
+0.4.7 05 Mar 2011
+ U 20_all_gcc46_gcc.c.patch
+ + 22_all_gcc46-default-ssp.patch
+ - 30_all_gcc46_esp.h.patch
+ + 30_all_gcc44_esp.h.patch
+ U 33_all_gcc46_config_rs6000_linux64.h.patch
+ U 35_all_gcc46_config_crtbegints.patch
+0.4.6 07 Jan 2011
+ + 12_all_gcc46_Makefile.in.patch
+ - 12_all_gcc44_Makefile.in.patch
+ + 20_all_gcc46_gcc.c.patch
+ - 20_all_gcc44_gcc.c.patch
+ + 30_all_gcc46_esp.h.patch
+ - 30_all_gcc44_esp.h.patch
+ + 33_all_gcc46_config_rs6000_linux64.h.patch
+ - 33_all_gcc45_config_rs6000_linux64.h.patch
+ + 35_all_gcc46_config_crtbegints.patch
+ - 35_all_gcc44_config_crtbegints.patch
+ - 40_all_gcc44_obj_lang-specs.h.patch
+ - 40_all_gcc44_objp_lang-specs.h.patch
+ - 40_all_gcc44_cp_lang-specs.h.patch
+0.4.5 18 Jun 2010
+ U 35_all_gcc44_config_crtbegints.patch
+0.4.4 26 May 2010
+ U 30_all_gcc44_esp.h.patch
+0.4.3 26 May 2010
+ U 20_all_gcc44_gcc.c.patch
+ U 30_all_gcc44_esp.h.patch
+0.4.2 24 May 2010
+ U 10_all_gcc44_configure.patch
+ U 12_all_gcc44_Makefile.in.patch
+ U 11_all_gcc44_config.in.patch
+ U 30_all_gcc44_esp.h.patch
+0.4.1 29 Apr 2010
+ U 10_all_gcc45_configure.patch
+ U 12_all_gcc45_Makefile.in.patch
+ U 11_all_gcc44_config.in.patch
+ U 30_all_gcc44_esp.h.patch
+
+0.4.0 19 Apr 2010
+ U 10_all_gcc45_configure.patch
+ U 12_all_gcc45_Makefile.in.patch
+ U 11_all_gcc44_config.in.patch
+ U 20_all_gcc45_gcc.c.patch
+ - 30_all_gcc44_espf.h.patch
+ + 30_all_gcc44_esp.h.patch
+
+0.3.9 14 Apr 2010
+ U 10_all_gcc45_configure.patch
+ - 50_all_gcc44_no_ssp_tls_uclibc.patch
+ U 33_all_gcc45_config_rs6000_linux64.h.patch
+
+0.3.8 10 Apr 2010
+ 10_all_gcc44_configure.patch
+ 11_all_gcc44_config.in.patch
+ 20_all_gcc44_gcc.c.patch
+ 30_all_gcc44_espf.h.patch
+
+0.3.7 10 Feb 2010
+ 20_all_gcc44_gcc.c.patch
+ 30_all_gcc44_espf.h.patch
+ 10_all_gcc44_configure.patch
+
+0.3.6 23 Dec 2009
+ - 10_all_gcc44_configure.patch
+ + 10_all_gcc44_configure.patch
+ - 30_all_gcc44_espf.h.patch
+ + 30_all_gcc44_espf.h.patch
+ - README.Changelog
+ + README.Changelog
+ - README.history
+ + README.history
+ - README
+ + README
+
+0.3.5 24 Sep 2009
+ - 30_all_gcc44_espf.h.patch
+ + 30_all_gcc44_espf.h.patch
+ - 35_all_gcc44_config_crtbegints.patch
+ + 35_all_gcc44_config_crtbegints.patch
+ + 33_all_gcc44_config_rs6000_linux64.h.patch
+ - README.Changelog
+ + README.Changelog
+ - README.history
+ + README.history
+ + README.Gentoo.patches
+
+0.3.4 11 Sep 2009
+ - 10_all_gcc44_configure.patch
+ + 10_all_gcc44_configure.patch
+ - 11_all_gcc44_config.in.patch
+ + 11_all_gcc44_config.in.patch
+ - 12_all_gcc44_Makefile.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+ - 20_all_gcc44_gcc.c.patch
+ + 20_all_gcc44_gcc.c.patch
+ - 23_all_gcc44_opts.c.patch
+ - 30_all_gcc44_espf.h.patch
+ + 30_all_gcc44_espf.h.patch
+ + 35_all_gcc44_config_crtbegints.patch
+ + 60_all_gcc44_invoke.texi.patch
+ - README.Changelog
+ + README.Changelog
+ - README.history
+ + README.history
+ - README
+ + README
+
+0.3.3 14 Aug 2009
+ - 23_all_gcc44_opts.c.patch
+ + 23_all_gcc44_opts.c.patch
+
+0.3.2 09 Aug 2009
+ + 50_all_gcc44_no_ssp_tls_uclibc.patch
+ + README.Changelog
+ + README.history
+ - 23_all_gcc44_opts.c.patch
+ + 23_all_gcc44_opts.c.patch
+ - 30_all_gcc44-espf.h.patch
+ + 30_all_gcc44-espf.h.patch
+
+0.3.1 23 Jul 2009
+ - 10_all_gcc44_configure.patch
+ + 10_all_gcc44_configure.patch
+
+0.3.0 23 Jul 2009
+ - 10_all_gcc44_configure.patch
+ + 10_all_gcc44_configure.patch
+ - 11_all_gcc44_config.in.patch
+ + 11_all_gcc44_config.in.patch
+ - 12_all_gcc44_Makefile.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+ - 20_all_gcc44_gcc.c.patch
+ + 20_all_gcc44_gcc.c.patch
+ + 40_all_gcc44_obj_lang-specs.h.patch
+ + 40_all_gcc44_objp_lang-specs.h.patch
+ + 40_all_gcc44_cp_lang-specs.h.patch
+ - 50_all_gcc44_gentoo_v20090614.1.patch
+ - 30_all_gcc44-espf.h.patch
+ + 30_all_gcc44-espf.h.patch
+
+0.2.9 14 Jun 2009
+ - 12_all_gcc44_Makefile.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+ - 30_all_gcc44-espf.h.patch
+ + 30_all_gcc44-espf.h.patch
+ - 50_all_gcc44_gentoo_v20090612.2.patch
+ + 50_all_gcc44_gentoo_v20090614.1.patch
+
+0.2.8 12 Jun 2009
+ - 10_all_gcc44_configure.patch
+ + 10_all_gcc44_configure.patch
+ - 11_all_gcc44_config.in.patch
+ + 11_all_gcc44_config.in.patch
+ - 12_all_gcc44_Makefile.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+ - 22_all_gcc44-toplev.c.patch
+ - 25_all_gcc44-espf.h.patch
+ + 30_all_gcc44-espf.h.patch
+ + 50_all_gcc44_gentoo_v20090612.2.patch
+
+0.2.7 29 May 2009
+ - 11_all_gcc44_config.in.patch
+ + 11_all_gcc44_config.in.patch
+ - 12_all_gcc44_Makefile.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+ - 20_all_gcc44_gcc.c.patch
+ + 20_all_gcc44_gcc.c.patch
+ + 23_all_gcc44_opts.c.patch
+ - 25_all_gcc44-espf.h.patch
+ + 25_all_gcc44-espf.h.patch
+ - 30_all_gcc44-config-defaul-linux.patch
+
+0.2.6 28 May 2009
+ + 22_all_gcc44-toplev.c.patch
+ - 25_all_gcc44-espf.h.patch
+ + 25_all_gcc44-espf.h.patch
+ - 30_all_gcc44-config-defaul-linux.patch
+ + 30_all_gcc44-config-defaul-linux.patch
+
+0.2.5 27 May 2009
+ - 10_all_gcc44_configure.patch
+ + 10_all_gcc44_configure.patch
+ - 12_all_gcc44_Makefile.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+ - 20_all_gcc44_gcc.c.patch
+ + 20_all_gcc44_gcc.c.patch
+ - 25_all_gcc44-espf.h.patch
+ + 25_all_gcc44-espf.h.patch
+ - 30_all_gcc44-config-defaul-linux.patch
+ + 30_all_gcc44-config-defaul-linux.patch
+ - 40_all_gcc44-gentoo.patch
+
+0.2.4 08 May 2009
+ - 12_all_gcc44_Makefile.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+
+0.2.3 08 May 2009
+ - 20_all_gcc44_gcc.c.patch
+ + 20_all_gcc44_gcc.c.patch
+ - 40_all_gcc44-gentoo.patch
+ + 40_all_gcc44-gentoo.patch
+
+0.2.2 04 May 2009
+ + 10_all_gcc44_configure.patch
+ + 11_all_gcc44_config.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+ + 20_all_gcc44_gcc.c.patch
+ + 21_all_gcc44_decl-tls-model.patch
+ + 25_all_gcc44-espf.h.patch
+ + 30_all_gcc44-config-defaul-linux.patch
+ + 40_all_gcc44-gentoo.patch
+ - 01_all_gcc44-configure.patch
+ - 10_all_gcc44-gcc_configure.patch
+ - 11_all_gcc44-gcc_config.in.patch
+ - 12_all_gcc44-gcc_config.gcc.patch
+ - 13_all_gcc44-gcc_Makefile.in.patch
+ - 15_all_gcc44-libgcc_config.host.patch
+ - 16_all_gcc44-libgcc_configure.patch
+ - 17_all_gcc44-libgcc_Makefile.in.patch
+ - 21_all_gcc44-gcc_espf.h.patch
+ - 22_all_gcc44-gcc_gcc.c.patch
+ - 23_all_gcc44-gcc_varasm.c.patch
+ - 30_all_gcc44-add-crt-start-endfiles-linux.patch
+
+0.2.1 28 Apr 2009
+ + 01_all_gcc44-configure.patch
+ + 10_all_gcc44-gcc_configure.patch
+ + 11_all_gcc44-gcc_config.in.patch
+ + 12_all_gcc44-gcc_config.gcc.patch
+ + 13_all_gcc44-gcc_Makefile.in.patch
+ + 15_all_gcc44-libgcc_config.host.patch
+ + 16_all_gcc44-libgcc_configure.patch
+ + 17_all_gcc44-libgcc_Makefile.in.patch
+ + 21_all_gcc44-gcc_espf.h.patch
+ + 22_all_gcc44-gcc_gcc.c.patch
+ + 23_all_gcc44-gcc_varasm.c.patch
+ + 30_all_gcc44-add-crt-start-endfiles-linux.patch
+ - 00_all_gcc4.4-cvs-incompat.patch
+ - 05_all_gcc4.4-compile-no-ssp.patch
+ - 10_all_gcc4.4-hardened-minispecs-support.patch
+ - 11_all_gcc4.4-decl-tls-model.patch
+ - 12_all_gcc4.4-fortify-minispecs-support.patch
+ - 20-all_gcc4.4-default-crt-start-endfile.patch
+ - 30-all_gcc4.4-crtbeginTS-fno-PIE.patch
+
+0.1.0 16 Apr 2009
+ + 00_all_gcc4.4-cvs-incompat.patch
+ + 05_all_gcc4.4-compile-no-ssp.patch
+ + 10_all_gcc4.4-hardened-minispecs-support.patch
+ + 11_all_gcc4.4-decl-tls-model.patch
+ + 12_all_gcc4.4-fortify-minispecs-support.patch
+ + 20-all_gcc4.4-default-crt-start-endfile.patch
+ + 30-all_gcc4.4-crtbeginTS-fno-PIE.patch
diff --git a/4.8.1/uclibc/90_all_100-uclibc-conf.patch b/4.8.1/uclibc/90_all_100-uclibc-conf.patch
new file mode 100644
index 0000000..cca8c82
--- /dev/null
+++ b/4.8.1/uclibc/90_all_100-uclibc-conf.patch
@@ -0,0 +1,33 @@
+--- gcc/gcc/config/--- gcc/contrib/regression/objs-gcc.sh
++++ gcc/contrib/regression/objs-gcc.sh
+@@ -105,6 +105,10 @@
+ then
+ make all-gdb all-dejagnu all-ld || exit 1
+ make install-gdb install-dejagnu install-ld || exit 1
++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
++ then
++ make all-gdb all-dejagnu all-ld || exit 1
++ make install-gdb install-dejagnu install-ld || exit 1
+ elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
+ make bootstrap || exit 1
+ make install || exit 1
+--- gcc/libjava/classpath/ltconfig
++++ gcc/libjava/classpath/ltconfig
+@@ -603,7 +603,7 @@
+
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
+-linux-gnu*) ;;
++linux-gnu*|linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+
+@@ -1251,7 +1251,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
diff --git a/4.8.1/uclibc/90_all_301-missing-execinfo_h.patch b/4.8.1/uclibc/90_all_301-missing-execinfo_h.patch
new file mode 100644
index 0000000..0e2092f
--- /dev/null
+++ b/4.8.1/uclibc/90_all_301-missing-execinfo_h.patch
@@ -0,0 +1,11 @@
+--- gcc-4.0.0/boehm-gc/include/gc.h-orig 2005-04-28 22:28:57.000000000 -0500
++++ gcc-4.0.0/boehm-gc/include/gc.h 2005-04-28 22:30:38.000000000 -0500
+@@ -500,7 +500,7 @@
+ #ifdef __linux__
+ # include <features.h>
+ # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
+- && !defined(__ia64__)
++ && !defined(__ia64__) && !defined(__UCLIBC__)
+ # ifndef GC_HAVE_BUILTIN_BACKTRACE
+ # define GC_HAVE_BUILTIN_BACKTRACE
+ # endif
diff --git a/4.8.1/uclibc/90_all_302-c99-snprintf.patch b/4.8.1/uclibc/90_all_302-c99-snprintf.patch
new file mode 100644
index 0000000..ba51a0e
--- /dev/null
+++ b/4.8.1/uclibc/90_all_302-c99-snprintf.patch
@@ -0,0 +1,13 @@
+Index: gcc-4.3.0/libstdc++-v3/include/c_global/cstdio
+===================================================================
+--- gcc-4.3.0/libstdc++-v3/include/c_global/cstdio (revision 129202)
++++ gcc-4.3.0/libstdc++-v3/include/c_global/cstdio (working copy)
+@@ -144,7 +144,7 @@
+
+ _GLIBCXX_END_NAMESPACE
+
+-#if _GLIBCXX_USE_C99
++#if _GLIBCXX_USE_C99 || defined __UCLIBC__
+
+ #undef snprintf
+ #undef vfscanf
diff --git a/4.8.1/uclibc/90_all_305-libmudflap-susv3-legacy.patch b/4.8.1/uclibc/90_all_305-libmudflap-susv3-legacy.patch
new file mode 100644
index 0000000..374b1f8
--- /dev/null
+++ b/4.8.1/uclibc/90_all_305-libmudflap-susv3-legacy.patch
@@ -0,0 +1,49 @@
+Index: gcc-4.2/libmudflap/mf-hooks2.c
+===================================================================
+--- gcc-4.2/libmudflap/mf-hooks2.c (revision 119834)
++++ gcc-4.2/libmudflap/mf-hooks2.c (working copy)
+@@ -427,7 +427,7 @@
+ {
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
+- bzero (s, n);
++ memset (s, 0, n);
+ }
+
+
+@@ -437,7 +437,7 @@
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
+ MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
+- bcopy (src, dest, n);
++ memmove (dest, src, n);
+ }
+
+
+@@ -447,7 +447,7 @@
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
+ MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
+- return bcmp (s1, s2, n);
++ return n == 0 ? 0 : memcmp (s1, s2, n);
+ }
+
+
+@@ -456,7 +456,7 @@
+ size_t n = strlen (s);
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
+- return index (s, c);
++ return strchr (s, c);
+ }
+
+
+@@ -465,7 +465,7 @@
+ size_t n = strlen (s);
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
+- return rindex (s, c);
++ return strrchr (s, c);
+ }
+
+ /* XXX: stpcpy, memccpy */