From a47328a2beadfa7ab70802444f0aabac82ede1b9 Mon Sep 17 00:00:00 2001 From: Magnus Granberg Date: Sun, 8 Apr 2012 14:33:17 +0200 Subject: Update 4.6 and 4.7 --- gcc-4.5.0/piepatch/15_all_gcc45-pr52194.patch | 61 +++++ gcc-4.6.0/piepatch/10_all_gcc45_configure.patch | 4 +- .../piepatch/13_all_gcc46_ssp_uclibc_check.patch | 68 ++++++ gcc-4.6.0/piepatch/30_all_gcc45_esp.h.patch | 153 ------------ gcc-4.6.0/piepatch/30_all_gcc46_esp.h.patch | 153 ++++++++++++ gcc-4.6.0/piepatch/README.Changelog | 6 + gcc-4.6.0/piepatch/README.history | 66 ++--- gcc-4.7.0/piepatch/01_all_gcc47_configure.patch | 267 ++++----------------- gcc-4.7.0/piepatch/02_all_gcc45_config.in.patch | 32 --- gcc-4.7.0/piepatch/02_all_gcc47_config.in.patch | 39 +++ gcc-4.7.0/piepatch/06_all_gcc45_esp.h.patch | 153 ------------ gcc-4.7.0/piepatch/06_all_gcc46_esp.h.patch | 153 ++++++++++++ gcc-4.7.0/piepatch/README.Changelog | 19 +- gcc-4.7.0/piepatch/README.history | 6 + 14 files changed, 585 insertions(+), 595 deletions(-) create mode 100644 gcc-4.5.0/piepatch/15_all_gcc45-pr52194.patch create mode 100644 gcc-4.6.0/piepatch/13_all_gcc46_ssp_uclibc_check.patch delete mode 100644 gcc-4.6.0/piepatch/30_all_gcc45_esp.h.patch create mode 100644 gcc-4.6.0/piepatch/30_all_gcc46_esp.h.patch delete mode 100644 gcc-4.7.0/piepatch/02_all_gcc45_config.in.patch create mode 100644 gcc-4.7.0/piepatch/02_all_gcc47_config.in.patch delete mode 100644 gcc-4.7.0/piepatch/06_all_gcc45_esp.h.patch create mode 100644 gcc-4.7.0/piepatch/06_all_gcc46_esp.h.patch diff --git a/gcc-4.5.0/piepatch/15_all_gcc45-pr52194.patch b/gcc-4.5.0/piepatch/15_all_gcc45-pr52194.patch new file mode 100644 index 0000000..4b7b4ae --- /dev/null +++ b/gcc-4.5.0/piepatch/15_all_gcc45-pr52194.patch @@ -0,0 +1,61 @@ +2012-02-11 Magnus Granberg + + PR52194 + * gcc/c-pch.c (c_common_valid_pch) check for + Pax and RANDMMAP. + +--- a/gcc/c-pch.c 2011-08-28 22:14:46.000000000 +0200 ++++ b/gcc/c-pch.c 2012-02-11 17:10:23.158018580 +0100 +@@ -36,6 +36,10 @@ along with GCC; see the file COPYING3. + #include "opts.h" + #include "timevar.h" + ++#define FILE_BUFFER 256 ++#define LINE_BUFFER 1024 ++#define WORD_BUFFER 1024 ++ + /* This is a list of flag variables that must match exactly, and their + names for the error message. The possible values for *flag_var must + fit in a 'signed char'. */ +@@ -240,6 +244,11 @@ c_common_valid_pch (cpp_reader *pfile, c + char ident[IDENT_LENGTH + 16]; + const char *pch_ident; + struct c_pch_validity v; ++ FILE *f; ++ char file[FILE_BUFFER]; ++ char line[LINE_BUFFER]; ++ char word[WORD_BUFFER]; ++ char value[WORD_BUFFER]; + + /* Perform a quick test of whether this is a valid + precompiled header for the current language. */ +@@ -351,6 +360,29 @@ c_common_valid_pch (cpp_reader *pfile, c + } + } + ++ /* FIXME: On PaX enabled kernel with RANDMMAP enabled we can't use ++ PCH. #PR52194 */ ++ ++ f = fopen ("/proc/self/status", "r"); ++ if (f != NULL) ++ { ++ memset(file, 0, FILE_BUFFER); ++ while( fgets(line, LINE_BUFFER, f) ) ++ { ++ sscanf(line, "%s %s", word, value); ++ if(!strcmp(word, "PaX:")) ++ { ++ if(value[3] == 'R') ++ { ++ cpp_error (pfile, CPP_DL_WARNING, "%s can't be used \ ++ with PaX enabled kernel with RANDMMAP \ ++ enabled.", name); ++ return 2; ++ } ++ } ++ } ++ } ++ + /* Check the preprocessor macros are the same as when the PCH was + generated. */ + diff --git a/gcc-4.6.0/piepatch/10_all_gcc45_configure.patch b/gcc-4.6.0/piepatch/10_all_gcc45_configure.patch index 357e63a..a526b00 100644 --- a/gcc-4.6.0/piepatch/10_all_gcc45_configure.patch +++ b/gcc-4.6.0/piepatch/10_all_gcc45_configure.patch @@ -1,4 +1,4 @@ -2011-12-07 Magnus Granberg , Anthony G. Basile +2012-02-14 Magnus Granberg , Anthony G. Basile * configure Add --enable-esp. Add-fno-stack-protector to stage1_cflags. @@ -26,7 +26,7 @@ + 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, powerpc, powerpc64, ia64 and arm ++ Linux targets supported i*86, x86_64, powerpc, powerpc64, ia64 and arm. --enable-libssp build libssp directory --disable-ppl-version-check disable check for PPL version --disable-cloog-version-check disable check for CLooG version diff --git a/gcc-4.6.0/piepatch/13_all_gcc46_ssp_uclibc_check.patch b/gcc-4.6.0/piepatch/13_all_gcc46_ssp_uclibc_check.patch new file mode 100644 index 0000000..c0abb3e --- /dev/null +++ b/gcc-4.6.0/piepatch/13_all_gcc46_ssp_uclibc_check.patch @@ -0,0 +1,68 @@ +2012-04-03 Magnus Granberg + + * gcc/config.in Add define for ENABLE_ESP_SSP + * gcc/configure Check SSP for uClibc + +--- a/gcc/config.in 2012-04-03 17:44:35.173548352 +0200 ++++ b/gcc/config.in 2012-04-03 15:25:23.272299470 +0200 +@@ -89,6 +89,12 @@ + #endif + + ++/* Define to 1 to enable esp ssp. */ ++#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 +--- a/gcc/configure 2012-04-03 17:44:32.793548281 +0200 ++++ b/gcc/configure 2012-04-03 17:40:00.000000000 +0200 +@@ -25915,6 +25915,45 @@ _ACEOF + + fi + ++ ++# Check if we have SSP support. if uClibc we need 0.9.32 or newer and TLS. ++echo "$as_me:$LINENO: checking for SSP support" >&5 ++echo $ECHO_N "checking for SSP support... $ECHO_C" >&6 ++if test "${enable_esp_SSP+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test x$enable_esp = xyes && 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 ++ enable_esp_SSP=yes ++ else ++ enable_esp_SSP=no ++ fi ++ else ++ enable_esp_SSP=yes ++ fi ++ else ++ enable_esp_SSP=no ++ fi ++fi ++echo "$as_me:$LINENO: result: $enable_esp_SSP" >&5 ++echo "${ECHO_T}$enable_esp_SSP" >&6 ++ ++if test x$$enable_esp_SSP = xyes; then ++ ++cat >>confdefs.h <<\_ACEOF ++#define ENABLE_ESP_SSP 1 ++_ACEOF ++ ++fi ++ ++ + # Check if TFmode long double should be used by default or not. + # Some glibc targets used DFmode long double, but with glibc 2.4 + # and later they can use TFmode. diff --git a/gcc-4.6.0/piepatch/30_all_gcc45_esp.h.patch b/gcc-4.6.0/piepatch/30_all_gcc45_esp.h.patch deleted file mode 100644 index c51e8b4..0000000 --- a/gcc-4.6.0/piepatch/30_all_gcc45_esp.h.patch +++ /dev/null @@ -1,153 +0,0 @@ -2011-12-05 Magnus Granberg - - * gcc/esp.h New file to support --enable-esp - Version 20111205.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,145 @@ -+/* License terms see GNU GENERAL PUBLIC LICENSE Version 3. -+ * Version 20111205.1 -+ * Magnus Granberg (Zorry) */ -+#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 ) -+ #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 --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..e11c910 --- /dev/null +++ b/gcc-4.6.0/piepatch/30_all_gcc46_esp.h.patch @@ -0,0 +1,153 @@ +2012-04-03 Magnus Granberg + + * gcc/esp.h New file to support --enable-esp + Version 20120403.2 + +--- 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,145 @@ ++/* License terms see GNU GENERAL PUBLIC LICENSE Version 3. ++ * Version 20120403.2 ++ * Magnus Granberg (Zorry) */ ++#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 --git a/gcc-4.6.0/piepatch/README.Changelog b/gcc-4.6.0/piepatch/README.Changelog index abf59f9..d903cb9 100644 --- a/gcc-4.6.0/piepatch/README.Changelog +++ b/gcc-4.6.0/piepatch/README.Changelog @@ -1,3 +1,9 @@ +0.5.1 Magnus Granberg + + * gcc/config.in Add define for ENABLE_ESP_SSP + * gcc/configure Check SSP for uClibc + * gcc/esp.h ENABLE_ESP_SSP + 0.5.0 Magnus Granberg #393321 diff --git a/gcc-4.6.0/piepatch/README.history b/gcc-4.6.0/piepatch/README.history index 49980dc..6fd4386 100644 --- a/gcc-4.6.0/piepatch/README.history +++ b/gcc-4.6.0/piepatch/README.history @@ -1,4 +1,8 @@ -0.5.0 07-12-2011 +0.5.1 03 Apr 2012 + 13_all_gcc46_ssp_uclibc_check.patch + + 30_all_gcc46_esp.h.patch + - 30_all_gcc45_esp.h.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 @@ -7,18 +11,18 @@ - 11_all_gcc44_config.in.patch + 30_all_gcc45_esp.h.patch - 30_all_gcc44_esp.h.patch -0.4.9 09-11-2011 +0.4.9 09 Nov 2011 U 12_all_gcc46_Makefile.in.patch -0.4.8 26-03-2011 +0.4.8 26 Mar 2011 U 22_all_gcc46-default-ssp.patch -0.4.7 05-03-2011 +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-01-2011 +0.4.6 07 Jan 2011 + 12_all_gcc46_Makefile.in.patch - 12_all_gcc44_Makefile.in.patch + 20_all_gcc46_gcc.c.patch @@ -32,25 +36,25 @@ - 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 +0.4.5 18 Jun 2010 U 35_all_gcc44_config_crtbegints.patch -0.4.4 26-05-2010 +0.4.4 26 May 2010 U 30_all_gcc44_esp.h.patch -0.4.3 26-05-2010 +0.4.3 26 May 2010 U 20_all_gcc44_gcc.c.patch U 30_all_gcc44_esp.h.patch -0.4.2 24-05-2010 +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-04-2010 +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-04-2010 +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 @@ -58,23 +62,23 @@ - 30_all_gcc44_espf.h.patch + 30_all_gcc44_esp.h.patch -0.3.9 14-04-2010 +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-04-2010 +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-02-2010 +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-12-2009 +0.3.6 23 Dec 2009 - 10_all_gcc44_configure.patch + 10_all_gcc44_configure.patch - 30_all_gcc44_espf.h.patch @@ -86,7 +90,7 @@ - README + README -0.3.5 24-09-2009 +0.3.5 24 Sep 2009 - 30_all_gcc44_espf.h.patch + 30_all_gcc44_espf.h.patch - 35_all_gcc44_config_crtbegints.patch @@ -98,7 +102,7 @@ + README.history + README.Gentoo.patches -0.3.4 11-09-2009 +0.3.4 11 Sep 2009 - 10_all_gcc44_configure.patch + 10_all_gcc44_configure.patch - 11_all_gcc44_config.in.patch @@ -119,11 +123,11 @@ - README + README -0.3.3 14-08-2009 +0.3.3 14 Aug 2009 - 23_all_gcc44_opts.c.patch + 23_all_gcc44_opts.c.patch -0.3.2 09-08-2009 +0.3.2 09 Aug 2009 + 50_all_gcc44_no_ssp_tls_uclibc.patch + README.Changelog + README.history @@ -132,11 +136,11 @@ - 30_all_gcc44-espf.h.patch + 30_all_gcc44-espf.h.patch -0.3.1 23-07-2009 +0.3.1 23 Jul 2009 - 10_all_gcc44_configure.patch + 10_all_gcc44_configure.patch -0.3.0 23-07-2009 +0.3.0 23 Jul 2009 - 10_all_gcc44_configure.patch + 10_all_gcc44_configure.patch - 11_all_gcc44_config.in.patch @@ -152,7 +156,7 @@ - 30_all_gcc44-espf.h.patch + 30_all_gcc44-espf.h.patch -0.2.9 14-06-2009 +0.2.9 14 Jun 2009 - 12_all_gcc44_Makefile.in.patch + 12_all_gcc44_Makefile.in.patch - 30_all_gcc44-espf.h.patch @@ -160,7 +164,7 @@ - 50_all_gcc44_gentoo_v20090612.2.patch + 50_all_gcc44_gentoo_v20090614.1.patch -0.2.8 12-06-2009 +0.2.8 12 Jun 2009 - 10_all_gcc44_configure.patch + 10_all_gcc44_configure.patch - 11_all_gcc44_config.in.patch @@ -172,7 +176,7 @@ + 30_all_gcc44-espf.h.patch + 50_all_gcc44_gentoo_v20090612.2.patch -0.2.7 29-05-2009 +0.2.7 29 May 2009 - 11_all_gcc44_config.in.patch + 11_all_gcc44_config.in.patch - 12_all_gcc44_Makefile.in.patch @@ -184,14 +188,14 @@ + 25_all_gcc44-espf.h.patch - 30_all_gcc44-config-defaul-linux.patch -0.2.6 28-05-2009 +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-05-2009 +0.2.5 27 May 2009 - 10_all_gcc44_configure.patch + 10_all_gcc44_configure.patch - 12_all_gcc44_Makefile.in.patch @@ -204,17 +208,17 @@ + 30_all_gcc44-config-defaul-linux.patch - 40_all_gcc44-gentoo.patch -0.2.4 08-05-2009 +0.2.4 08 May 2009 - 12_all_gcc44_Makefile.in.patch + 12_all_gcc44_Makefile.in.patch -0.2.3 08-05-2009 +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-05-2009 +0.2.2 04 May 2009 + 10_all_gcc44_configure.patch + 11_all_gcc44_config.in.patch + 12_all_gcc44_Makefile.in.patch @@ -236,7 +240,7 @@ - 23_all_gcc44-gcc_varasm.c.patch - 30_all_gcc44-add-crt-start-endfiles-linux.patch -0.2.1 28-04-2009 +0.2.1 28 Apr 2009 + 01_all_gcc44-configure.patch + 10_all_gcc44-gcc_configure.patch + 11_all_gcc44-gcc_config.in.patch @@ -257,7 +261,7 @@ - 20-all_gcc4.4-default-crt-start-endfile.patch - 30-all_gcc4.4-crtbeginTS-fno-PIE.patch -0.1.0 16.04.2009 +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 diff --git a/gcc-4.7.0/piepatch/01_all_gcc47_configure.patch b/gcc-4.7.0/piepatch/01_all_gcc47_configure.patch index 94958b1..e79ea25 100644 --- a/gcc-4.7.0/piepatch/01_all_gcc47_configure.patch +++ b/gcc-4.7.0/piepatch/01_all_gcc47_configure.patch @@ -1,10 +1,9 @@ -2012-01-07 Magnus Granberg +2012-04-06 Magnus Granberg * configure Add --enable-esp. Add-fno-stack-protector to stage1_cflags. - * gcc/configure Add --enable-esp. Check -z now, - PIE, SSP and FORTIFY_SOURCES. - Define ENABLE_ESP. + * gcc/configure Add --enable-esp and check if SSP works. + Define ENABLE_ESP ENABLE_ESP_SSP. Check if we support crtbeginP and define ENABLE_CRTBEGINP. --- a/configure 2011-12-22 21:51:34.700589641 +0100 @@ -46,12 +45,12 @@ +if test "${enable_esp+set}" = set; then : + enableval=$enable_esp; + case $target in -+ i?86*-*-linux* | x86_64*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*) ++ 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-espf is not supported on this $target target." >&5 -+$as_echo "$as_me: WARNING: *** --enable-espf is not supported on this $target target." >&2;} ++ { $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 + @@ -97,49 +96,20 @@ --enable-plugin enable plugin support --disable-libquadmath-support disable libquadmath support for Fortran -+ --enable-esp Enable Stack protector, Position independent ++ --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 and arm ++ x86_x32, powerpc, powerpc64, ia64, mips and arm Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] -@@ -26575,6 +26582,28 @@ else - target_header_dir=${native_system_header_dir} - fi - -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker -z now support" >&5 -+$as_echo_n "checking linker -z now support... " >&6; } -+if test "${gcc_cv_ld_now+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else -+ gcc_cv_ld_now=no -+ if test $in_tree_ld = yes ; then -+ if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \ -+ && test $in_tree_ld_is_elf = yes; then -+ gcc_cv_ld_now=yes -+ fi -+ elif test x$gcc_cv_ld != x; then -+ # Check if linker supports -z now options -+ if $gcc_cv_ld --help 2>/dev/null | grep now > /dev/null; then -+ gcc_cv_ld_now=yes -+ fi -+ fi -+ -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_now" >&5 -+$as_echo "$gcc_cv_ld_now" >&6; } -+ - # Test for stack protector support in target C library. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking __stack_chk_fail in target C library" >&5 - $as_echo_n "checking __stack_chk_fail in target C library... " >&6; } -@@ -27290,6 +27319,252 @@ _ACEOF +@@ -27290,6 +27411,113 @@ _ACEOF fi +# -------------- -+# Espf checks ++# Esp checks +# -------------- + +# Check whether --enable-esp was given and target have the support. @@ -153,9 +123,9 @@ +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 x"$set_enable_esp" = x"yes" ; then ++if test $set_enable_esp = yes ; then + case "$target" in -+ i?86*-*-linux* | x86_64*-*-linux* | x86_x32*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*) ++ 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 @@ -174,80 +144,26 @@ + +if test $enable_esp = yes ; then + -+# Check for FORTIFY_SOURCES support in target C library. -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FORTIFY_SOURCES support in target C library" >&5 -+$as_echo_n "checking for _FORTIFY_SOURCES support in target C library... " >&6; } -+if test "${gcc_cv_libc_provides_fortify+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else -+ gcc_cv_libc_provides_fortify=no -+ case "$target" in -+ *-*-linux*) -+ # glibc 2.8 and later provides _FORTIFY_SOURCES. -+ if test -f $target_header_dir/features.h; then -+ if $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+2' \ -+ $target_header_dir/features.h > /dev/null \ -+ && $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+([1-9][0-9]|[8-9])' \ -+ $target_header_dir/features.h > /dev/null; then -+ gcc_cv_libc_provides_fortify=yes -+ elif $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC__[ ]' \ -+ $target_header_dir/features.h > /dev/null ; then -+ gcc_cv_libc_provides_fortify=no -+ fi -+ fi -+ ;; -+ *) gcc_cv_libc_provides_fortify=no ;; -+ esac -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_libc_provides_fortify" >&5 -+$as_echo "$gcc_cv_libc_provides_fortify" >&6; } -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can default to use -fPIE and link with -pie" >&5 -+$as_echo_n "checking if we can default to use -fPIE and link with -pie... " >&6; } -+ if test x"$gcc_cv_ld_pie" = x"yes"; then -+ saved_LDFLAGS="$LDFLAGS" -+ saved_CFLAGS="$CFLAGS" -+ CFLAGS="$CFLAGS -fPIE -Werror" -+ LDFLAGS="$LDFLAGS -fPIE -pie" -+ 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_espf_pie=yes -+else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; }; enable_espf_pie=no -+fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+ LDFLAGS="$saved_LDFLAGS" -+ CFLAGS="$saved_CFLAGS" -+ else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; } -+ enable_espf_pie=no -+ fi -+ -+ if test $enable_espf_pie = yes ; then -+ -+$as_echo "#define ENABLE_ESPF_PIE 1" >>confdefs.h -+ ++ { $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 = yes; 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 -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can default to use -fstack-protector-all" >&5 -+$as_echo_n "checking if we can default to use -fstack-protector-all... " >&6; } -+ if test x"$gcc_cv_libc_provides_ssp" = x"yes" && test x"$set_have_as_tls" = x"yes" ; then ++ if test x$ssp_link_test=xyes ; then + saved_CFLAGS="$CFLAGS" -+ CFLAGS="$CFLAGS -O2 -fstack-protector-all -Werror" ++ CFLAGS="$CFLAGS -O2 -fstack-protector -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + @@ -261,127 +177,42 @@ +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -+$as_echo "yes" >&6; }; enable_espf_ssp=yes ++$as_echo "yes" >&6; }; enable_esp_ssp=yes +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; }; enable_espf_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_espf_ssp=no -+ fi -+ if test x"$enable_espf_ssp" = x"yes" ; then -+ -+$as_echo "#define ENABLE_ESPF_SSP 1" >>confdefs.h -+ -+ fi -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler default to use -D_FORTIFY_SOURCES" >&5 -+$as_echo_n "checking if the compiler default to use -D_FORTIFY_SOURCES... " >&6; } -+ if test x"$gcc_cv_libc_provides_fortify" = x"yes"; then -+ saved_CFLAGS="$CFLAGS" -+ saved_CPPFLAGS="$CPPFLAGS" -+ CFLAGS="$CFLAGS -O2 -Werror -Wall" -+ CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCES=2" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ -+ #include -+ #include -+ #include -+ -+int -+main () -+{ -+ -+ open ("/tmp/foo", O_WRONLY | O_CREAT); -+ -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_c_try_link "$LINENO"; then : -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; }; enable_espf_fortify=no -+else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -+$as_echo "yes" >&6; }; enable_espf_fortify=yes ++$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" -+ CPPFLAGS="$saved_CPPFLAGS" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } -+ enable_espf_fortify=no -+ fi -+ if test x"$enable_espf_fortify" = x"yes" ; then -+ -+$as_echo "#define ENABLE_ESPF_FORTIFY 1" >>confdefs.h -+ ++ enable_esp_ssp=no + fi ++ if test $enable_esp_ssp = yes ; then + -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler default to use -z now to the linker" >&5 -+$as_echo_n "checking if the compiler default to use -z now to the linker... " >&6; } -+ if test x"$gcc_cv_ld_now" = x"yes"; then -+ saved_LDFLAGS="$LDFLAGS" -+ saved_CFLAGS="$CFLAGS" -+ CFLAGS="$CFLAGS -Werror" -+ LDFLAGS="$LDFLAGS -Wl,-z,now" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ ++$as_echo "#define ENABLE_ESP_SSP 1" >>confdefs.h + -+int -+main () -+{ ++ { $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 + -+ ; -+ 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_espf_now=yes -+else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; }; enable_espf_now=no -+fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+ LDFLAGS="$saved_LDFLAGS" -+ CFLAGS="$saved_CFLAGS" -+ else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; } -+ enable_espf_now=no -+ fi -+ if test x"$enable_espf_now" = x"yes" ; then -+ -+$as_echo "#define ENABLE_ESPF_NOW 1" >>confdefs.h ++$as_echo "#define ENABLE_CRTBEGINP 1" >>confdefs.h + ++ fi ++ ;; ++ *) enable_crtbeginP=no ;; ++ esac + fi -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crtbeginP.o support" >&5 -+$as_echo_n "checking for crtbeginP.o support... " >&6; } -+ case "$target" in -+ ia64*-*-linux*) -+ enable_crtbeginP=no ;; -+ *-*-linux*) -+ if test x"$gcc_cv_ld_pie" = x"yes" && test x"$lt_cv_prog_compiler_static_works" = x"yes"; then -+ enable_crtbeginP=yes -+$as_echo "#define ENABLE_CRTBEGINP 1" >>confdefs.h -+ else -+ enable_crtbeginP=no -+ fi ;; -+ *) enable_crtbeginP=no ;; -+ esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_crtbeginP" >&5 +$as_echo "$enable_crtbeginP" >&6; } ++ +fi + # Configure the subdirectories diff --git a/gcc-4.7.0/piepatch/02_all_gcc45_config.in.patch b/gcc-4.7.0/piepatch/02_all_gcc45_config.in.patch deleted file mode 100644 index 489658f..0000000 --- a/gcc-4.7.0/piepatch/02_all_gcc45_config.in.patch +++ /dev/null @@ -1,32 +0,0 @@ -2011-12-05 Magnus Granberg - - * gcc/config.in Add ENABLE_CRTBEGINP and 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/gcc-4.7.0/piepatch/02_all_gcc47_config.in.patch b/gcc-4.7.0/piepatch/02_all_gcc47_config.in.patch new file mode 100644 index 0000000..43cd7f8 --- /dev/null +++ b/gcc-4.7.0/piepatch/02_all_gcc47_config.in.patch @@ -0,0 +1,39 @@ +2012-04-06 Magnus Granberg + + * gcc/config.in Add ENABLE_CRTBEGINP, ENABLE_ESP + and ENABLE_ESP_SSP + +--- 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,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 --git a/gcc-4.7.0/piepatch/06_all_gcc45_esp.h.patch b/gcc-4.7.0/piepatch/06_all_gcc45_esp.h.patch deleted file mode 100644 index c51e8b4..0000000 --- a/gcc-4.7.0/piepatch/06_all_gcc45_esp.h.patch +++ /dev/null @@ -1,153 +0,0 @@ -2011-12-05 Magnus Granberg - - * gcc/esp.h New file to support --enable-esp - Version 20111205.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,145 @@ -+/* License terms see GNU GENERAL PUBLIC LICENSE Version 3. -+ * Version 20111205.1 -+ * Magnus Granberg (Zorry) */ -+#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 ) -+ #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 --git a/gcc-4.7.0/piepatch/06_all_gcc46_esp.h.patch b/gcc-4.7.0/piepatch/06_all_gcc46_esp.h.patch new file mode 100644 index 0000000..e11c910 --- /dev/null +++ b/gcc-4.7.0/piepatch/06_all_gcc46_esp.h.patch @@ -0,0 +1,153 @@ +2012-04-03 Magnus Granberg + + * gcc/esp.h New file to support --enable-esp + Version 20120403.2 + +--- 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,145 @@ ++/* License terms see GNU GENERAL PUBLIC LICENSE Version 3. ++ * Version 20120403.2 ++ * Magnus Granberg (Zorry) */ ++#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 --git a/gcc-4.7.0/piepatch/README.Changelog b/gcc-4.7.0/piepatch/README.Changelog index 1729b6a..b6252ed 100644 --- a/gcc-4.7.0/piepatch/README.Changelog +++ b/gcc-4.7.0/piepatch/README.Changelog @@ -1,15 +1,22 @@ +0.5.3 Magnus Granberg + + * 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 - * gcc/common.opt Add -nopie + * gcc/common.opt Add -nopie 0.5.1 Magnus Granberg - * configure Bumped for 4.7.0 release - * gcc/configure Bumped for 4.7.0 release and + * 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 + * 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 diff --git a/gcc-4.7.0/piepatch/README.history b/gcc-4.7.0/piepatch/README.history index 3c5a7b1..537cc48 100644 --- a/gcc-4.7.0/piepatch/README.history +++ b/gcc-4.7.0/piepatch/README.history @@ -1,3 +1,9 @@ +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 -- cgit v1.2.3-65-gdbad