aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Granberg <zorry@gentoo.org>2011-01-07 03:48:33 +0100
committerMagnus Granberg <zorry@gentoo.org>2011-01-07 03:48:33 +0100
commitd4b686cb565fcaa1ea3bc2cdf7ab90f7735705fc (patch)
treebfb00eb387374373ee633f00c00b824fbc79e450
parentadded the start of gcc-4.6.0 patchset (diff)
downloadhardened-gccpatchset-d4b686cb565fcaa1ea3bc2cdf7ab90f7735705fc.tar.gz
hardened-gccpatchset-d4b686cb565fcaa1ea3bc2cdf7ab90f7735705fc.tar.bz2
hardened-gccpatchset-d4b686cb565fcaa1ea3bc2cdf7ab90f7735705fc.zip
commited piepatchset 0.4.6 for gcc-4.6
-rw-r--r--gcc-4.6.0/piepatch/12_all_gcc46_Makefile.in.patch151
-rw-r--r--gcc-4.6.0/piepatch/20_all_gcc46_gcc.c.patch84
-rw-r--r--gcc-4.6.0/piepatch/30_all_gcc46_esp.h.patch154
-rw-r--r--gcc-4.6.0/piepatch/33_all_gcc46_config_rs6000_linux64.h.patch16
-rw-r--r--gcc-4.6.0/piepatch/35_all_gcc46_config_crtbegints.patch36
-rw-r--r--gcc-4.6.0/piepatch/README.Changelog13
-rw-r--r--gcc-4.6.0/piepatch/README.history14
7 files changed, 468 insertions, 0 deletions
diff --git a/gcc-4.6.0/piepatch/12_all_gcc46_Makefile.in.patch b/gcc-4.6.0/piepatch/12_all_gcc46_Makefile.in.patch
new file mode 100644
index 0000000..b17c0be
--- /dev/null
+++ b/gcc-4.6.0/piepatch/12_all_gcc46_Makefile.in.patch
@@ -0,0 +1,151 @@
+2011-01-01 Magnus Granberg <zorry@gentoo.org> Anthony G. Basile <basile@opensource.dyc.edu>
+
+ * Makefile.in We add -fno-stack-protector to BOOT_CFLAGS, LIBCFLAGS and LIBCXXFLAGS if enable_esp yes.
+ * gcc/Makefile.in Add -fno-PIE. to CRTSTUFF_CFLAGS and ALL_CFLAGS if enable_esp yes
+ Add crtbeginTS.o to EXTRA_PARTS if enable_crtbeginTS yes
+ We add new file crtbeginTS.o if enable_crtbeginTS yes
+ * libgcc/Makefile.in Add crtbeginTS.o to EXTRA_PARTS if enable_crtbeginTS yes
+ We add new file crtbeginTS.o if enable_crtbeginTS yes
+
+--- Makefile.in 2010-01-22 08:35:38.000000000 -0500
++++ 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 =
+--- gcc/Makefile.in 2010-01-22 17:22:51.000000000 -0500
++++ gcc/Makefile.in 2010-02-07 15:15:13.000000000 -0500
+@@ -642,6 +642,14 @@
+ INHIBIT_LIBC_CFLAGS = -Dinhibit_libc
+ endif
+
++# We don't want to compile the compiler with -fPIE.
++enable_esp = @enable_esp@
++ifeq ($(enable_esp),yes)
++ESP_NOPIE_CFLAGS = -fno-PIE
++else
++ESP_NOPIE_CFLAGS=
++endif
++
+ # Options to use when compiling libgcc2.a.
+ #
+ LIBGCC2_DEBUG_CFLAGS = -g
+@@ -662,7 +670,7 @@
+ 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)
+
+ # Additional sources to handle exceptions; overridden by targets as needed.
+@@ -678,6 +689,12 @@
+ # The rules for compiling them should be in the t-* file for the machine.
+ EXTRA_PARTS = @extra_parts@
+
++# We add crtbeginTS.o to the EXTRA_PARTS list if enable_crtbeginTS = yes
++enable_crtbeginTS = @enable_crtbeginTS@
++ifeq ($(enable_crtbeginTS),yes)
++EXTRA_PARTS += crtbeginTS.o
++endif
++
+ # List of extra object files that should be compiled and linked with
+ # compiler proper (cc1, cc1obj, cc1plus).
+ EXTRA_OBJS = @extra_objs@
+@@ -998,7 +1006,7 @@
+
+ # 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.
+@@ -1856,9 +1873,10 @@
+ echo LIBGCC_SYNC = '$(LIBGCC_SYNC)' >> tmp-libgcc.mvars
+ echo LIBGCC_SYNC_CFLAGS = '$(LIBGCC_SYNC_CFLAGS)' >> tmp-libgcc.mvars
+ echo CRTSTUFF_CFLAGS = '$(CRTSTUFF_CFLAGS)' >> tmp-libgcc.mvars
+- echo CRTSTUFF_T_CFLAGS = '$(CRTSTUFF_T_CFLAGS)' >> tmp-libgcc.mvars
++ echo CRTSTUFF_T_CFLAGS = '$(CRTSTUFF_T_CFLAGS) $(ESP_NOPIE_CFLAGS)' >> tmp-libgcc.mvars
+ echo CRTSTUFF_T_CFLAGS_S = '$(CRTSTUFF_T_CFLAGS_S)' >> tmp-libgcc.mvars
+ echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars
++ echo enable_crtbeginTS = '$(enable_crtbeginTS)' >> tmp-libgcc.mvars
+
+ mv tmp-libgcc.mvars libgcc.mvars
+
+@@ -1918,9 +1938,19 @@
+ $(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
+ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
++ $(ESP_NOPIE_CFLAGS) \
+ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \
+ -o $(T)crtbeginT$(objext)
+
++# This is a version of crtbegin for -static -fPIE links if esp is enable.
++ifeq ($(enable_crtbeginTS),yes)
++$(T)crtbeginTS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
++ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
++ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
++ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O \
++ -o $(T)crtbeginTS$(objext)
++endif
++
+ # Compile the start modules crt0.o and mcrt0.o that are linked with
+ # every program
+ $(T)crt0.o: s-crt0 ; @true
+--- libgcc/Makefile.in 2009-07-30 18:33:49.000000000 -0400
++++ libgcc/Makefile.in 2010-02-07 15:10:59.000000000 -0500
+@@ -291,6 +291,12 @@
+ gen-hide-list = echo > \$@
+ endif
+
++# We add crtbeginTS.o to the EXTRA_PARTS list if enable_crtbeginTS = yes
++enable_libgcc_crtbeginTS = $(enable_crtbeginTS)
++ifeq ($(enable_libgcc_crtbeginTS),yes)
++EXTRA_PARTS += crtbeginTS.o
++endif
++
+ ifneq ($(EXTRA_PARTS),)
+ extra-parts = libgcc-extra-parts
+ INSTALL_PARTS = $(EXTRA_PARTS)
+@@ -842,6 +848,13 @@
+ crtbeginT.o: $(gcc_srcdir)/crtstuff.c
+ $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
+ -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O
++
++# This is a version of crtbegin for -static -fPIE links.
++ifeq ($(enable_libgcc_crtbeginTS),yes)
++crtbeginTS.o: $(gcc_srcdir)/crtstuff.c
++ $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
++ -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O
++endif
+ endif
+
+ # Build extra startfiles in the libgcc directory.
diff --git a/gcc-4.6.0/piepatch/20_all_gcc46_gcc.c.patch b/gcc-4.6.0/piepatch/20_all_gcc46_gcc.c.patch
new file mode 100644
index 0000000..6f02a11
--- /dev/null
+++ b/gcc-4.6.0/piepatch/20_all_gcc46_gcc.c.patch
@@ -0,0 +1,84 @@
+2011-01-01 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.
+ #ifdef EXTRA_SPECS: Add ESP_EXTRA_SPECS
+ main(): Add do_self_spec esp_command_options_spec()
+
+--- 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 "flags.h"
+ #include "opts.h"
+ #include "vec.h"
++#include "esp.h" /* for --enable-esp support */
+
+ /* By default there is no special suffix for target executables. */
+ /* FIXME: when autoconf is fixed, remove the host check - dj */
+@@ -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;
+@@ -1699,18 +1705,23 @@
+ INIT_STATIC_SPEC ("sysroot_hdrs_suffix_spec", &sysroot_hdrs_suffix_spec),
+ };
+
+-#ifdef EXTRA_SPECS /* additional specs needed */
++/* EXTRA_SPECS needs to be defined */
++#ifndef EXTRA_SPECS
++#define EXTRA_SPECS
++#endif
++
++/* EXTRA_SPECS and ESP_EXTRA_SPECS add additional specs */
+ /* Structure to keep track of just the first two args of a spec_list.
+- That is all that the EXTRA_SPECS macro gives us. */
++ That is all that the EXTRA_SPECS and ESP_EXTRA_SPECS macro gives us. */
+ struct spec_list_1
+ {
+ const char *const name;
+ const char *const ptr;
+ };
+
+-static const struct spec_list_1 extra_specs_1[] = { EXTRA_SPECS };
++/* ESP_EXTRA_SPECS before EXTRA_SPECS */
++static const struct spec_list_1 extra_specs_1[] = { ESP_EXTRA_SPECS, EXTRA_SPECS };
+ static struct spec_list *extra_specs = (struct spec_list *) 0;
+-#endif
+
+ /* List of dynamically allocates specs that have been defined so far. */
+
+@@ -1798,7 +1809,6 @@
+ if (verbose_flag)
+ notice ("Using built-in specs.\n");
+
+-#ifdef EXTRA_SPECS
+ extra_specs = XCNEWVEC (struct spec_list, ARRAY_SIZE (extra_specs_1));
+
+ for (i = ARRAY_SIZE (extra_specs_1) - 1; i >= 0; i--)
+@@ -1811,7 +1821,6 @@
+ sl->ptr_spec = &sl->ptr;
+ next = sl;
+ }
+-#endif
+
+ for (i = ARRAY_SIZE (static_specs) - 1; i >= 0; i--)
+ {
+@@ -7096,6 +7123,12 @@
+ gcc_exec_prefix = concat (gcc_exec_prefix, spec_machine, dir_separator_str,
+ spec_version, dir_separator_str, NULL);
+
++#ifdef ENABLE_ESP
++ /* Process ESP_COMMAND_OPTIONS_SPEC, adding any new options to the end
++ of the command line. */
++ do_self_spec (esp_command_options_spec);
++#endif
++
+ /* Now we have the specs.
+ Set the `valid' bits for switches that match anything in any spec. */
+
diff --git a/gcc-4.6.0/piepatch/30_all_gcc46_esp.h.patch b/gcc-4.6.0/piepatch/30_all_gcc46_esp.h.patch
new file mode 100644
index 0000000..e516d4c
--- /dev/null
+++ b/gcc-4.6.0/piepatch/30_all_gcc46_esp.h.patch
@@ -0,0 +1,154 @@
+2011-01-01 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/esp.h New file to support --enable-esp
+ Version 20110101.1
+
+--- gcc/esp.h 2010-04-09 16:14:00.000000000 +0200
++++ gcc/esp.h 2010-04-29 21:30:47.000000000 +0200
+@@ -0,0 +1,146 @@
++/* License terms see GNU GENERAL PUBLIC LICENSE Version 3.
++ * Version 20110101.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_CRTBEGINTS add support for crtbeginTS.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_COMMAND_OPTIONS_SPEC to add pie command-line options. */
++ #define ESP_COMMAND_OPTIONS_SPEC "%{!D__KERNEL__:%{!nopie:%(esp_options_pie) \
++ %(esp_options_ssp) %(esp_link_pie)}}"
++
++ /* ESP_OPTIONS_SPEC is added to the compiler spec in gcc/gcc.c */
++ #define ESP_OPTIONS_SPEC "%(esp_options_ssp)"
++
++ /* ESP_CPP_OPTIONS_SPEC is added to the cpp_options spec in gcc/gcc.c
++ For precompiling headers. */
++ #define ESP_CPP_OPTIONS_SPEC "%(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_CRTBEGINTS we don't need to check for -static */
++ #ifdef ENABLE_CRTBEGINTS
++ #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_CRTBEGINTS 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_CRTBEGINTS
++ #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_CRTBEGINTS we don't need to check for -static */
++ #ifdef ENABLE_CRTBEGINTS
++ #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_CRTBEGINTS
++ #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_command_options", ESP_COMMAND_OPTIONS_SPEC }, \
++ { "esp_cpp_options", ESP_CPP_OPTIONS_SPEC }, \
++ { "esp_options", ESP_OPTIONS_SPEC }, \
++ { "esp_options_pie", ESP_OPTIONS_PIE_SPEC }, \
++ { "esp_options_ssp", ESP_OPTIONS_SSP_SPEC }
++
++ static const char *esp_command_options_spec = ESP_COMMAND_OPTIONS_SPEC;
++ static const char *cc1_spec = CC1_SPEC ESP_CC1_SPEC;
++
++#else /* If not ESP_ENABLE defined do this. */
++
++ #define ESP_OPTIONS_SPEC ""
++ #define ESP_CPP_OPTIONS_SPEC ""
++
++ /* We add extra spec name's to the EXTRA_SPECS list */
++ #define ESP_EXTRA_SPECS \
++ { "esp_options", ESP_OPTIONS_SPEC }, \
++ { "esp_cpp_options", ESP_CPP_OPTIONS_SPEC }
++
++#endif
++#endif /* End GCC_ESP_H */
diff --git a/gcc-4.6.0/piepatch/33_all_gcc46_config_rs6000_linux64.h.patch b/gcc-4.6.0/piepatch/33_all_gcc46_config_rs6000_linux64.h.patch
new file mode 100644
index 0000000..adc19d9
--- /dev/null
+++ b/gcc-4.6.0/piepatch/33_all_gcc46_config_rs6000_linux64.h.patch
@@ -0,0 +1,16 @@
+2011-01-01 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/linux64.h.psm 2009-04-10 01:23:07.000000000 +0200
++++ gcc/config/rs6000/linux64.h 2009-09-23 12:34:26.000000000 +0200
+@@ -162,7 +162,7 @@
+ #endif
+
+ #define ASM_SPEC32 "-a32 %{Ym,*} %{Yd,*} \
+-%{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} \
diff --git a/gcc-4.6.0/piepatch/35_all_gcc46_config_crtbegints.patch b/gcc-4.6.0/piepatch/35_all_gcc46_config_crtbegints.patch
new file mode 100644
index 0000000..36874b3
--- /dev/null
+++ b/gcc-4.6.0/piepatch/35_all_gcc46_config_crtbegints.patch
@@ -0,0 +1,36 @@
+2011-01-01 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/linux.h If ENABLE_CRTBEGINTS, -static and -pie use crtbegineTS.o.
+ * gcc/config/rs6000/sysv4.h If ENABLE_CRTBEGINTS, -static and -pie use crtbegineTS.o.
+
+--- gcc/config/linux.h 2009-04-10 01:23:07.000000000 +0200
++++ gcc/config/linux.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_CRTBEGINTS)
++#define LINUX_TARGET_STARTFILE_SPEC \
++ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} crti.o%s \
++ %{static:%{pie:crtbeginTS.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}"
++#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINTS)
+ #define LINUX_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_CRTBEGINTS)
++#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:crtbeginTS.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}"
++#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINTS)
+ #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/gcc-4.6.0/piepatch/README.Changelog b/gcc-4.6.0/piepatch/README.Changelog
index ab59bcb..e7419f2 100644
--- a/gcc-4.6.0/piepatch/README.Changelog
+++ b/gcc-4.6.0/piepatch/README.Changelog
@@ -1,3 +1,16 @@
+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
diff --git a/gcc-4.6.0/piepatch/README.history b/gcc-4.6.0/piepatch/README.history
index 07d373c..e0f3a8e 100644
--- a/gcc-4.6.0/piepatch/README.history
+++ b/gcc-4.6.0/piepatch/README.history
@@ -1,3 +1,17 @@
+0.4.6 07-01-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-06-2010
U 35_all_gcc44_config_crtbegints.patch
0.4.4 26-05-2010