+++ /dev/null
-diff -Nur gcc-4.7.0-vanilla/configure gcc-4.7.0/configure
---- gcc-4.7.0-vanilla/configure 2012-02-02 11:20:32.000000000 +0100
-+++ gcc-4.7.0/configure 2012-05-18 10:53:11.645610347 +0200
-@@ -671,6 +671,7 @@
- CFLAGS
- CC
- EXTRA_CONFIGARGS_LIBJAVA
-+enable_esp
- target_subdir
- host_subdir
- build_subdir
-@@ -749,6 +750,7 @@
- enable_libquadmath
- enable_libquadmath_support
- enable_libada
-+enable_esp
- enable_libssp
- enable_static_libjava
- enable_bootstrap
-@@ -1467,6 +1469,11 @@
- --disable-libquadmath-support
- disable libquadmath support for Fortran
- --enable-libada build libada directory
-+ --enable-esp Enable Stack protector, 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,
-+ x86_x32, powerpc, powerpc64, ia64 and arm.
- --enable-libssp build libssp directory
- --enable-static-libjava[=ARG]
- build static libjava [default=no]
-@@ -2985,6 +2992,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_??*-*-linux* | powerpc-*-linux* | powerpc64-*-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
-@@ -14422,6 +14447,11 @@
- CFLAGS="$saved_CFLAGS"
- fi
-
-+# 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.
-diff -Nur gcc-4.7.0-vanilla/gcc/esp.h gcc-4.7.0/gcc/esp.h
---- gcc-4.7.0-vanilla/gcc/esp.h 1970-01-01 01:00:00.000000000 +0100
-+++ gcc-4.7.0/gcc/esp.h 2012-05-18 10:54:28.787077373 +0200
-@@ -0,0 +1,145 @@
-+/* License terms see GNU GENERAL PUBLIC LICENSE Version 3.
-+ * Version 20120403.2
-+ * 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_COMMAND_OPTIONS_SPEC to add pie command-line options. */
-+ #define ESP_COMMAND_OPTIONS_SPEC "%{!D__KERNEL__:%{!nopie:%(esp_options_pie) %(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 ) ) && defined ( ENABLE_ESP_SSP )
-+ #define ESP_OPTIONS_SSP_SPEC \
-+ "%{!D__KERNEL__:%{!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_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 -Nur gcc-4.7.0-vanilla/gcc/common.opt gcc-4.7.0/gcc/common.opt
---- gcc-4.7.0-vanilla/gcc/common.opt 2012-02-01 10:20:32.000000000 +0100
-+++ gcc-4.7.0/gcc/common.opt 2012-05-18 10:56:19.708624714 +0200
-@@ -2268,6 +2268,9 @@
- nodefaultlibs
- Driver
-
-+nopie
-+Driver
-+
- nostartfiles
- Driver
-
-diff -Nur gcc-4.7.0-vanilla/gcc/config/gnu-user.h gcc-4.7.0/gcc/config/gnu-user.h
---- gcc-4.7.0-vanilla/gcc/config/gnu-user.h 2011-04-28 18:49:49.000000000 +0200
-+++ gcc-4.7.0/gcc/config/gnu-user.h 2012-05-18 10:56:49.987593058 +0200
-@@ -41,7 +41,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}"
-diff -Nur gcc-4.7.0-vanilla/gcc/config/rs6000/linux64.h gcc-4.7.0/gcc/config/rs6000/linux64.h
---- gcc-4.7.0-vanilla/gcc/config/rs6000/linux64.h 2012-03-12 17:16:51.000000000 +0100
-+++ gcc-4.7.0/gcc/config/rs6000/linux64.h 2012-05-18 10:57:30.248880643 +0200
-@@ -180,7 +180,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} \
-diff -Nur gcc-4.7.0-vanilla/gcc/config/rs6000/sysv4.h gcc-4.7.0/gcc/config/rs6000/sysv4.h
---- gcc-4.7.0-vanilla/gcc/config/rs6000/sysv4.h 2011-04-11 20:46:05.000000000 +0200
-+++ gcc-4.7.0/gcc/config/rs6000/sysv4.h 2012-05-18 10:56:49.988593089 +0200
-@@ -785,7 +785,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 -Nur gcc-4.7.0-vanilla/gcc/config.in gcc-4.7.0/gcc/config.in
---- gcc-4.7.0-vanilla/gcc/config.in 2012-03-22 08:37:39.000000000 +0100
-+++ gcc-4.7.0/gcc/config.in 2012-05-18 10:53:34.954355771 +0200
-@@ -58,6 +58,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
-@@ -77,6 +83,18 @@
- #endif
-
-
-+/* Define to 1 to enable esp. */
-+#ifndef USED_FOR_TARGET
-+#undef ENABLE_ESP
-+#endif
-+
-+
-+/* Define to 1 to enable esp. */
-+#ifndef USED_FOR_TARGET
-+#undef ENABLE_ESP_SSP
-+#endif
-+
-+
- /* Define to 1 to enable fixed-point arithmetic extension to C. */
- #ifndef USED_FOR_TARGET
- #undef ENABLE_FIXED_POINT
-diff -Nur gcc-4.7.0-vanilla/gcc/configure gcc-4.7.0/gcc/configure
---- gcc-4.7.0-vanilla/gcc/configure 2012-03-08 14:54:54.000000000 +0100
-+++ gcc-4.7.0/gcc/configure 2012-05-18 10:53:11.651610539 +0200
-@@ -600,6 +600,8 @@
-
- ac_subst_vars='LTLIBOBJS
- LIBOBJS
-+enable_esp
-+enable_crtbeginP
- enable_plugin
- pluginlibs
- CLOOGINC
-@@ -917,6 +919,7 @@
- enable_plugin
- enable_libquadmath_support
- with_linker_hash_style
-+enable_esp
- '
- ac_precious_vars='build_alias
- host_alias
-@@ -1630,6 +1633,11 @@
- --enable-plugin enable plugin support
- --disable-libquadmath-support
- disable libquadmath support for Fortran
-+ --enable-esp Enable Stack protector, Position independent
-+ executable and Fortify_sources as default if we have
-+ suppot for it when compiling and link -z now as
-+ default. Linux targets supported i*86, x86_64,
-+ x86_x32, powerpc, powerpc64, ia64, mips and arm
-
- Optional Packages:
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
-@@ -27404,6 +27412,113 @@
-
- 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; set_enable_esp=$enableval
-+else
-+ set_enable_esp=no
-+fi
-+
-+if test $set_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; }
-+if test $set_enable_esp = yes ; then
-+ case "$target" in
-+ i?86*-*-linux* | x86_??*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux* | mips*-*-linux*)
-+ enable_esp=yes
-+
-+$as_echo "#define ENABLE_ESP 1" >>confdefs.h
-+
-+ ;;
-+ *)
-+ enable_esp=no
-+ ;;
-+ esac
-+else
-+ enable_esp=no
-+fi
-+{ $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 if we can default to use -fstack-protector" >&5
-+$as_echo_n "checking if we can default to use -fstack-protector... " >&6; }
-+ ssp_link_test=no
-+ if test x$gcc_cv_libc_provides_ssp = xyes && test x$set_have_as_tls = xyes; then
-+ if $EGREP '^ *#[ ]*define[ ]+__UCLIBC__[ ]+1' \
-+ $target_header_dir/features.h > /dev/null; then
-+ if test -f $target_header_dir/bits/uClibc_config.h && \
-+ $EGREP '^ *#[ ]*define[ ]+__UCLIBC_SUBLEVEL__[ ]+([3-9][2-9]|[4-9][0-9])' \
-+ $target_header_dir/bits/uClibc_config.h > /dev/null && \
-+ $EGREP '^ *#[ ]*define[ ]+__UCLIBC_HAS_TLS__[ ]+1' \
-+ $target_header_dir/bits/uClibc_config.h > /dev/null; then
-+ ssp_link_test=yes
-+ fi
-+ else
-+ ssp_link_test=yes
-+ fi
-+ fi
-+ if test x$ssp_link_test=xyes ; then
-+ saved_CFLAGS="$CFLAGS"
-+ CFLAGS="$CFLAGS -O2 -fstack-protector -Werror"
-+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+
-+int
-+main ()
-+{
-+
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+if ac_fn_c_try_link "$LINENO"; then :
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-+$as_echo "yes" >&6; }; enable_esp_ssp=yes
-+else
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-+$as_echo "no" >&6; }; enable_esp_ssp=no
-+fi
-+rm -f core conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+ CFLAGS="$saved_CFLAGS"
-+ else
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-+$as_echo "no" >&6; }
-+ enable_esp_ssp=no
-+ fi
-+ if test $enable_esp_ssp = yes ; then
-+
-+$as_echo "#define ENABLE_ESP_SSP 1" >>confdefs.h
-+
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking checking for crtbeginP.o support" >&5
-+$as_echo_n "checking checking for crtbeginP.o support... " >&6; }
-+ 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 -Nur gcc-4.7.0-vanilla/gcc/cp/lang-specs.h gcc-4.7.0/gcc/cp/lang-specs.h
---- gcc-4.7.0-vanilla/gcc/cp/lang-specs.h 2011-03-06 17:27:57.000000000 +0100
-+++ gcc-4.7.0/gcc/cp/lang-specs.h 2012-05-18 10:54:40.279444906 +0200
-@@ -47,7 +47,7 @@
- %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
- cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
- %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
-- %(cc1_options) %2\
-+ %(cc1_options) %(esp_options) %2\
- %{!fsyntax-only:%{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}}%V}}}}",
- CPLUSPLUS_CPP_SPEC, 0, 0},
-@@ -58,7 +58,7 @@
- %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
- cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
- %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
-- %(cc1_options) %2\
-+ %(cc1_options) %(esp_options) %2\
- %{!fsyntax-only:%(invoke_as)}}}}",
- CPLUSPLUS_CPP_SPEC, 0, 0},
- {".ii", "@c++-cpp-output", 0, 0, 0},
-diff -Nur gcc-4.7.0-vanilla/gcc/doc/invoke.texi gcc-4.7.0/gcc/doc/invoke.texi
---- gcc-4.7.0-vanilla/gcc/doc/invoke.texi 2012-03-14 00:18:07.000000000 +0100
-+++ gcc-4.7.0/gcc/doc/invoke.texi 2012-05-18 10:56:59.156886298 +0200
-@@ -8479,6 +8479,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
-@@ -9457,6 +9462,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
-@@ -19125,6 +19136,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 -Nur gcc-4.7.0-vanilla/gcc/gcc.c gcc-4.7.0/gcc/gcc.c
---- gcc-4.7.0-vanilla/gcc/gcc.c 2012-02-28 18:31:38.000000000 +0100
-+++ gcc-4.7.0/gcc/gcc.c 2012-05-18 10:54:40.279444906 +0200
-@@ -45,6 +45,7 @@
- #include "opts.h"
- #include "params.h"
- #include "vec.h"
-+#include "esp.h" /* for --enable-esp support */
- #include "filenames.h"
-
- /* By default there is no special suffix for target executables. */
-@@ -705,7 +706,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;
-@@ -767,7 +770,7 @@
- static const char *cpp_options =
- "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
- %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\
-- %{undef} %{save-temps*:-fpch-preprocess}";
-+ %{undef} %{save-temps*:-fpch-preprocess} %(esp_cpp_options)";
-
- /* This contains cpp options which are not passed when the preprocessor
- output will be used by another program. */
-@@ -946,9 +949,9 @@
- %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
- %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\
- cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
-- %(cc1_options)}\
-+ %(cc1_options) %(esp_options)}\
- %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
-- cc1 %(cpp_unique_options) %(cc1_options)}}}\
-+ cc1 %(cpp_unique_options) %(cc1_options) %(esp_options)}}}\
- %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 1},
- {"-",
- "%{!E:%e-E or -x required when input is from standard input}\
-@@ -971,7 +974,7 @@
- %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
- {".i", "@cpp-output", 0, 0, 0},
- {"@cpp-output",
-- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
-+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(esp_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
- {".s", "@assembler", 0, 0, 0},
- {"@assembler",
- "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
-@@ -1225,18 +1228,23 @@
- INIT_STATIC_SPEC ("self_spec", &self_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. */
-
-@@ -1328,7 +1336,6 @@
- if (verbose_flag)
- fnotice (stderr, "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--)
-@@ -1341,7 +1348,6 @@
- sl->ptr_spec = &sl->ptr;
- next = sl;
- }
--#endif
-
- for (i = ARRAY_SIZE (static_specs) - 1; i >= 0; i--)
- {
-@@ -6449,6 +6455,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 -Nur gcc-4.7.0-vanilla/gcc/Makefile.in gcc-4.7.0/gcc/Makefile.in
---- gcc-4.7.0-vanilla/gcc/Makefile.in 2012-03-07 11:59:56.000000000 +0100
-+++ gcc-4.7.0/gcc/Makefile.in 2012-05-18 10:54:00.275165546 +0200
-@@ -247,6 +247,14 @@
- 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
- # -------------------------------------------
-@@ -975,12 +983,13 @@
-
- # 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
-@@ -1815,6 +1824,8 @@
- 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
-
-diff -Nur gcc-4.7.0-vanilla/gcc/objc/lang-specs.h gcc-4.7.0/gcc/objc/lang-specs.h
---- gcc-4.7.0-vanilla/gcc/objc/lang-specs.h 2011-03-06 17:27:57.000000000 +0100
-+++ gcc-4.7.0/gcc/objc/lang-specs.h 2012-05-18 10:54:40.281444970 +0200
-@@ -30,9 +30,9 @@
- %{traditional|traditional-cpp:\
- %eGNU Objective C no longer supports traditional compilation}\
- %{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
-- cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}\
-+ cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}}\
- %{!save-temps*:%{!no-integrated-cpp:\
-- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}}\
-+ cc1obj %(cpp_unique_options) %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}}}\
- %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
- {"@objective-c-header",
- "%{E|M|MM:cc1obj -E %{traditional|traditional-cpp:-traditional-cpp}\
-@@ -41,18 +41,18 @@
- %{traditional|traditional-cpp:\
- %eGNU Objective C no longer supports traditional compilation}\
- %{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
-- cc1obj -fpreprocessed %b.mi %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
-+ cc1obj -fpreprocessed %b.mi %(cc1_options)%(esp_options) %{print-objc-runtime-info} %{gen-decls}\
- -o %g.s %{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}%V}\
- %{!save-temps*:%{!no-integrated-cpp:\
-- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
-+ cc1obj %(cpp_unique_options) %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\
- -o %g.s %{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0},
- {".mi", "@objective-c-cpp-output", 0, 0, 0},
- {"@objective-c-cpp-output",
-- "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
-+ "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\
- %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
- {"@objc-cpp-output",
- "%nobjc-cpp-output is deprecated; please use objective-c-cpp-output instead\n\
-- %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
-+ %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\
- %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
-diff -Nur gcc-4.7.0-vanilla/gcc/objcp/lang-specs.h gcc-4.7.0/gcc/objcp/lang-specs.h
---- gcc-4.7.0-vanilla/gcc/objcp/lang-specs.h 2011-03-06 17:27:57.000000000 +0100
-+++ gcc-4.7.0/gcc/objcp/lang-specs.h 2012-05-18 10:54:40.281444969 +0200
-@@ -36,7 +36,7 @@
- %(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
- cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
- %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
-- %(cc1_options) %2\
-+ %(cc1_options) %(esp_options) %2\
- -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
- CPLUSPLUS_CPP_SPEC, 0, 0},
- {"@objective-c++",
-@@ -46,16 +46,16 @@
- %(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
- cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
- %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
-- %(cc1_options) %2\
-+ %(cc1_options) %(esp_options) %2\
- %{!fsyntax-only:%(invoke_as)}}}}",
- CPLUSPLUS_CPP_SPEC, 0, 0},
- {".mii", "@objective-c++-cpp-output", 0, 0, 0},
- {"@objective-c++-cpp-output",
- "%{!M:%{!MM:%{!E:\
-- cc1objplus -fpreprocessed %i %(cc1_options) %2\
-+ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2\
- %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
- {"@objc++-cpp-output",
- "%nobjc++-cpp-output is deprecated; please use objective-c++-cpp-output instead\n\
- %{!M:%{!MM:%{!E:\
-- cc1objplus -fpreprocessed %i %(cc1_options) %2\
-+ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2\
- %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
-diff -Nur gcc-4.7.0-vanilla/gcc/varasm.c gcc-4.7.0/gcc/varasm.c
---- gcc-4.7.0-vanilla/gcc/varasm.c 2012-02-20 12:47:25.000000000 +0100
-+++ gcc-4.7.0/gcc/varasm.c 2012-05-18 10:55:21.633767441 +0200
-@@ -6186,7 +6186,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 -Nur gcc-4.7.0-vanilla/libgcc/Makefile.in gcc-4.7.0/libgcc/Makefile.in
---- gcc-4.7.0-vanilla/libgcc/Makefile.in 2011-11-22 04:01:02.000000000 +0100
-+++ gcc-4.7.0/libgcc/Makefile.in 2012-05-18 10:54:00.276165578 +0200
-@@ -219,6 +219,17 @@
- 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 @@
- 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 @@
- # 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 -Nur gcc-4.7.0-vanilla/Makefile.in gcc-4.7.0/Makefile.in
---- gcc-4.7.0-vanilla/Makefile.in 2012-01-02 11:59:04.000000000 +0100
-+++ gcc-4.7.0/Makefile.in 2012-05-18 10:54:00.273165482 +0200
-@@ -362,9 +362,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
-
-@@ -410,9 +418,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 =