This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPFire 3.x development tree".
The branch, master has been updated via a7924103ddc30437352d75c1c7331c26546b3bfb (commit) via fa2f304297b2a1d751d2e2cd49e9b7b0401a2ec5 (commit) via febef2076687ea04e0a9285754a4f58df3f0964e (commit) via 22cef36eb7dd760ad5294766536a79ba6102af5f (commit) via 85182a62ab342627615a75bef360ceefbc90b1e4 (commit) via 7fdaad7aacba043fb0651d9f3929a7a716b5932c (commit) via 8d926cd19b8e4b9edbaf670ede7b54ac20ff1648 (commit) via b8b873e7b84b7c79e3c8b2872a1f2f632df752c1 (commit) via 7522e0a01b291cf72baf960031ebd28fdc42ad77 (commit) from c5467c0f3d0446afa84fa106986cf11b98839aab (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit a7924103ddc30437352d75c1c7331c26546b3bfb Merge: fa2f304297b2a1d751d2e2cd49e9b7b0401a2ec5 c5467c0f3d0446afa84fa106986cf11b98839aab Author: Michael Tremer michael.tremer@ipfire.org Date: Fri Apr 23 23:45:17 2010 +0200
Merge branch 'master' of ssh://git.ipfire.org/pub/git/ipfire-3.x
commit fa2f304297b2a1d751d2e2cd49e9b7b0401a2ec5 Author: Michael Tremer michael.tremer@ipfire.org Date: Fri Apr 23 10:02:35 2010 +0200
bison: Add patch to fix compile error with gcc-4.5.0.
commit febef2076687ea04e0a9285754a4f58df3f0964e Author: Michael Tremer michael.tremer@ipfire.org Date: Fri Apr 23 01:56:21 2010 +0200
naoki: Bump toolchain version.
commit 22cef36eb7dd760ad5294766536a79ba6102af5f Author: Michael Tremer michael.tremer@ipfire.org Date: Fri Apr 23 00:15:09 2010 +0200
toolchain: Sync perl patches with those from core package.
commit 85182a62ab342627615a75bef360ceefbc90b1e4 Author: Michael Tremer michael.tremer@ipfire.org Date: Fri Apr 23 00:14:42 2010 +0200
toolchain: Make perl to build with gcc-4.5.0.
commit 7fdaad7aacba043fb0651d9f3929a7a716b5932c Author: Michael Tremer michael.tremer@ipfire.org Date: Thu Apr 22 17:05:30 2010 +0200
patch: Update to alpha release 2.6.1.28-d909.
The stable version wasn't able to be built with gcc-4.5.0 and produces segmentation faults.
commit 8d926cd19b8e4b9edbaf670ede7b54ac20ff1648 Author: Michael Tremer michael.tremer@ipfire.org Date: Thu Apr 22 17:03:50 2010 +0200
toolchain: Sync gcc changes to toolchain.
commit b8b873e7b84b7c79e3c8b2872a1f2f632df752c1 Author: Michael Tremer michael.tremer@ipfire.org Date: Wed Apr 21 18:27:54 2010 +0200
gcc: Update to 4.5.0.
commit 7522e0a01b291cf72baf960031ebd28fdc42ad77 Author: Michael Tremer michael.tremer@ipfire.org Date: Wed Apr 21 14:02:15 2010 +0200
mpc: New package.
-----------------------------------------------------------------------
Summary of changes: config/naoki.conf | 2 +- pkgs/core/bison/patches/bison-2.4.2-gcc-1.patch | 46 + pkgs/core/gcc/gcc.nm | 6 +- pkgs/core/gcc/patches/gcc-4.4.3-espf-0.3.7.patch | 1012 ------------------- .../patches/gcc-4.5.0-piepatches-20100421.patch | 1056 ++++++++++++++++++++ pkgs/core/{dbus-glib/dbus-glib.nm => mpc/mpc.nm} | 23 +- pkgs/core/patch/patch.nm | 2 +- pkgs/core/patch/patches/patch-2.5.4-sigsegv.patch | 42 + .../patch/patches/patch-2.6.1-test_fix-1.patch | 28 - pkgs/toolchain/gcc-static/gcc-static.nm | 7 +- .../gcc-static/patches/gcc-4.4.1-espf-1.patch | 504 ---------- .../patches/gcc-4.5.0-piepatches-20100421.patch | 1056 ++++++++++++++++++++ pkgs/toolchain/gcc/gcc.nm | 2 +- pkgs/toolchain/gcc/patches/gcc-4.4.1-espf-1.patch | 504 ---------- .../patches/gcc-4.5.0-piepatches-20100421.patch | 1056 ++++++++++++++++++++ .../patch/patches/patch-2.5.4-sigsegv.patch | 42 + .../patches/perl-5.10.1-USE_MM_LD_RUN_PATH.patch | 109 -- .../perl/patches/perl-5.10.1-utf8-1.patch | 167 --- pkgs/toolchain/perl/perl.nm | 1 - 19 files changed, 3318 insertions(+), 2347 deletions(-) create mode 100644 pkgs/core/bison/patches/bison-2.4.2-gcc-1.patch delete mode 100644 pkgs/core/gcc/patches/gcc-4.4.3-espf-0.3.7.patch create mode 100644 pkgs/core/gcc/patches/gcc-4.5.0-piepatches-20100421.patch copy pkgs/core/{dbus-glib/dbus-glib.nm => mpc/mpc.nm} (81%) create mode 100644 pkgs/core/patch/patches/patch-2.5.4-sigsegv.patch delete mode 100644 pkgs/core/patch/patches/patch-2.6.1-test_fix-1.patch delete mode 100644 pkgs/toolchain/gcc-static/patches/gcc-4.4.1-espf-1.patch create mode 100644 pkgs/toolchain/gcc-static/patches/gcc-4.5.0-piepatches-20100421.patch delete mode 100644 pkgs/toolchain/gcc/patches/gcc-4.4.1-espf-1.patch create mode 100644 pkgs/toolchain/gcc/patches/gcc-4.5.0-piepatches-20100421.patch create mode 100644 pkgs/toolchain/patch/patches/patch-2.5.4-sigsegv.patch delete mode 100644 pkgs/toolchain/perl/patches/perl-5.10.1-USE_MM_LD_RUN_PATH.patch delete mode 100644 pkgs/toolchain/perl/patches/perl-5.10.1-utf8-1.patch
Difference in files: diff --git a/config/naoki.conf b/config/naoki.conf index 0fcf3b4..eb347b9 100644 --- a/config/naoki.conf +++ b/config/naoki.conf @@ -24,7 +24,7 @@ slogan = "Gluttony" [toolchain]
; Counter of toolchain version -version = 1 +version = 2
[sources] diff --git a/pkgs/core/bison/patches/bison-2.4.2-gcc-1.patch b/pkgs/core/bison/patches/bison-2.4.2-gcc-1.patch new file mode 100644 index 0000000..f0197b1 --- /dev/null +++ b/pkgs/core/bison/patches/bison-2.4.2-gcc-1.patch @@ -0,0 +1,46 @@ +Submitted By: Matt Burgess <matthew_at_linuxfromscratch_dot_org> +Date: 2010-04-18 +Initial Package Version: 2.4.2 +Upstream Status: From upstream +Origin: http://lists.gnu.org/archive/html/bug-bison/2010-03/msg00033.html +Description: GCC-4.5.0 changed the format of its output for #error + messages. Fix the test suite to handle the new format. + +diff -Naur bison-2.4.2.orig/NEWS bison-2.4.2/NEWS +--- bison-2.4.2.orig/NEWS 2010-03-20 17:07:23.000000000 +0000 ++++ bison-2.4.2/NEWS 2010-04-18 13:32:59.765438333 +0000 +@@ -1,6 +1,8 @@ + Bison News + ---------- + ++** Failures in the test suite for GCC 4.5 have been fixed. ++ + * Changes in version 2.4.2 (2010-03-20): + + ** Some portability problems that resulted in failures and livelocks +diff -Naur bison-2.4.2.orig/tests/synclines.at bison-2.4.2/tests/synclines.at +--- bison-2.4.2.orig/tests/synclines.at 2010-02-25 04:56:43.000000000 +0000 ++++ bison-2.4.2/tests/synclines.at 2010-04-18 13:32:59.765438333 +0000 +@@ -71,7 +71,9 @@ + AT_DATA([[input.y]], [$2]) + AT_BISON_CHECK([-o input.c input.y]) + AT_SYNCLINES_COMPILE([input.c]) +-AT_CHECK([cat stdout], 0, [$3]) ++# GCC 4.5 tells you the function within which #error appears, but ++# previous versions of gcc do not. ++AT_CHECK([grep -v ': In function ' stdout], 0, [$3]) + AT_CLEANUP + ]) + +diff -Naur bison-2.4.2.orig/tests/testsuite bison-2.4.2/tests/testsuite +--- bison-2.4.2.orig/tests/testsuite 2010-03-20 17:16:02.000000000 +0000 ++++ bison-2.4.2/tests/testsuite 2010-04-18 13:34:37.345569087 +0000 +@@ -16011,7 +16011,7 @@ + { set +x + $as_echo "$at_srcdir/synclines.at:144: cat stdout" + at_fn_check_prepare_trace "synclines.at:144" +-( $at_check_trace; cat stdout ++( $at_check_trace; grep -v ': In function ' stdout + ) >>"$at_stdout" 2>>"$at_stderr" + at_status=$? at_failed=false + $at_check_filter diff --git a/pkgs/core/gcc/gcc.nm b/pkgs/core/gcc/gcc.nm index c73091a..d4e0989 100644 --- a/pkgs/core/gcc/gcc.nm +++ b/pkgs/core/gcc/gcc.nm @@ -25,7 +25,7 @@ include $(PKGROOT)/Include
PKG_NAME = gcc -PKG_VER = 4.4.3 +PKG_VER = 4.5.0 PKG_REL = 0
PKG_MAINTAINER = Michael Tremer michael.tremer@ipfire.org @@ -40,7 +40,7 @@ define PKG_DESCRIPTION endef
PKG_BUILD_DEPS = -PKG_DEPS += binutils cloog glibc gmp kernel-headers libffi mpfr ppl +PKG_DEPS += binutils cloog glibc gmp kernel-headers libffi mpc mpfr ppl
ifeq "$(MACHINE)" "i586" CONFIGURE_ARGS = --disable-decimal-float @@ -96,7 +96,7 @@ define STAGE_BUILD --prefix=/usr \ --libexecdir=/usr/lib \ --mandir=/usr/share/man \ - --enable-espf \ + --enable-esp \ --enable-shared \ --enable-threads=posix \ --enable-__cxa_atexit \ diff --git a/pkgs/core/gcc/patches/gcc-4.4.3-espf-0.3.7.patch b/pkgs/core/gcc/patches/gcc-4.4.3-espf-0.3.7.patch deleted file mode 100644 index c92951d..0000000 --- a/pkgs/core/gcc/patches/gcc-4.4.3-espf-0.3.7.patch +++ /dev/null @@ -1,1012 +0,0 @@ -diff -Nur gcc-4.4.3.vanilla/configure gcc-4.4.3/configure ---- gcc-4.4.3.vanilla/configure 2009-04-25 06:10:29.000000000 +0200 -+++ gcc-4.4.3/configure 2010-03-21 16:37:45.000000000 +0100 -@@ -272,7 +272,7 @@ - PACKAGE_BUGREPORT= - - ac_unique_file="move-if-change" --ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS TOPLEVEL_CONFIGURE_ARGUMENTS build build_cpu build_vendor build_os build_noncanonical host_noncanonical target_noncanonical host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN LN_S build_libsubdir build_subdir host_subdir target_subdir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE do_compare gmplibs gmpinc extra_mpfr_configure_flags ppllibs pplinc clooglibs clooginc stage1_languages SYSROOT_CFLAGS_FOR_TARGET DEBUG_PREFIX_CFLAGS_FOR_TARGET CFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET RPATH_ENVVAR GCC_SHLIB_SUBDIR tooldir build_tooldir CONFIGURE_GDB_TK GDB_TK INSTALL_GDB_TK build_configargs build_configdirs host_configargs configdirs target_configargs AR_FOR_BUILD AS_FOR_BUILD CC_FOR_BUILD CFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD CXX_FOR_BUILD DLLTOOL_FOR_BUILD GCJ_FOR_BUILD GFORTRAN_FOR_BUILD LDFLAGS_FOR_BUILD LD_FOR_BUILD NM_FOR_BUILD RANLIB_FOR_BUILD WINDMC_FOR_BUILD WINDRES_FOR_BUILD config_shell YACC BISON M4 LEX FLEX MAKEINFO EXPECT RUNTEST AR AS DLLTOOL LD LIPO NM RANLIB STRIP WINDRES WINDMC OBJCOPY OBJDUMP CC_FOR_TARGET CXX_FOR_TARGET GCC_FOR_TARGET GCJ_FOR_TARGET GFORTRAN_FOR_TARGET AR_FOR_TARGET AS_FOR_TARGET DLLTOOL_FOR_TARGET LD_FOR_TARGET LIPO_FOR_TARGET NM_FOR_TARGET OBJDUMP_FOR_TARGET RANLIB_FOR_TARGET STRIP_FOR_TARGET WINDRES_FOR_TARGET WINDMC_FOR_TARGET RAW_CXX_FOR_TARGET FLAGS_FOR_TARGET COMPILER_AS_FOR_TARGET COMPILER_LD_FOR_TARGET COMPILER_NM_FOR_TARGET MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT stage1_cflags stage1_checking stage2_werror_flag datarootdir docdir pdfdir htmldir LIBOBJS LTLIBOBJS' -+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS TOPLEVEL_CONFIGURE_ARGUMENTS build build_cpu build_vendor build_os build_noncanonical host_noncanonical target_noncanonical host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN LN_S build_libsubdir build_subdir host_subdir target_subdir enable_espf CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE do_compare gmplibs gmpinc extra_mpfr_configure_flags ppllibs pplinc clooglibs clooginc stage1_languages SYSROOT_CFLAGS_FOR_TARGET DEBUG_PREFIX_CFLAGS_FOR_TARGET CFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET RPATH_ENVVAR GCC_SHLIB_SUBDIR tooldir build_tooldir CONFIGURE_GDB_TK GDB_TK INSTALL_GDB_TK build_configargs build_configdirs host_configargs configdirs target_configargs AR_FOR_BUILD AS_FOR_BUILD CC_FOR_BUILD CFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD CXX_FOR_BUILD DLLTOOL_FOR_BUILD GCJ_FOR_BUILD GFORTRAN_FOR_BUILD LDFLAGS_FOR_BUILD LD_FOR_BUILD NM_FOR_BUILD RANLIB_FOR_BUILD WINDMC_FOR_BUILD WINDRES_FOR_BUILD config_shell YACC BISON M4 LEX FLEX MAKEINFO EXPECT RUNTEST AR AS DLLTOOL LD LIPO NM RANLIB STRIP WINDRES WINDMC OBJCOPY OBJDUMP CC_FOR_TARGET CXX_FOR_TARGET GCC_FOR_TARGET GCJ_FOR_TARGET GFORTRAN_FOR_TARGET AR_FOR_TARGET AS_FOR_TARGET DLLTOOL_FOR_TARGET LD_FOR_TARGET LIPO_FOR_TARGET NM_FOR_TARGET OBJDUMP_FOR_TARGET RANLIB_FOR_TARGET STRIP_FOR_TARGET WINDRES_FOR_TARGET WINDMC_FOR_TARGET RAW_CXX_FOR_TARGET FLAGS_FOR_TARGET COMPILER_AS_FOR_TARGET COMPILER_LD_FOR_TARGET COMPILER_NM_FOR_TARGET MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT stage1_cflags stage1_checking stage2_werror_flag datarootdir docdir pdfdir htmldir LIBOBJS LTLIBOBJS' - ac_subst_files='serialization_dependencies host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag' - ac_pwd=`pwd` - -@@ -934,6 +934,11 @@ - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-gold use gold instead of ld - --enable-libada build libada directory -+ --enable-espf -+ Enable Stack protector, Position independent executable and -+ Fortify_sources 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*, 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 -@@ -2145,6 +2150,25 @@ - noconfigdirs="$noconfigdirs gnattools" - fi - -+# Check whether --enable-espf was given and target have the support. -+# Check whether --enable-espf or --disable-espf was given. -+if test "${enable_espf+set}" = set; then -+ enableval="$enable_espf" -+ -+ case $target in -+ i?86*-*-linux* | x86_64*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*) -+ enable_espf=yes -+ ;; -+ *) -+ { { echo "$as_me:$LINENO: error: *** --enable-espf is not supported on this $target target." >&5 -+echo "$as_me: error: *** --enable-espf is not supported on this $target target." >&2;} -+ { (exit 1); exit 1; }; } -+ ;; -+ esac -+ -+fi; -+ -+ - # Check whether --enable-libssp or --disable-libssp was given. - if test "${enable_libssp+set}" = set; then - enableval="$enable_libssp" -@@ -12433,6 +12457,9 @@ - *) stage1_cflags="-g -J" ;; - esac ;; - esac -+if test x$enable_espf = xyes; then -+ stage1_cflags="$stage1_cflags -fno-stack-protector" -+fi - - # This is aimed to mimic bootstrap with a non-GCC compiler to catch problems. - if test "$GCC" = yes; then -@@ -13236,6 +13263,7 @@ - s,@build_subdir@,$build_subdir,;t t - s,@host_subdir@,$host_subdir,;t t - s,@target_subdir@,$target_subdir,;t t -+s,@enable_espf@,$enable_espf,;t t - s,@CC@,$CC,;t t - s,@CFLAGS@,$CFLAGS,;t t - s,@LDFLAGS@,$LDFLAGS,;t t -diff -Nur gcc-4.4.3.vanilla/gcc/config/i386/linux64.h gcc-4.4.3/gcc/config/i386/linux64.h ---- gcc-4.4.3.vanilla/gcc/config/i386/linux64.h 2009-04-10 01:23:07.000000000 +0200 -+++ gcc-4.4.3/gcc/config/i386/linux64.h 2010-03-21 16:37:45.000000000 +0100 -@@ -113,7 +113,7 @@ - /* This macro may be overridden in i386/k*bsd-gnu.h. */ - #define REG_NAME(reg) reg - --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ - /* i386 glibc provides __stack_chk_guard in %gs:0x14, - x86_64 glibc provides it in %fs:0x28. */ - #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14) -diff -Nur gcc-4.4.3.vanilla/gcc/config/i386/linux.h gcc-4.4.3/gcc/config/i386/linux.h ---- gcc-4.4.3.vanilla/gcc/config/i386/linux.h 2009-05-21 15:21:30.000000000 +0200 -+++ gcc-4.4.3/gcc/config/i386/linux.h 2010-03-21 16:37:45.000000000 +0100 -@@ -210,7 +210,7 @@ - /* This macro may be overridden in i386/k*bsd-gnu.h. */ - #define REG_NAME(reg) reg - --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ - /* i386 glibc provides __stack_chk_guard in %gs:0x14. */ - #define TARGET_THREAD_SSP_OFFSET 0x14 - #endif -diff -Nur gcc-4.4.3.vanilla/gcc/config/linux.h gcc-4.4.3/gcc/config/linux.h ---- gcc-4.4.3.vanilla/gcc/config/linux.h 2009-04-10 01:23:07.000000000 +0200 -+++ gcc-4.4.3/gcc/config/linux.h 2010-03-21 16:37:45.000000000 +0100 -@@ -43,7 +43,11 @@ - object constructed before entering `main'. */ - - #undef STARTFILE_SPEC --#if defined HAVE_LD_PIE -+#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINTS) -+#define 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 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.4.3.vanilla/gcc/config/rs6000/linux64.h gcc-4.4.3/gcc/config/rs6000/linux64.h ---- gcc-4.4.3.vanilla/gcc/config/rs6000/linux64.h 2009-04-10 01:23:07.000000000 +0200 -+++ gcc-4.4.3/gcc/config/rs6000/linux64.h 2010-03-21 16:37:45.000000000 +0100 -@@ -156,7 +156,7 @@ - #endif - - #define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \ --%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \ -+%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} \ - %{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \ - %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \ - %{mcall-freebsd: -mbig} \ -@@ -520,7 +520,7 @@ - - #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" - --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ - /* ppc32 glibc provides __stack_chk_guard in -0x7008(2), - ppc64 glibc provides it at -0x7010(13). */ - #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008) -diff -Nur gcc-4.4.3.vanilla/gcc/config/rs6000/linux.h gcc-4.4.3/gcc/config/rs6000/linux.h ---- gcc-4.4.3.vanilla/gcc/config/rs6000/linux.h 2007-08-02 12:49:31.000000000 +0200 -+++ gcc-4.4.3/gcc/config/rs6000/linux.h 2010-03-21 16:37:45.000000000 +0100 -@@ -117,7 +117,7 @@ - - #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" - --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ - /* ppc32 glibc provides __stack_chk_guard in -0x7008(2). */ - #define TARGET_THREAD_SSP_OFFSET -0x7008 - #endif -diff -Nur gcc-4.4.3.vanilla/gcc/config/rs6000/sysv4.h gcc-4.4.3/gcc/config/rs6000/sysv4.h ---- gcc-4.4.3.vanilla/gcc/config/rs6000/sysv4.h 2009-04-10 01:23:07.000000000 +0200 -+++ gcc-4.4.3/gcc/config/rs6000/sysv4.h 2010-03-21 16:37:45.000000000 +0100 -@@ -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 -Nur gcc-4.4.3.vanilla/gcc/config/s390/linux.h gcc-4.4.3/gcc/config/s390/linux.h ---- gcc-4.4.3.vanilla/gcc/config/s390/linux.h 2007-08-02 12:49:31.000000000 +0200 -+++ gcc-4.4.3/gcc/config/s390/linux.h 2010-03-21 16:37:45.000000000 +0100 -@@ -93,7 +93,7 @@ - - #define MD_UNWIND_SUPPORT "config/s390/linux-unwind.h" - --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ - /* s390 glibc provides __stack_chk_guard in 0x14(tp), - s390x glibc provides it at 0x28(tp). */ - #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14) -diff -Nur gcc-4.4.3.vanilla/gcc/config/sparc/linux64.h gcc-4.4.3/gcc/config/sparc/linux64.h ---- gcc-4.4.3.vanilla/gcc/config/sparc/linux64.h 2009-02-20 16:20:38.000000000 +0100 -+++ gcc-4.4.3/gcc/config/sparc/linux64.h 2010-03-21 16:37:45.000000000 +0100 -@@ -297,7 +297,7 @@ - #undef NEED_INDICATE_EXEC_STACK - #define NEED_INDICATE_EXEC_STACK 1 - --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ - /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14], - sparc64 glibc provides it at [%g7 + 0x28]. */ - #define TARGET_THREAD_SSP_OFFSET (TARGET_ARCH64 ? 0x28 : 0x14) -diff -Nur gcc-4.4.3.vanilla/gcc/config/sparc/linux.h gcc-4.4.3/gcc/config/sparc/linux.h ---- gcc-4.4.3.vanilla/gcc/config/sparc/linux.h 2009-02-20 16:20:38.000000000 +0100 -+++ gcc-4.4.3/gcc/config/sparc/linux.h 2010-03-21 16:37:45.000000000 +0100 -@@ -164,7 +164,7 @@ - #undef NEED_INDICATE_EXEC_STACK - #define NEED_INDICATE_EXEC_STACK 1 - --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ - /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14]. */ - #define TARGET_THREAD_SSP_OFFSET 0x14 - #endif -diff -Nur gcc-4.4.3.vanilla/gcc/config.in gcc-4.4.3/gcc/config.in ---- gcc-4.4.3.vanilla/gcc/config.in 2010-01-21 11:29:37.000000000 +0100 -+++ gcc-4.4.3/gcc/config.in 2010-03-21 16:37:45.000000000 +0100 -@@ -46,6 +46,12 @@ - #endif - - -+/* Define to 1 to enable crtbeginTS.o. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_CRTBEGINTS -+#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 +71,12 @@ - #endif - - -+/* Define to 1 to enable espf. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_ESPF -+#endif -+ -+ - /* Define to 1 to enable fixed-point arithmetic extension to C. */ - #ifndef USED_FOR_TARGET - #undef ENABLE_FIXED_POINT -diff -Nur gcc-4.4.3.vanilla/gcc/configure gcc-4.4.3/gcc/configure ---- gcc-4.4.3.vanilla/gcc/configure 2009-10-19 14:15:27.000000000 +0200 -+++ gcc-4.4.3/gcc/configure 2010-03-21 16:37:45.000000000 +0100 -@@ -458,7 +458,7 @@ - # include <unistd.h> - #endif" - --ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC STMP_FIXPROTO collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC LIBOBJS LTLIBOBJS' -+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC STMP_FIXPROTO collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility enable_espf enable_crtbeginTS GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC LIBOBJS LTLIBOBJS' - ac_subst_files='language_hooks' - ac_pwd=`pwd` - -@@ -24213,6 +24213,50 @@ - ;; - esac - -+echo "$as_me:$LINENO: checking linker -z now support" >&5 -+echo $ECHO_N "checking linker -z now support... $ECHO_C" >&6 -+if test "${gcc_cv_ld_now+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 -+echo "$as_me:$LINENO: result: $gcc_cv_ld_now" >&5 -+echo "${ECHO_T}$gcc_cv_ld_now" >&6 -+ -+echo "$as_me:$LINENO: checking linker -z relro support" >&5 -+echo $ECHO_N "checking linker -z relro support... $ECHO_C" >&6 -+if test "${gcc_cv_ld_relro+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ gcc_cv_ld_relro=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_relro=yes -+ fi -+elif test x$gcc_cv_ld != x; then -+ # Check if linker supports -z relro and -z norelro options -+ if $gcc_cv_ld --help 2>/dev/null | grep relro > /dev/null; then -+ gcc_cv_ld_relro=yes -+ fi -+fi -+ -+fi -+echo "$as_me:$LINENO: result: $gcc_cv_ld_relro" >&5 -+echo "${ECHO_T}$gcc_cv_ld_relro" >&6 -+ - echo "$as_me:$LINENO: checking linker --sysroot support" >&5 - echo $ECHO_N "checking linker --sysroot support... $ECHO_C" >&6 - if test "${gcc_cv_ld_sysroot+set}" = set; then -@@ -24411,6 +24455,66 @@ - - fi - -+if test x$enable_espf = xyes; then -+ case $target in -+ ia64*-*-linux*) -+ if test x$gcc_cv_ld_now = xyes; then -+ enable_espf_ld=yes -+ else -+ enable_espf_ld=no -+ fi -+ ;; -+ *-*-linux*) -+ if test x$gcc_cv_ld_relro = xyes && test x$gcc_cv_ld_now = xyes; then -+ enable_espf_ld=yes -+ else -+ enable_espf_ld=no -+ fi -+ ;; -+ *) -+ enable_espf_ld=no -+ ;; -+ esac -+else -+ enable_espf_ld=no -+fi -+if test x$enable_espf_ld = xyes; then -+cat >>confdefs.h <<_ACEOF -+#define ENABLE_ESPF 1 -+_ACEOF -+fi -+if test x$enable_espf = xyes && test x$enable_espf_ld = xno; then -+ { { echo "$as_me:$LINENO: error: *** --enable-espf Need a linker that support -z now and -z relro." >&5 -+echo "$as_me: error: *** --enable-espf Need a linker that support -z now and -z relro." >&2;} -+ { (exit 1); exit 1; }; } -+fi -+ -+echo "$as_me:$LINENO: checking for crtbeginTS.o support" >&5 -+echo $ECHO_N "checking for crtbeginTS.o support... $ECHO_C" >&6 -+if test "${enable_crtbeginTS+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ enable_crtbeginTS=no -+ case "$target" in -+ ia64*-*-linux*) -+ enable_crtbeginTS=no ;; -+ *-*-linux*) -+ if test x$enable_espf = xyes && test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then -+ enable_crtbeginTS=yes -+ fi -+ ;; -+ *) enable_crtbeginTS=no ;; -+ esac -+fi -+echo "$as_me:$LINENO: result: $enable_crtbeginTS" >&5 -+echo "${ECHO_T}$enable_crtbeginTS" >&6 -+ -+if test x$enable_crtbeginTS = xyes; then -+cat >>confdefs.h <<_ACEOF -+#define ENABLE_CRTBEGINTS 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. -@@ -25617,6 +25721,8 @@ - s,@gcc_cv_objdump@,$gcc_cv_objdump,;t t - s,@gcc_cv_readelf@,$gcc_cv_readelf,;t t - s,@libgcc_visibility@,$libgcc_visibility,;t t -+s,@enable_espf@,$enable_espf,;t t -+s,@enable_crtbeginTS@,$enable_crtbeginTS,;t t - s,@GGC@,$GGC,;t t - s,@zlibdir@,$zlibdir,;t t - s,@zlibinc@,$zlibinc,;t t -diff -Nur gcc-4.4.3.vanilla/gcc/cp/lang-specs.h gcc-4.4.3/gcc/cp/lang-specs.h ---- gcc-4.4.3.vanilla/gcc/cp/lang-specs.h 2007-08-06 13:10:19.000000000 +0200 -+++ gcc-4.4.3/gcc/cp/lang-specs.h 2010-03-21 16:37:45.000000000 +0100 -@@ -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 %{+e1*}\ -+ %(cc1_options) %(espf_options) %2 %{+e1*}\ - %{!fsyntax-only:-o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}}", - CPLUSPLUS_CPP_SPEC, 0, 0}, - {"@c++", -@@ -57,11 +57,11 @@ - %(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 %{+e1*}\ -+ %(cc1_options) %(espf_options) %2 %{+e1*}\ - %{!fsyntax-only:%(invoke_as)}}}}", - CPLUSPLUS_CPP_SPEC, 0, 0}, - {".ii", "@c++-cpp-output", 0, 0, 0}, - {"@c++-cpp-output", - "%{!M:%{!MM:%{!E:\ -- cc1plus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ -+ cc1plus -fpreprocessed %i %(cc1_options) %(espf_options) %2 %{+e*}\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, -diff -Nur gcc-4.4.3.vanilla/gcc/doc/invoke.texi gcc-4.4.3/gcc/doc/invoke.texi ---- gcc-4.4.3.vanilla/gcc/doc/invoke.texi 2009-10-21 17:44:23.000000000 +0200 -+++ gcc-4.4.3/gcc/doc/invoke.texi 2010-03-21 16:37:45.000000000 +0100 -@@ -7155,6 +7155,11 @@ - @opindex fstack-protector-all - Like @option{-fstack-protector} except that all functions are protected. - -+NOTE: When --enable-espf 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 -@@ -7982,6 +7987,12 @@ - that were used to generate code (@option{-fpie}, @option{-fPIE}, - or model suboptions) when you specify this option. - -+NOTE: When --enable-espf 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 -@@ -15906,6 +15917,11 @@ - @code{__pie__} and @code{__PIE__}. The macros have the value 1 - for @option{-fpie} and 2 for @option{-fPIE}. - -+NOTE: When --enable-espf 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.4.3.vanilla/gcc/espf.h gcc-4.4.3/gcc/espf.h ---- gcc-4.4.3.vanilla/gcc/espf.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.4.3/gcc/espf.h 2010-03-21 16:37:45.000000000 +0100 -@@ -0,0 +1,149 @@ -+/* Copyright (C) 2010 Gentoo Foundation Inc. -+ * License terms see GNU GENERAL PUBLIC LICENSE Version 3. -+ * Version 20100210.1 -+ * Magnus Granberg (Zorry) zorry@ume.nu */ -+#ifndef GCC_ESPF_H -+#define GCC_ESPF_H -+ -+/* This file will add -fstack-protector, -fPIE, -pie and -D_FORTIFY_SOURCES=2 -+ as default if the defines and the spec allow it. -+ -+ On Gentoo -+ 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. -+ We use -fstack-protector-all instead of -fstack-protector -+ This will add some unsupported upstream commands options as -nopie. -+ -D__KERNEL__ is added so we don't have -fPIE and -fstack-protector-all when building kernels. -+ ESPF_CC1_SPEC is added to CC1_SPEC. -+ -D_FORTIFY_SOURCES=2 is added with gentoo's patchset as default so no need to set it hear. -+ ESPF_LINK_SPEC is added so we can disable -z now in -vanilla spec. -+ ESPF_CC1_STRICT_SPEC is added so we don't use gcc/opts.c to disable it. -+ ESPF_OPTIONS_PIE_CHECK_SPEC check for -pie, -p, -pg, -profile, -static and -shared. -+ ENABLE_CRTBEGINTS add support for crtbeginTS.o, build -static with -fPIE or -fpie. -+*/ -+#ifdef ENABLE_ESPF -+ -+ /* Hack to support gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass */ -+ /* IA64 arch don't support -fstack-protector* */ -+ #define ESPF_CC1_SPEC " %(espf_cc1_ssp) %(espf_cc1_pie) %(espf_cc1_strict)" -+ #ifndef __ia64 -+ #define ESPF_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: }}" -+ #else -+ #define ESPF_CC1_SSP_SPEC "" -+ #endif -+ #define ESPF_CC1_PIE_SPEC "%{!nopie: }" -+ #define ESPF_CC1_STRICT_SPEC "%{!fstrict-overflow:%{!fno-strict-overflow: -fno-strict-overflow}}" -+ -+ /* ESPF_LINK_SPEC is added to case '%X': in do_spec_1() gcc/gcc.c -+ -z now will be added if we don't have -vanilla spec */ -+ #define ESPF_LINK_SPEC "%(espf_link_now)" -+ #define ESPF_LINK_NOW_SPEC "%{!now:-z now}" -+ /* ESPF_OPTIONS_SPEC is added to the compiler spec in gcc/gcc.c */ -+ -+ #define ESPF_OPTIONS_SPEC "%(espf_options_ssp)" -+ -+ /* ESPF_CPP_OPTIONS_SPEC is added to the cpp_options spec in gcc/gcc.c -+ For precompiling headers. */ -+ #define ESPF_CPP_OPTIONS_SPEC "%(espf_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 TARGET_LIBC_PROVIDES_SSP defined and not __ia64 defined. */ -+ /* IA64 arch don't support -fstack-protector* */ -+ #if defined (TARGET_LIBC_PROVIDES_SSP) && !defined (__ia64) -+ #define ESPF_OPTIONS_SSP_SPEC \ -+ "%{!D__KERNEL__:%{!nostdlib:%{!nodefaultlibs: %{!fno-stack-protector: \ -+ %{!fstack-protector:%{!fstack-protector-all:-fstack-protector-all}}}}}}" -+ #else -+ #define ESPF_OPTIONS_SSP_SPEC "" -+ #endif -+ -+ /* If HAVE_LD_PIE not defined we will not add any -fPIE -pie */ -+ #ifdef HAVE_LD_PIE -+ -+ /* We use ESPF_COMMAND_OPTIONS_SPEC to add pie command-line options. */ -+ #define ESPF_COMMAND_OPTIONS_SPEC "%{!D__KERNEL__:%{!nopie:%(espf_options_pie) %(espf_link_pie)}}" -+ -+ /* 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 ESPF_OPTIONS_PIE_SPEC \ -+ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \ -+ %{!shared: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }" -+ #else -+ #define ESPF_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 ESPF_LINK_PIE_SPEC \ -+ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!r: \ -+ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}" -+ #else -+ #define ESPF_LINK_PIE_SPEC \ -+ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r: \ -+ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}}" -+ #endif -+ -+ /* This will check if shared is set when -static -pie -fPIE -fpie -fno-PIC -fno-pic, -pie is set when -static -pg -p -profile. -+ If set it will make gcc print out "-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible" or -+ "-pie and pg|p|profile are incompatible" */ -+ /* With ENABLE_CRTBEGINTS we don't need to check for -static */ -+ #ifdef ENABLE_CRTBEGINTS -+ #define ESPF_OPTIONS_PIE_CHECK_SPEC \ -+ "%{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}} \ -+ %{pie:%{pg|p|profile:%e-pie and -pg|p|profile are incompatible}}" -+ #else -+ #define ESPF_OPTIONS_PIE_CHECK_SPEC \ -+ "%{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}} \ -+ %{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible}}" -+ #endif -+ -+ /* We don't pass -pie to the linker when -static */ -+ #ifdef ENABLE_CRTBEGINTS -+ #define LINK_PIE_SPEC "%{!static:%{pie:-pie}} " -+ #endif -+ -+ #else -+ #define ESPF_OPTIONS_PIE_SPEC "" -+ #define ESPF_OPTIONS_PIE_CHECK_SPEC "" -+ #define ESPF_LINK_PIE_SPEC "" -+ #endif -+ -+ /* We add extra spec name's to the EXTRA_SPECS list */ -+ #define ESPF_EXTRA_SPECS \ -+ { "espf_cc1", ESPF_CC1_SPEC }, \ -+ { "espf_cc1_pie", ESPF_CC1_PIE_SPEC }, \ -+ { "espf_cc1_ssp", ESPF_CC1_SSP_SPEC }, \ -+ { "espf_cc1_strict", ESPF_CC1_STRICT_SPEC }, \ -+ { "espf_link", ESPF_LINK_SPEC }, \ -+ { "espf_link_now", ESPF_LINK_NOW_SPEC }, \ -+ { "espf_link_pie", ESPF_LINK_PIE_SPEC }, \ -+ { "espf_command_options", ESPF_COMMAND_OPTIONS_SPEC }, \ -+ { "espf_cpp_options", ESPF_CPP_OPTIONS_SPEC }, \ -+ { "espf_options", ESPF_OPTIONS_SPEC }, \ -+ { "espf_options_pie", ESPF_OPTIONS_PIE_SPEC }, \ -+ { "espf_options_pie_check", ESPF_OPTIONS_PIE_CHECK_SPEC }, \ -+ { "espf_options_ssp", ESPF_OPTIONS_SSP_SPEC } -+ -+ static const char *espf_command_options_spec = ESPF_COMMAND_OPTIONS_SPEC; -+ static const char *espf_link_spec = ESPF_LINK_SPEC; -+ static const char *cc1_spec = CC1_SPEC ESPF_CC1_SPEC; -+ -+#else /* If not ESPF_ENABLE defined do this. */ -+ -+ #define ESPF_OPTIONS_SPEC "" -+ #define ESPF_CPP_OPTIONS_SPEC "" -+ -+ /* We add extra spec name's to the EXTRA_SPECS list */ -+ #define ESPF_EXTRA_SPECS \ -+ { "espf_options", ESPF_OPTIONS_SPEC }, \ -+ { "espf_cpp_options", ESPF_CPP_OPTIONS_SPEC } -+ -+#endif -+#endif /* End GCC_ESPF_H */ -diff -Nur gcc-4.4.3.vanilla/gcc/gcc.c gcc-4.4.3/gcc/gcc.c ---- gcc-4.4.3.vanilla/gcc/gcc.c 2010-01-09 01:05:06.000000000 +0100 -+++ gcc-4.4.3/gcc/gcc.c 2010-03-21 16:37:45.000000000 +0100 -@@ -83,6 +83,7 @@ - #include "gcc.h" - #include "flags.h" - #include "opts.h" -+#include "espf.h" /* for --enable-espf support */ - - /* By default there is no special suffix for target executables. */ - /* FIXME: when autoconf is fixed, remove the host check - dj */ -@@ -758,7 +759,9 @@ - - static const char *asm_debug; - static const char *cpp_spec = CPP_SPEC; -+#ifndef ENABLE_ESPF - 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; -@@ -817,7 +820,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} %(espf_cpp_options)"; - - /* This contains cpp options which are not passed when the preprocessor - output will be used by another program. */ -@@ -825,6 +828,9 @@ - - /* NB: This is shared amongst all front-ends, except for Ada. */ - static const char *cc1_options = -+#ifdef ENABLE_ESPF -+"%(espf_options_pie_check)" -+#endif - "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ - %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\ - %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}\ -@@ -999,15 +1005,15 @@ - %{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) %(espf_options)}\ - %{!save-temps:%{!traditional-cpp:%{!no-integrated-cpp:\ -- cc1 %(cpp_unique_options) %(cc1_options)}}}\ -+ cc1 %(cpp_unique_options) %(cc1_options) %(espf_options)}}}\ - %{!fsyntax-only:%(invoke_as)}} \ - %{combine:\ - %{save-temps|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \ - %(cpp_options) -o %{save-temps:%b.i} %{!save-temps:%g.i}}\ - %{!save-temps:%{!traditional-cpp:%{!no-integrated-cpp:\ -- cc1 %(cpp_unique_options) %(cc1_options)}}\ -+ cc1 %(cpp_unique_options) %(cc1_options) %(espf_options)}}\ - %{!fsyntax-only:%(invoke_as)}}}}}}", 0, 1, 1}, - {"-", - "%{!E:%e-E or -x required when input is from standard input}\ -@@ -1030,7 +1036,7 @@ - %W{o*:--output-pch=%*}%V}}}}}}", 0, 0, 0}, - {".i", "@cpp-output", 0, 1, 0}, - {"@cpp-output", -- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0}, -+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(espf_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0}, - {".s", "@assembler", 0, 1, 0}, - {"@assembler", - "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 1, 0}, -@@ -1619,18 +1625,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 ESPF_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 ESPF_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 }; -+/* ESPF_EXTRA_SPECS before EXTRA_SPECS */ -+static const struct spec_list_1 extra_specs_1[] = { ESPF_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. */ - -@@ -1715,7 +1726,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--) -@@ -1728,7 +1738,6 @@ - sl->ptr_spec = &sl->ptr; - next = sl; - } --#endif - - for (i = ARRAY_SIZE (static_specs) - 1; i >= 0; i--) - { -@@ -5233,6 +5242,11 @@ - /* Make each accumulated option a separate argument. */ - do_spec_1 (" ", 0, NULL); - } -+#ifdef ENABLE_ESPF -+ value = do_spec_1 (espf_link_spec, 0, NULL); -+ if (value != 0) -+ return value; -+#endif - break; - - /* Dump out the options accumulated previously using -Wa,. */ -@@ -6495,6 +6509,12 @@ - gcc_exec_prefix = concat (gcc_exec_prefix, spec_machine, dir_separator_str, - spec_version, dir_separator_str, NULL); - -+#ifdef ENABLE_ESPF -+ /* Process ESPF_COMMAND_OPTIONS_SPEC, adding any new options to the end -+ of the command line. */ -+ do_self_spec (espf_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.4.3.vanilla/gcc/Makefile.in gcc-4.4.3/gcc/Makefile.in ---- gcc-4.4.3.vanilla/gcc/Makefile.in 2009-07-25 19:53:35.000000000 +0200 -+++ gcc-4.4.3/gcc/Makefile.in 2010-03-21 16:37:45.000000000 +0100 -@@ -580,13 +580,24 @@ - INHIBIT_LIBC_CFLAGS = -Dinhibit_libc - endif - -+# We don't want __stack_chk_fail in crt* and libgcc2.a. -+# We don't want to compile crtbegin, crtend and crtbeginT with -fPIE. -+enable_espf = @enable_espf@ -+ifeq ($(enable_espf),yes) -+ESPF_NOPIE_CFLAGS = -fno-PIE -+ESPF_NOSSP_CFLAGS = -fno-stack-protector -+else -+ESPF_NOPIE_CFLAGS= -+ESPF_NOSSP_CFLAGS= -+endif -+ - # Options to use when compiling libgcc2.a. - # - LIBGCC2_DEBUG_CFLAGS = -g - LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \ - $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \ - -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ -- $(INHIBIT_LIBC_CFLAGS) -+ $(INHIBIT_LIBC_CFLAGS) $(ESPF_NOSSP_CFLAGS) - - # Additional options to use when compiling libgcc2.a. - # Some targets override this to -isystem include -@@ -599,7 +610,7 @@ - CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ - -finhibit-size-directive -fno-inline-functions -fno-exceptions \ - -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \ -- $(INHIBIT_LIBC_CFLAGS) -+ $(INHIBIT_LIBC_CFLAGS) $(ESPF_NOSSP_CFLAGS) - - # Additional sources to handle exceptions; overridden by targets as needed. - LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ -@@ -629,6 +640,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@ -@@ -1719,8 +1736,9 @@ - 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) $(ESPF_NOPIE_CFLAGS)' >> tmp-libgcc.mvars - echo CRTSTUFF_T_CFLAGS_S = '$(CRTSTUFF_T_CFLAGS_S)' >> tmp-libgcc.mvars -+ echo enable_crtbeginTS = '$(enable_crtbeginTS)' >> tmp-libgcc.mvars - - mv tmp-libgcc.mvars libgcc.mvars - -@@ -1754,12 +1772,14 @@ - $(T)crtbegin.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) \ -+ $(ESPF_NOPIE_CFLAGS) \ - -c $(srcdir)/crtstuff.c -DCRT_BEGIN \ - -o $(T)crtbegin$(objext) - - $(T)crtend.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) \ -+ $(ESPF_NOPIE_CFLAGS) \ - -c $(srcdir)/crtstuff.c -DCRT_END \ - -o $(T)crtend$(objext) - -@@ -1780,9 +1800,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) \ -+ $(ESPF_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 espf 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 -@@ -3058,7 +3088,7 @@ - output.h $(INSN_ATTR_H) $(SYSTEM_H) $(TOPLEV_H) $(TARGET_H) libfuncs.h \ - $(TARGET_DEF_H) $(FUNCTION_H) $(SCHED_INT_H) $(TM_P_H) $(EXPR_H) \ - langhooks.h $(GGC_H) $(OPTABS_H) $(REAL_H) tm-constrs.h $(GIMPLE_H) -- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ -+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(ESPF_NOSSP_CFLAGS)\ - $(out_file) $(OUTPUT_OPTION) - - # Build auxiliary files that support ecoff format. -diff -Nur gcc-4.4.3.vanilla/gcc/objc/lang-specs.h gcc-4.4.3/gcc/objc/lang-specs.h ---- gcc-4.4.3.vanilla/gcc/objc/lang-specs.h 2007-08-02 12:37:36.000000000 +0200 -+++ gcc-4.4.3/gcc/objc/lang-specs.h 2010-03-21 16:37:45.000000000 +0100 -@@ -30,13 +30,13 @@ - %{traditional|ftraditional|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) %(espf_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) %(espf_options) %{print-objc-runtime-info} %{gen-decls}}}\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, - {".mi", "@objc-cpp-output", 0, 0, 0}, - {"@objc-cpp-output", -- "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\ -+ "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(espf_options) %{print-objc-runtime-info} %{gen-decls}\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, - {"@objective-c-header", - "%{E|M|MM:cc1obj -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}\ -@@ -45,10 +45,10 @@ - %{traditional|ftraditional|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) %(espf_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) %(espf_options) %{print-objc-runtime-info} %{gen-decls}\ - -o %g.s %{!o*:--output-pch=%i.gch}\ - %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0}, -diff -Nur gcc-4.4.3.vanilla/gcc/objcp/lang-specs.h gcc-4.4.3/gcc/objcp/lang-specs.h ---- gcc-4.4.3.vanilla/gcc/objcp/lang-specs.h 2007-08-02 12:38:44.000000000 +0200 -+++ gcc-4.4.3/gcc/objcp/lang-specs.h 2010-03-21 16:37:45.000000000 +0100 -@@ -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 %{+e1*}\ -+ %(cc1_options) %(espf_options) %2 %{+e1*}\ - -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}", - CPLUSPLUS_CPP_SPEC, 0, 0}, - {"@objective-c++", -@@ -46,15 +46,15 @@ - %(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 %{+e1*}\ -+ %(cc1_options) %(espf_options) %2 %{+e1*}\ - %{!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 %{+e*}\ -+ cc1objplus -fpreprocessed %i %(cc1_options) %(espf_options) %2 %{+e*}\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, - {"@objc++-cpp-output", - "%{!M:%{!MM:%{!E:\ -- cc1objplus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ -+ cc1objplus -fpreprocessed %i %(cc1_options) %(espf_options) %2 %{+e*}\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, -diff -Nur gcc-4.4.3.vanilla/gcc/varasm.c gcc-4.4.3/gcc/varasm.c ---- gcc-4.4.3.vanilla/gcc/varasm.c 2010-01-20 12:27:49.000000000 +0100 -+++ gcc-4.4.3/gcc/varasm.c 2010-03-21 16:37:45.000000000 +0100 -@@ -5679,7 +5679,11 @@ - bool is_local; - - is_local = targetm.binds_local_p (decl); -- if (!flag_shlib) -+ #ifdef ENABLE_ESPF -+ if (!flag_pic) -+ #else -+ if (!flag_shlib) -+ #endif - { - if (is_local) - kind = TLS_MODEL_LOCAL_EXEC; -diff -Nur gcc-4.4.3.vanilla/libgcc/Makefile.in gcc-4.4.3/libgcc/Makefile.in ---- gcc-4.4.3.vanilla/libgcc/Makefile.in 2009-04-10 01:23:07.000000000 +0200 -+++ gcc-4.4.3/libgcc/Makefile.in 2010-03-21 16:37:45.000000000 +0100 -@@ -280,6 +280,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) -@@ -831,6 +837,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 -Nur gcc-4.4.3.vanilla/libmudflap/configure gcc-4.4.3/libmudflap/configure ---- gcc-4.4.3.vanilla/libmudflap/configure 2009-03-01 18:49:31.000000000 +0100 -+++ gcc-4.4.3/libmudflap/configure 2010-03-21 16:37:45.000000000 +0100 -@@ -458,7 +458,7 @@ - # include <unistd.h> - #endif" - --ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT multi_basedir CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CFLAGS CPP CPPFLAGS EGREP LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM LN_S OBJDUMP ac_ct_OBJDUMP AR ac_ct_AR RANLIB ac_ct_RANLIB lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 enable_shared enable_static MF_HAVE_STDINT_H MF_HAVE_UINTPTR_T LIBMUDFLAPTH_TRUE LIBMUDFLAPTH_FALSE build_libmudflapth toolexecdir toolexeclibdir ac_ct_NM SECTION_FLAGS LIBOBJS LTLIBOBJS' -+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar enable_espf MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT multi_basedir CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CFLAGS CPP CPPFLAGS EGREP LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM LN_S OBJDUMP ac_ct_OBJDUMP AR ac_ct_AR RANLIB ac_ct_RANLIB lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 enable_shared enable_static MF_HAVE_STDINT_H MF_HAVE_UINTPTR_T LIBMUDFLAPTH_TRUE LIBMUDFLAPTH_FALSE build_libmudflapth toolexecdir toolexeclibdir ac_ct_NM SECTION_FLAGS LIBOBJS LTLIBOBJS' - ac_subst_files='' - ac_pwd=`pwd` - -@@ -14017,6 +14017,7 @@ - s,@AMTAR@,$AMTAR,;t t - s,@am__tar@,$am__tar,;t t - s,@am__untar@,$am__untar,;t t -+s,@enable_espf@,$enable_espf,;t t - s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t - s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t - s,@MAINT@,$MAINT,;t t -diff -Nur gcc-4.4.3.vanilla/libmudflap/Makefile.in gcc-4.4.3/libmudflap/Makefile.in ---- gcc-4.4.3.vanilla/libmudflap/Makefile.in 2008-09-26 18:37:32.000000000 +0200 -+++ gcc-4.4.3/libmudflap/Makefile.in 2010-03-21 16:37:45.000000000 +0100 -@@ -253,10 +253,18 @@ - MAINT_CHARSET = latin1 - SUBDIRS = testsuite - -+# Some stuff don't compile with PIE or SSP -+enable_espf = @enable_espf@ -+ifeq ($(enable_espf),yes) -+NO_ESPF_CFLAGS = -fno-stack-protector -U_FORTIFY_SOURCE -+else -+NO_ESPF_CFLAGS = -+endif -+ - # May be used by various substitution variables. - gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) --AM_CFLAGS = -Wall $(SECTION_FLAGS) --@LIBMUDFLAPTH_FALSE@libmudflapth = -+AM_CFLAGS = -Wall $(SECTION_FLAGS) $(NO_ESPF_CFLAGS) -+@LIBMUDFLAPTH_FALSE@libmudflapth = - @LIBMUDFLAPTH_TRUE@libmudflapth = libmudflapth.la - toolexeclib_LTLIBRARIES = libmudflap.la $(libmudflapth) - libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include -diff -Nur gcc-4.4.3.vanilla/Makefile.in gcc-4.4.3/Makefile.in ---- gcc-4.4.3.vanilla/Makefile.in 2009-04-25 06:10:29.000000000 +0200 -+++ gcc-4.4.3/Makefile.in 2010-03-21 16:37:45.000000000 +0100 -@@ -305,9 +305,17 @@ - BUILD_PREFIX = @BUILD_PREFIX@ - BUILD_PREFIX_1 = @BUILD_PREFIX_1@ - -+# Some stuff don't compile with SSP -+enable_espf = @enable_espf@ -+ifeq ($(enable_espf),yes) -+ESPF_NOSSP_CFLAGS = -fno-stack-protector -+else -+ESPF_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 $(ESPF_NOSSP_CFLAGS) - BOOT_LDFLAGS= - BOOT_ADAFLAGS=-gnatpg -gnata - -@@ -350,9 +358,9 @@ - - CFLAGS = @CFLAGS@ - LDFLAGS = @LDFLAGS@ --LIBCFLAGS = $(CFLAGS) -+LIBCFLAGS = $(CFLAGS) $(ESPF_NOSSP_CFLAGS) - CXXFLAGS = @CXXFLAGS@ --LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates -+LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates $(ESPF_NOSSP_CFLAGS) - - # Only build the C compiler for stage1, because that is the only one that - # we can guarantee will build with the native compiler, and also it is the diff --git a/pkgs/core/gcc/patches/gcc-4.5.0-piepatches-20100421.patch b/pkgs/core/gcc/patches/gcc-4.5.0-piepatches-20100421.patch new file mode 100644 index 0000000..e525d5b --- /dev/null +++ b/pkgs/core/gcc/patches/gcc-4.5.0-piepatches-20100421.patch @@ -0,0 +1,1056 @@ +diff -Nur gcc-4.5.0-vanilla/configure gcc-4.5.0/configure +--- gcc-4.5.0-vanilla/configure 2010-04-02 19:35:47.000000000 +0200 ++++ gcc-4.5.0/configure 2010-04-21 15:21:09.762948361 +0200 +@@ -707,6 +707,7 @@ + CFLAGS + CC + target_subdir ++enable_esp + host_subdir + build_subdir + build_libsubdir +@@ -1485,6 +1486,11 @@ + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-gold use gold instead of ld + --enable-libada build libada directory ++ --enable-esp ++ Enable Stack protector, Position independent executable and ++ Fortify_sources 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*, ia64, arm* and mips + --enable-libssp build libssp directory + --enable-build-with-cxx build with C++ compiler instead of C compiler + --disable-ppl-version-check disable check for PPL version +@@ -3164,6 +3170,24 @@ + noconfigdirs="$noconfigdirs gnattools" + fi + ++# Check whether --enable-esp was given and target have the support. ++# Check whether --enable-esp or --disable-esp was given. ++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* | mips-*-linux*) ++ enable_esp=yes ++ ;; ++ *) ++ { { echo "$as_me:$LINENO: error: *** --enable-esp is not supported on this $target target." >&5 ++echo "$as_me: error: *** --enable-esp is not supported on this $target target." >&2;} ++ { (exit 1); exit 1; }; } ++ ;; ++ esac ++ ++fi; ++ + # Check whether --enable-libssp was given. + if test "${enable_libssp+set}" = set; then : + enableval=$enable_libssp; ENABLE_LIBSSP=$enableval +@@ -14290,6 +14314,9 @@ + *) stage1_cflags="-g -J" ;; + esac ;; + esac ++if test x$enable_esp = xyes; then ++ stage1_cflags="$stage1_cflags -fno-stack-protector" ++fi + + # This is aimed to mimic bootstrap with a non-GCC compiler to catch problems. + if test "$GCC" = yes -a "$ENABLE_BUILD_WITH_CXX" != yes; then +diff -Nur gcc-4.5.0-vanilla/gcc/config/i386/linux64.h gcc-4.5.0/gcc/config/i386/linux64.h +--- gcc-4.5.0-vanilla/gcc/config/i386/linux64.h 2010-03-24 21:44:48.000000000 +0100 ++++ gcc-4.5.0/gcc/config/i386/linux64.h 2010-04-21 15:21:16.730815972 +0200 +@@ -115,7 +115,7 @@ + /* This macro may be overridden in i386/k*bsd-gnu.h. */ + #define REG_NAME(reg) reg + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* i386 glibc provides __stack_chk_guard in %gs:0x14, + x86_64 glibc provides it in %fs:0x28. */ + #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14) +diff -Nur gcc-4.5.0-vanilla/gcc/config/i386/linux.h gcc-4.5.0/gcc/config/i386/linux.h +--- gcc-4.5.0-vanilla/gcc/config/i386/linux.h 2010-03-24 21:44:48.000000000 +0100 ++++ gcc-4.5.0/gcc/config/i386/linux.h 2010-04-21 15:21:16.721813554 +0200 +@@ -212,7 +212,7 @@ + /* This macro may be overridden in i386/k*bsd-gnu.h. */ + #define REG_NAME(reg) reg + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* i386 glibc provides __stack_chk_guard in %gs:0x14. */ + #define TARGET_THREAD_SSP_OFFSET 0x14 + #endif +diff -Nur gcc-4.5.0-vanilla/gcc/config/linux.h gcc-4.5.0/gcc/config/linux.h +--- gcc-4.5.0-vanilla/gcc/config/linux.h 2009-04-09 17:00:19.000000000 +0200 ++++ gcc-4.5.0/gcc/config/linux.h 2010-04-21 15:21:16.667815357 +0200 +@@ -43,7 +43,11 @@ + object constructed before entering `main'. */ + + #undef STARTFILE_SPEC +-#if defined HAVE_LD_PIE ++#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINTS) ++#define 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 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.5.0-vanilla/gcc/config/rs6000/linux64.h gcc-4.5.0/gcc/config/rs6000/linux64.h +--- gcc-4.5.0-vanilla/gcc/config/rs6000/linux64.h 2010-03-17 05:44:37.000000000 +0100 ++++ gcc-4.5.0/gcc/config/rs6000/linux64.h 2010-04-21 15:21:16.732816308 +0200 +@@ -162,7 +162,7 @@ + #endif + + #define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \ +-%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \ ++%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} \ + %{memb} %{!memb: %{msdata=eabi: -memb}} \ + %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \ + %{mcall-freebsd: -mbig} \ +@@ -525,7 +525,7 @@ + + #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* ppc32 glibc provides __stack_chk_guard in -0x7008(2), + ppc64 glibc provides it at -0x7010(13). */ + #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008) +diff -Nur gcc-4.5.0-vanilla/gcc/config/rs6000/linux.h gcc-4.5.0/gcc/config/rs6000/linux.h +--- gcc-4.5.0-vanilla/gcc/config/rs6000/linux.h 2007-08-02 12:49:31.000000000 +0200 ++++ gcc-4.5.0/gcc/config/rs6000/linux.h 2010-04-21 15:21:16.731819651 +0200 +@@ -117,7 +117,7 @@ + + #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* ppc32 glibc provides __stack_chk_guard in -0x7008(2). */ + #define TARGET_THREAD_SSP_OFFSET -0x7008 + #endif +diff -Nur gcc-4.5.0-vanilla/gcc/config/rs6000/sysv4.h gcc-4.5.0/gcc/config/rs6000/sysv4.h +--- gcc-4.5.0-vanilla/gcc/config/rs6000/sysv4.h 2009-11-25 21:23:20.000000000 +0100 ++++ gcc-4.5.0/gcc/config/rs6000/sysv4.h 2010-04-21 15:21:16.674812959 +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 -Nur gcc-4.5.0-vanilla/gcc/config/s390/linux.h gcc-4.5.0/gcc/config/s390/linux.h +--- gcc-4.5.0-vanilla/gcc/config/s390/linux.h 2007-08-02 12:49:31.000000000 +0200 ++++ gcc-4.5.0/gcc/config/s390/linux.h 2010-04-21 15:21:16.738814124 +0200 +@@ -93,7 +93,7 @@ + + #define MD_UNWIND_SUPPORT "config/s390/linux-unwind.h" + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* s390 glibc provides __stack_chk_guard in 0x14(tp), + s390x glibc provides it at 0x28(tp). */ + #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14) +diff -Nur gcc-4.5.0-vanilla/gcc/config/sparc/linux64.h gcc-4.5.0/gcc/config/sparc/linux64.h +--- gcc-4.5.0-vanilla/gcc/config/sparc/linux64.h 2009-12-08 00:31:01.000000000 +0100 ++++ gcc-4.5.0/gcc/config/sparc/linux64.h 2010-04-21 15:21:16.749816158 +0200 +@@ -298,7 +298,7 @@ + #undef NEED_INDICATE_EXEC_STACK + #define NEED_INDICATE_EXEC_STACK 1 + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14], + sparc64 glibc provides it at [%g7 + 0x28]. */ + #define TARGET_THREAD_SSP_OFFSET (TARGET_ARCH64 ? 0x28 : 0x14) +diff -Nur gcc-4.5.0-vanilla/gcc/config/sparc/linux.h gcc-4.5.0/gcc/config/sparc/linux.h +--- gcc-4.5.0-vanilla/gcc/config/sparc/linux.h 2009-12-08 00:31:01.000000000 +0100 ++++ gcc-4.5.0/gcc/config/sparc/linux.h 2010-04-21 15:21:16.746815839 +0200 +@@ -172,7 +172,7 @@ + #undef NEED_INDICATE_EXEC_STACK + #define NEED_INDICATE_EXEC_STACK 1 + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14]. */ + #define TARGET_THREAD_SSP_OFFSET 0x14 + #endif +diff -Nur gcc-4.5.0-vanilla/gcc/config.in gcc-4.5.0/gcc/config.in +--- gcc-4.5.0-vanilla/gcc/config.in 2010-04-14 11:30:07.000000000 +0200 ++++ gcc-4.5.0/gcc/config.in 2010-04-21 15:21:09.879812904 +0200 +@@ -52,6 +52,12 @@ + #endif + + ++/* Define to 1 to enable crtbeginTS.o. */ ++#ifndef USED_FOR_TARGET ++#undef ENABLE_CRTBEGINTS ++#endif ++ ++ + /* Define to 1 to specify that we are using the BID decimal floating point + format instead of DPD */ + #ifndef USED_FOR_TARGET +@@ -71,6 +77,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 +@@ -996,6 +1008,12 @@ + #endif + + ++/* Define to 1 if your compiler supports -fstack-protector */ ++#ifndef USED_FOR_TARGET ++#undef HAVE_GCC_SSP ++#endif ++ ++ + /* Define to 1 if you have the `getchar_unlocked' function. */ + #ifndef USED_FOR_TARGET + #undef HAVE_GETCHAR_UNLOCKED +diff -Nur gcc-4.5.0-vanilla/gcc/configure gcc-4.5.0/gcc/configure +--- gcc-4.5.0-vanilla/gcc/configure 2010-03-26 06:40:32.000000000 +0100 ++++ gcc-4.5.0/gcc/configure 2010-04-21 15:21:09.784072083 +0200 +@@ -678,6 +678,8 @@ + HOST_LIBS + GGC + libgcc_visibility ++enable_esp ++enable_crtbeginTS + gcc_cv_readelf + gcc_cv_objdump + ORIGINAL_NM_FOR_TARGET +@@ -24576,6 +24578,50 @@ + ;; + esac + ++echo "$as_me:$LINENO: checking linker -z now support" >&5 ++echo $ECHO_N "checking linker -z now support... $ECHO_C" >&6 ++if test "${gcc_cv_ld_now+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&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 ++echo "$as_me:$LINENO: result: $gcc_cv_ld_now" >&5 ++echo "${ECHO_T}$gcc_cv_ld_now" >&6 ++ ++echo "$as_me:$LINENO: checking linker -z relro support" >&5 ++echo $ECHO_N "checking linker -z relro support... $ECHO_C" >&6 ++if test "${gcc_cv_ld_relro+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ gcc_cv_ld_relro=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_relro=yes ++ fi ++elif test x$gcc_cv_ld != x; then ++ # Check if linker supports -z relro and -z norelro options ++ if $gcc_cv_ld --help 2>/dev/null | grep relro > /dev/null; then ++ gcc_cv_ld_relro=yes ++ fi ++fi ++ ++fi ++echo "$as_me:$LINENO: result: $gcc_cv_ld_relro" >&5 ++echo "${ECHO_T}$gcc_cv_ld_relro" >&6 ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --build-id support" >&5 + $as_echo_n "checking linker --build-id support... " >&6; } + if test "${gcc_cv_ld_buildid+set}" = set; then : +@@ -24729,6 +24775,146 @@ + + fi + ++if test x$gcc_cv_libc_provides_ssp = xyes; then ++ echo "$as_me:$LINENO: checking whether $CC support -fstack-protector" >&5 ++echo $ECHO_N "checking whether $CC support -fstack-protector... $ECHO_C" >&6 ++if test "${gcc_cv_cc_stack_protector+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ++ saved_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -fstack-protector" ++ cat >conftest.$ac_ext <<_ACEOF ++#ifndef __SSP__ ++#error ++#endif ++ ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: "$ac_compile"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: $? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: "$ac_try"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: $? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: "$ac_try"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: $? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ++ case $target in ++ i?86*-*-linux* | x86_64*-*-linux* | powerpc-*-linux* | powerpc64-*-linux*) ++ if test x$set_have_as_tls = xyes; then ++ gcc_cv_cc_stack_protector=yes ++ else ++ gcc_cv_cc_stack_protector=no ++ fi ++ ;; ++ *) ++ cc_cv_cc_stack_protector=yes ++ ;; ++ esac ++ ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++gcc_cv_cc_stack_protector=no ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ CFLAGS="$saved_CFLAGS" ++ ++fi ++echo "$as_me:$LINENO: result: $gcc_cv_cc_stack_protector" >&5 ++echo "${ECHO_T}$gcc_cv_cc_stack_protector" >&6 ++fi ++if test x$gcc_cv_cc_stack_protector = xyes; then ++ ++cat >>confdefs.h <<_ACEOF ++#define HAVE_GCC_SSP 1 ++_ACEOF ++ ++fi ++ ++ ++if test x$enable_esp = xyes ; then ++case $target in ++ ia64*-*-linux*) ++ if test x$gcc_cv_ld_now = xyes; then ++ enable_esp_ld=yes ++ else ++ enable_esp_ld=no ++ fi ++ ;; ++ *-*-linux*) ++ if test x$gcc_cv_ld_relro = xyes && test x$gcc_cv_ld_now = xyes; then ++ enable_esp_ld=yes ++ else ++ enable_esp_ld=no ++ fi ++ ;; ++ *) ++ enable_esp_ld=no ++ ;; ++ esac ++else ++ enable_esp_ld=no ++fi ++if test x$enable_esp_ld = xyes; then ++ ++cat >>confdefs.h <<_ACEOF ++#define ENABLE_ESP 1 ++_ACEOF ++ ++fi ++if test x$enable_esp = xyes && test x$enable_esp_ld = xno; then ++ { { echo "$as_me:$LINENO: error: *** --enable-esp is not supported. You don't have -z,relro or -z,now support in the linker." >&5 ++echo "$as_me: error: *** --enable-esp is not supported. You don't have -z,relro or -z,now support in the linker." >&2;} ++ { (exit 1); exit 1; }; } ++fi ++ ++echo "$as_me:$LINENO: checking for crtbeginTS.o support" >&5 ++echo $ECHO_N "checking for crtbeginTS.o support... $ECHO_C" >&6 ++if test "${enable_crtbeginTS+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ++if test x$enable_esp = xyes ; then ++ case "$target" in ++ ia64*-*-linux*) ++ enable_crtbeginTS=no ;; ++ *-*-linux*) ++ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then ++ enable_crtbeginTS=yes ++ fi ++ ;; ++ *) enable_crtbeginTS=no ;; ++ esac ++fi ++ ++fi ++echo "$as_me:$LINENO: result: $enable_crtbeginTS" >&5 ++echo "${ECHO_T}$enable_crtbeginTS" >&6 ++ ++if test x$enable_crtbeginTS = xyes; then ++ ++cat >>confdefs.h <<_ACEOF ++#define ENABLE_CRTBEGINTS 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 -Nur gcc-4.5.0-vanilla/gcc/cp/lang-specs.h gcc-4.5.0/gcc/cp/lang-specs.h +--- gcc-4.5.0-vanilla/gcc/cp/lang-specs.h 2007-08-06 13:10:19.000000000 +0200 ++++ gcc-4.5.0/gcc/cp/lang-specs.h 2010-04-21 15:21:16.684816335 +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 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + %{!fsyntax-only:-o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {"@c++", +@@ -57,11 +57,11 @@ + %(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 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + %{!fsyntax-only:%(invoke_as)}}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {".ii", "@c++-cpp-output", 0, 0, 0}, + {"@c++-cpp-output", + "%{!M:%{!MM:%{!E:\ +- cc1plus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ ++ cc1plus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, +diff -Nur gcc-4.5.0-vanilla/gcc/doc/invoke.texi gcc-4.5.0/gcc/doc/invoke.texi +--- gcc-4.5.0-vanilla/gcc/doc/invoke.texi 2010-04-06 16:02:22.000000000 +0200 ++++ gcc-4.5.0/gcc/doc/invoke.texi 2010-04-21 15:21:16.796812184 +0200 +@@ -7856,6 +7856,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 +@@ -8705,6 +8710,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 +@@ -17251,6 +17262,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.5.0-vanilla/gcc/esp.h gcc-4.5.0/gcc/esp.h +--- gcc-4.5.0-vanilla/gcc/esp.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.5.0/gcc/esp.h 2010-04-21 15:21:16.622811922 +0200 +@@ -0,0 +1,148 @@ ++/* License terms see GNU GENERAL PUBLIC LICENSE Version 3. ++ * Version 20100409.1 ++ * Magnus Granberg (Zorry) zorry@gentoo.org */ ++#ifndef GCC_ESP_H ++#define GCC_ESP_H ++ ++/* This file will add -fstack-protector, -fPIE, -pie -D_FORTIFY_SOURCES=2 -z,relro and -z,now ++ as default if the defines and the spec allow it. ++ ++ On Gentoo ++ 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. ++ We use -fstack-protector-all instead of -fstack-protector ++ This will add some unsupported upstream commands options as -nopie. ++ -D__KERNEL__ is added so we don't have -fPIE and -fstack-protector-all when building kernels. ++ ESP_CC1_SPEC is added to CC1_SPEC. ++ -D_FORTIFY_SOURCES=2 is added with gentoo's patchset as default so no need to set it hear. ++ ESP_LINK_SPEC will not add -z,relro as it default on with binutils. ++ ESP_CC1_STRICT_SPEC is added so we don't use gcc/opts.c to disable it. ++ ESP_OPTIONS_PIE_CHECK_SPEC check for -pie, -p, -pg, -profile, -static and -shared. ++ 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)" ++ #ifdef HAVE_GCC_SSP ++ #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: }}" ++ #else ++ #define ESP_CC1_SSP_SPEC "" ++ #endif ++ #define ESP_CC1_PIE_SPEC "%{!nopie: }" ++ #define ESP_CC1_STRICT_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 */ ++ #define ESP_LINK_SPEC "%(esp_link_now)" ++ #define ESP_LINK_NOW_SPEC "%{!now:-z now}" ++ ++ /* 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 TARGET_LIBC_PROVIDES_SSP and HAVE_GCC_SSP defined. */ ++ #ifdef HAVE_GCC_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 HAVE_LD_PIE not defined we will not add any -fPIE -pie */ ++ #ifdef HAVE_LD_PIE ++ ++ /* 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)}}" ++ ++ /* 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 shared is set when -static -pie -fPIE -fpie -fno-PIC -fno-pic, -pie is set when -static -pg -p -profile. ++ If set it will make gcc print out "-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible" or ++ "-pie and pg|p|profile are incompatible" */ ++ /* With ENABLE_CRTBEGINTS we don't need to check for -static */ ++ #ifdef ENABLE_CRTBEGINTS ++ #define ESP_OPTIONS_PIE_CHECK_SPEC \ ++ "%{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}} \ ++ %{pie:%{pg|p|profile:%e-pie and -pg|p|profile are incompatible}}" ++ #else ++ #define ESP_OPTIONS_PIE_CHECK_SPEC \ ++ "%{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}} \ ++ %{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible}}" ++ #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_OPTIONS_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", ESP_CC1_STRICT_SPEC }, \ ++ { "esp_link", ESP_LINK_SPEC }, \ ++ { "esp_link_now", ESP_LINK_NOW_SPEC }, \ ++ { "esp_link_pie", ESP_LINK_PIE_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_pie_check", ESP_OPTIONS_PIE_CHECK_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.5.0-vanilla/gcc/gcc.c gcc-4.5.0/gcc/gcc.c +--- gcc-4.5.0-vanilla/gcc/gcc.c 2010-02-11 13:23:08.000000000 +0100 ++++ gcc-4.5.0/gcc/gcc.c 2010-04-21 15:21:16.589812777 +0200 +@@ -84,6 +84,7 @@ + #include "gcc.h" + #include "flags.h" + #include "opts.h" ++#include "esp.h" /* for --enable-esp support */ + + #ifdef HAVE_MMAP_FILE + # include <sys/mman.h> +@@ -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; +@@ -885,7 +888,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. */ +@@ -893,6 +896,9 @@ + + /* NB: This is shared amongst all front-ends, except for Ada. */ + static const char *cc1_options = ++#ifdef ENABLE_ESP ++"%(esp_options_pie_check)" ++#endif + "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %1 %{!Q:-quiet} %{!dumpbase:-dumpbase %B} %{d*} %{m*} %{a*}\ + %{fcompare-debug-second:%:compare-debug-auxbase-opt(%b)} \ +@@ -1075,15 +1081,15 @@ + %{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)}} \ + %{combine:\ + %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \ + %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i}}\ + %{!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, 1, 1}, + {"-", + "%{!E:%e-E or -x required when input is from standard input}\ +@@ -1106,7 +1112,7 @@ + %W{o*:--output-pch=%*}%V}}}}}}", 0, 0, 0}, + {".i", "@cpp-output", 0, 1, 0}, + {"@cpp-output", +- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0}, ++ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(esp_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0}, + {".s", "@assembler", 0, 1, 0}, + {"@assembler", + "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 1, 0}, +@@ -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--) + { +@@ -7111,6 +7120,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.5.0-vanilla/gcc/Makefile.in gcc-4.5.0/gcc/Makefile.in +--- gcc-4.5.0-vanilla/gcc/Makefile.in 2010-04-02 09:49:06.000000000 +0200 ++++ gcc-4.5.0/gcc/Makefile.in 2010-04-21 15:21:10.033812913 +0200 +@@ -636,13 +636,24 @@ + INHIBIT_LIBC_CFLAGS = -Dinhibit_libc + endif + ++# We don't want __stack_chk_fail in crt* and libgcc2.a. ++# We don't want to compile crtbegin, crtend and crtbeginT with -fPIE. ++enable_esp = @enable_esp@ ++ifeq ($(enable_esp),yes) ++ESP_NOPIE_CFLAGS = -fno-PIE ++ESP_NOSSP_CFLAGS = -fno-stack-protector ++else ++ESP_NOPIE_CFLAGS= ++ESP_NOSSP_CFLAGS= ++endif ++ + # Options to use when compiling libgcc2.a. + # + LIBGCC2_DEBUG_CFLAGS = -g + LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \ + $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \ + -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ +- $(INHIBIT_LIBC_CFLAGS) ++ $(INHIBIT_LIBC_CFLAGS) $(ESP_NOSSP_CFLAGS) + + # Additional options to use when compiling libgcc2.a. + # Some targets override this to -isystem include +@@ -655,7 +666,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 \ +- $(INHIBIT_LIBC_CFLAGS) ++ $(INHIBIT_LIBC_CFLAGS) $(ESP_NOSSP_CFLAGS) + + # Additional sources to handle exceptions; overridden by targets as needed. + LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ +@@ -685,6 +696,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@ +@@ -1863,9 +1880,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 + +@@ -1899,12 +1917,14 @@ + $(T)crtbegin.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 \ + -o $(T)crtbegin$(objext) + + $(T)crtend.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_END \ + -o $(T)crtend$(objext) + +@@ -1925,9 +1945,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 +diff -Nur gcc-4.5.0-vanilla/gcc/objc/lang-specs.h gcc-4.5.0/gcc/objc/lang-specs.h +--- gcc-4.5.0-vanilla/gcc/objc/lang-specs.h 2007-08-02 12:37:36.000000000 +0200 ++++ gcc-4.5.0/gcc/objc/lang-specs.h 2010-04-21 15:21:16.702913793 +0200 +@@ -30,13 +30,13 @@ + %{traditional|ftraditional|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}, + {".mi", "@objc-cpp-output", 0, 0, 0}, + {"@objc-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}, + {"@objective-c-header", + "%{E|M|MM:cc1obj -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}\ +@@ -45,10 +45,10 @@ + %{traditional|ftraditional|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}, +diff -Nur gcc-4.5.0-vanilla/gcc/objcp/lang-specs.h gcc-4.5.0/gcc/objcp/lang-specs.h +--- gcc-4.5.0-vanilla/gcc/objcp/lang-specs.h 2007-08-02 12:38:44.000000000 +0200 ++++ gcc-4.5.0/gcc/objcp/lang-specs.h 2010-04-21 15:21:16.708817730 +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 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {"@objective-c++", +@@ -46,15 +46,15 @@ + %(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 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + %{!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 %{+e*}\ ++ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, + {"@objc++-cpp-output", + "%{!M:%{!MM:%{!E:\ +- cc1objplus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ ++ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, +diff -Nur gcc-4.5.0-vanilla/gcc/varasm.c gcc-4.5.0/gcc/varasm.c +--- gcc-4.5.0-vanilla/gcc/varasm.c 2010-03-27 12:56:30.000000000 +0100 ++++ gcc-4.5.0/gcc/varasm.c 2010-04-21 15:21:16.606812404 +0200 +@@ -5961,7 +5961,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.5.0-vanilla/libgcc/Makefile.in gcc-4.5.0/libgcc/Makefile.in +--- gcc-4.5.0-vanilla/libgcc/Makefile.in 2010-03-30 15:08:52.000000000 +0200 ++++ gcc-4.5.0/libgcc/Makefile.in 2010-04-21 15:21:10.824811514 +0200 +@@ -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 -Nur gcc-4.5.0-vanilla/libmudflap/configure gcc-4.5.0/libmudflap/configure +--- gcc-4.5.0-vanilla/libmudflap/configure 2009-12-05 18:18:53.000000000 +0100 ++++ gcc-4.5.0/libmudflap/configure 2010-04-21 15:21:09.843811773 +0200 +@@ -652,6 +652,7 @@ + MAINTAINER_MODE_FALSE + MAINTAINER_MODE_TRUE + am__untar ++enable_esp + am__tar + AMTAR + am__leading_dot +diff -Nur gcc-4.5.0-vanilla/libmudflap/Makefile.in gcc-4.5.0/libmudflap/Makefile.in +--- gcc-4.5.0-vanilla/libmudflap/Makefile.in 2010-04-02 20:18:06.000000000 +0200 ++++ gcc-4.5.0/libmudflap/Makefile.in 2010-04-21 15:21:10.844815108 +0200 +@@ -304,10 +304,18 @@ + MAINT_CHARSET = latin1 + SUBDIRS = testsuite + ++# Some stuff don't compile with PIE or SSP ++enable_esp = @enable_esp@ ++ifeq ($(enable_esp),yes) ++NO_ESP_CFLAGS = -fno-stack-protector -U_FORTIFY_SOURCE ++else ++NO_ESP_CFLAGS = ++endif ++ + # May be used by various substitution variables. + gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) +-AM_CFLAGS = -Wall $(SECTION_FLAGS) +-@LIBMUDFLAPTH_FALSE@libmudflapth = ++AM_CFLAGS = -Wall $(SECTION_FLAGS) $(NO_ESP_CFLAGS) ++@LIBMUDFLAPTH_FALSE@libmudflapth = + @LIBMUDFLAPTH_TRUE@libmudflapth = libmudflapth.la + toolexeclib_LTLIBRARIES = libmudflap.la $(libmudflapth) + libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include +diff -Nur gcc-4.5.0-vanilla/Makefile.in gcc-4.5.0/Makefile.in +--- gcc-4.5.0-vanilla/Makefile.in 2010-02-17 12:01:44.000000000 +0100 ++++ gcc-4.5.0/Makefile.in 2010-04-21 15:21:10.022812548 +0200 +@@ -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 + +@@ -397,9 +405,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) + + TFLAGS = + diff --git a/pkgs/core/mpc/mpc.nm b/pkgs/core/mpc/mpc.nm new file mode 100644 index 0000000..54fca7f --- /dev/null +++ b/pkgs/core/mpc/mpc.nm @@ -0,0 +1,49 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007, 2008 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see http://www.gnu.org/licenses/. # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include $(PKGROOT)/Include + +PKG_NAME = mpc +PKG_VER = 0.8.1 +PKG_REL = 0 + +PKG_MAINTAINER = +PKG_GROUP = System/Libraries +PKG_URL = http://www.multiprecision.org/ +PKG_LICENSE = LGPLv2.1+ +PKG_SUMMARY = Mpc is a C library for the arithmetic of complex numbers. + +PKG_DEPS += gmp mpfr + +define PKG_DESCRIPTION + Mpc is a C library for the arithmetic of complex numbers with \ + arbitrarily high precision and correct rounding of the result. \ + It is built upon and follows the same principles as Mpfr. +endef + +PKG_TARBALL = $(THISAPP).tar.gz + +define STAGE_TEST + cd $(DIR_APP) && make check +endef diff --git a/pkgs/core/patch/patch.nm b/pkgs/core/patch/patch.nm index a1e0a98..2d1d2b5 100644 --- a/pkgs/core/patch/patch.nm +++ b/pkgs/core/patch/patch.nm @@ -25,7 +25,7 @@ include $(PKGROOT)/Include
PKG_NAME = patch -PKG_VER = 2.6.1 +PKG_VER = 2.6.1.28-d909 PKG_REL = 0
PKG_MAINTAINER = diff --git a/pkgs/core/patch/patches/patch-2.5.4-sigsegv.patch b/pkgs/core/patch/patches/patch-2.5.4-sigsegv.patch new file mode 100644 index 0000000..c018153 --- /dev/null +++ b/pkgs/core/patch/patches/patch-2.5.4-sigsegv.patch @@ -0,0 +1,42 @@ +diff -up patch-2.6/src/inp.c.sigsegv patch-2.6/src/inp.c +--- patch-2.6/src/inp.c.sigsegv 2009-11-02 19:09:57.000000000 +0000 ++++ patch-2.6/src/inp.c 2009-11-16 09:31:52.305022200 +0000 +@@ -77,6 +77,14 @@ re_input (void) + } + } + ++void ++reset_scan_input_vars() ++{ ++ using_plan_a = 1; ++ i_buffer = NULL; ++ i_ptr = NULL; ++} ++ + /* Construct the line index, somehow or other. */ + + void +diff -up patch-2.6/src/inp.h.sigsegv patch-2.6/src/inp.h +--- patch-2.6/src/inp.h.sigsegv 2009-11-02 19:09:57.000000000 +0000 ++++ patch-2.6/src/inp.h 2009-11-16 09:32:24.440021838 +0000 +@@ -24,4 +24,5 @@ XTERN LINENUM input_lines; /* how long + char const *ifetch (LINENUM, bool, size_t *); + void get_input_file (char const *, char const *); + void re_input (void); ++void reset_scan_input_vars (void); + void scan_input (char *); +diff -up patch-2.6/src/patch.c.sigsegv patch-2.6/src/patch.c +--- patch-2.6/src/patch.c.sigsegv 2009-11-02 19:09:57.000000000 +0000 ++++ patch-2.6/src/patch.c 2009-11-16 09:31:52.306021801 +0000 +@@ -210,7 +210,10 @@ main (int argc, char **argv) + + /* find out where all the lines are */ + if (!skip_rest_of_patch) +- scan_input (inname); ++ scan_input (inname); ++ else ++ reset_scan_input_vars (); ++ + + /* from here on, open no standard i/o files, because malloc */ + /* might misfire and we can't catch it easily */ diff --git a/pkgs/core/patch/patches/patch-2.6.1-test_fix-1.patch b/pkgs/core/patch/patches/patch-2.6.1-test_fix-1.patch deleted file mode 100644 index d80f766..0000000 --- a/pkgs/core/patch/patches/patch-2.6.1-test_fix-1.patch +++ /dev/null @@ -1,28 +0,0 @@ -Submitted by: Matt Burgess <matthew at linuxfromscratch.org> -Date: 2010-01-03 -Initial Package Version: 2.6.1 -Upstream Status: Submitted -Origin: Matt Burgess -Description: Prevents a test from failing when ed is not available. - -diff -Naur patch-2.6.1.orig/tests/crlf-handling patch-2.6.1/tests/crlf-handling ---- patch-2.6.1.orig/tests/crlf-handling 2009-12-30 12:56:30.000000000 +0000 -+++ patch-2.6.1/tests/crlf-handling 2010-01-03 11:06:00.340849916 +0000 -@@ -89,10 +89,14 @@ - - # -------------------------------------------------------------- - --diff -e a b > ab.diff --cp a c --check 'patch c < ab.diff' <<EOF -+if ! have_ed ; then -+ echo "The ed utility is not available; skipping ed related tests" -+else -+ diff -e a b > ab.diff -+ cp a c -+ check 'patch c < ab.diff' <<EOF - EOF -+fi - - check 'cat -A c' <<EOF - 1b^M$ diff --git a/pkgs/toolchain/gcc-static/gcc-static.nm b/pkgs/toolchain/gcc-static/gcc-static.nm index 6683204..b70aebb 100644 --- a/pkgs/toolchain/gcc-static/gcc-static.nm +++ b/pkgs/toolchain/gcc-static/gcc-static.nm @@ -4,16 +4,19 @@ PKG_TOOLCHAIN_DEPS += binutils-static include ../../core/gcc/gcc.nm
GMP = gmp-5.0.1 +MPC = mpc-0.8.1 MPFR = mpfr-2.4.2
-PKG_OBJECTS += $(GMP).tar.bz2 $(MPFR).tar.bz2 +PKG_OBJECTS += $(GMP).tar.bz2 $(MPC).tar.gz $(MPFR).tar.bz2
define STAGE_PREPARE_CMDS -mkdir -pv $(DIR_SRC)/gcc-build
cd $(DIR_APP) && $(DO_EXTRACT) $(DIR_DL)/$(GMP).tar.bz2 + cd $(DIR_APP) && $(DO_EXTRACT) $(DIR_DL)/$(MPC).tar.gz cd $(DIR_APP) && $(DO_EXTRACT) $(DIR_DL)/$(MPFR).tar.bz2 cd $(DIR_APP) && ln -svf $(GMP) gmp + cd $(DIR_APP) && ln -svf $(MPC) mpc cd $(DIR_APP) && ln -svf $(MPFR) mpfr endef
@@ -43,7 +46,7 @@ define STAGE_BUILD --disable-multilib \ --disable-shared \ --disable-nls \ - --enable-espf \ + --enable-esp \ $(CONFIGURE_ARGS)
cd $(DIR_SRC)/gcc-build && make #$(PARALLELISMFLAGS) diff --git a/pkgs/toolchain/gcc-static/patches/gcc-4.4.1-espf-1.patch b/pkgs/toolchain/gcc-static/patches/gcc-4.4.1-espf-1.patch deleted file mode 100644 index e531e13..0000000 --- a/pkgs/toolchain/gcc-static/patches/gcc-4.4.1-espf-1.patch +++ /dev/null @@ -1,504 +0,0 @@ -diff -Nur gcc-4.4.0_vanilla/gcc/config.in gcc-4.4.0/gcc/config.in ---- gcc-4.4.0_vanilla/gcc/config.in 2009-04-21 11:08:08.000000000 +0200 -+++ gcc-4.4.0/gcc/config.in 2009-07-11 12:35:50.000000000 +0200 -@@ -65,6 +65,12 @@ - #endif - - -+/* Define to 1 to enable espf. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_ESPF -+#endif -+ -+ - /* Define to 1 to enable fixed-point arithmetic extension to C. */ - #ifndef USED_FOR_TARGET - #undef ENABLE_FIXED_POINT -@@ -101,6 +107,12 @@ - #endif - - -+/* Define to 1 to enable libssp. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_LIBSSP -+#endif -+ -+ - /* Define to 1 if translation of program messages to the user's native - language is requested. */ - #ifndef USED_FOR_TARGET -@@ -1465,6 +1477,12 @@ - #endif - - -+/* Define if your target C library provides fortify_sources level 2 support */ -+#ifndef USED_FOR_TARGET -+#undef TARGET_LIBC_PROVIDES_FORTIFY2 -+#endif -+ -+ - /* Define if your target C library provides stack protector support */ - #ifndef USED_FOR_TARGET - #undef TARGET_LIBC_PROVIDES_SSP -diff -Nur gcc-4.4.0_vanilla/gcc/configure gcc-4.4.0/gcc/configure ---- gcc-4.4.0_vanilla/gcc/configure 2009-03-24 18:46:03.000000000 +0100 -+++ gcc-4.4.0/gcc/configure 2009-07-11 12:35:57.000000000 +0200 -@@ -458,7 +458,7 @@ - # include <unistd.h> - #endif" - --ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC STMP_FIXPROTO collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC LIBOBJS LTLIBOBJS' -+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC STMP_FIXPROTO collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility enable_espf GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC LIBOBJS LTLIBOBJS' - ac_subst_files='language_hooks' - ac_pwd=`pwd` - -@@ -1078,6 +1078,11 @@ - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) -+ --enable-espf -+ Enable Stack protector, Position independent executable and -+ Fortify_sources 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 - --enable-maintainer-mode - enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer -@@ -24177,6 +24182,50 @@ - ;; - esac - -+echo "$as_me:$LINENO: checking linker -z now support" >&5 -+echo $ECHO_N "checking linker -z now support... $ECHO_C" >&6 -+if test "${gcc_cv_ld_now+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 -+echo "$as_me:$LINENO: result: $gcc_cv_ld_now" >&5 -+echo "${ECHO_T}$gcc_cv_ld_now" >&6 -+ -+echo "$as_me:$LINENO: checking linker -z relro support" >&5 -+echo $ECHO_N "checking linker -z relro support... $ECHO_C" >&6 -+if test "${gcc_cv_ld_relro+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ gcc_cv_ld_relro=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_relro=yes -+ fi -+elif test x$gcc_cv_ld != x; then -+ # Check if linker supports -z relro and -z norelro options -+ if $gcc_cv_ld --help 2>/dev/null | grep relro > /dev/null; then -+ gcc_cv_ld_relro=yes -+ fi -+fi -+ -+fi -+echo "$as_me:$LINENO: result: $gcc_cv_ld_relro" >&5 -+echo "${ECHO_T}$gcc_cv_ld_relro" >&6 -+ - echo "$as_me:$LINENO: checking linker --sysroot support" >&5 - echo $ECHO_N "checking linker --sysroot support... $ECHO_C" >&6 - if test "${gcc_cv_ld_sysroot+set}" = set; then -@@ -24213,6 +24262,49 @@ - - fi - -+# Test for fortify_sources support level 2 in target C library. -+echo "$as_me:$LINENO: checking for FORTIFY_SOURCES level 2 in target C library" >&5 -+echo $ECHO_N "checking for FORTIFY_SOURCES level 2 in target C library... $ECHO_C" >&6 -+if test "${gcc_cv_libc_provides_fortify2+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ gcc_cv_libc_provides_fortify2=no -+ case "$target" in -+ *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) -+ if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then -+ if test "x$with_sysroot" = x; then -+ glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include" -+ elif test "x$with_build_sysroot" != "x"; then -+ glibc_header_dir="${with_build_sysroot}/usr/include" -+ elif test "x$with_sysroot" = xyes; then -+ glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include" -+ else -+ glibc_header_dir="${with_sysroot}/usr/include" -+ fi -+ else -+ glibc_header_dir=/usr/include -+ fi -+ # grep __USE_FORTIFY_LEVEL 2 in $glibc_header_dir/features.h -+ if test -f $glibc_header_dir/features.h \ -+ && grep '__USE_FORTIFY_LEVEL 2' $glibc_header_dir/features.h > /dev/null; then -+ gcc_cv_libc_provides_fortify2=yes -+ else -+ gcc_cv_libc_provides_fortify2=no -+ fi -+ ;; -+ *) gcc_cv_libc_provides_fortify2=no ;; -+ esac -+fi -+echo "$as_me:$LINENO: result: $gcc_cv_libc_provides_fortify2" >&5 -+echo "${ECHO_T}$gcc_cv_libc_provides_fortify2" >&6 -+if test x$gcc_cv_libc_provides_fortify2 = xyes; then -+ -+cat >>confdefs.h <<_ACEOF -+#define TARGET_LIBC_PROVIDES_FORTIFY2 1 -+_ACEOF -+ -+fi -+ - # Test for stack protector support in target C library. - echo "$as_me:$LINENO: checking __stack_chk_fail in target C library" >&5 - echo $ECHO_N "checking __stack_chk_fail in target C library... $ECHO_C" >&6 -@@ -24375,6 +24467,42 @@ - - fi - -+if test x"$enable_libssp" = xyes; then -+ -+cat >>confdefs.h <<_ACEOF -+#define ENABLE_LIBSSP 1 -+_ACEOF -+ -+fi -+ -+# Check whether --enable-espf was given and we have -z now and -z relro support. -+# Check whether --enable-espf or --disable-espf was given. -+if test "${enable_espf+set}" = set; then -+ enableval="$enable_espf" -+ -+ case $target in -+ i?86*-*-linux* | x86_64*-*-linux*) -+ if test x$gcc_cv_ld_relro = xyes && test x"$gcc_cv_ld_now" = xyes; then -+ enable_espf=yes -+ else -+ enable_espf=no -+ fi -+ ;; -+ *) -+ enable_espf=no -+ ;; -+ esac -+ -+fi; -+if test x$enable_espf = xyes; then -+ -+cat >>confdefs.h <<_ACEOF -+#define ENABLE_ESPF 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. -@@ -25581,6 +25709,7 @@ - s,@gcc_cv_objdump@,$gcc_cv_objdump,;t t - s,@gcc_cv_readelf@,$gcc_cv_readelf,;t t - s,@libgcc_visibility@,$libgcc_visibility,;t t -+s,@enable_espf@,$enable_espf,;t t - s,@GGC@,$GGC,;t t - s,@zlibdir@,$zlibdir,;t t - s,@zlibinc@,$zlibinc,;t t -diff -Nur gcc-4.4.0_vanilla/gcc/espf.h gcc-4.4.0/gcc/espf.h ---- gcc-4.4.0_vanilla/gcc/espf.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.4.0/gcc/espf.h 2009-07-11 12:36:43.000000000 +0200 -@@ -0,0 +1,104 @@ -+#ifndef GCC_ESPF_H -+#define GCC_ESPF_H -+/* Version 0.2.20090614.1 (C) 2009 by Magnus Granberg zorry@ume.nu */ -+/* Gentoo espf.h patch Version 20090614.1 (C) 2009 by Magnus Granberg zorry@ume.nu */ -+ -+/* FIXME: -+ 1. Fix so that we can have -fPIE or -fpie options. -+*/ -+/* This file add's -fstack-protector-all, -Fpie|-fpie, -pie, -D_FORTIFY_SOURCES=2, -z relro, -z now, -Wformat -+ and -Wformat-security as default if the define's and the spec allow it. -+ -+ On Gentoo -+ Added a hack for gcc-specs-* in toolchain-funcs.eclass to support older hardened GCC patches and -+ we don't need to change the code on gcc-specs-*. -+ This will add some unsupported upstream commands options as -nopie and -z nonow. -+ -D__KERNEL__ is added so we don't have -fPIE|-fpie and -fstack-protector-all when building kernels. -+ ESPF_CC1_SPEC is added to CC1_SPEC. -+ -D_FORTIFY_SOURCES=2 is added with gentoo's patchset as default so no need to set it hear. -+ -Wformat* is added with gentoo's patchset as default so no need to set it hear. -+ -z relro is set by binutils as default so no need to set it hear. -+*/ -+ -+#ifdef ENABLE_ESPF -+ -+ /* Hack to support gcc-specs-* in toolchain-funcs.eclass */ -+ #define ESPF_CC1_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: %{!nopie: %{!fstrict-overflow: }}}}" -+ -+ /* This will add -Wformat -Wformat-security -Wstack-protector in espf_cc1_options_warnings and -fstack-protector-all in -+ espf_cc1_options_ssp and incompatible pie commands in espf_cc1_options_pie_incompatible. -+ ESPF_CC1_OPTIONS_SPEC is added to CC1_OPTIONS_SPEC in gcc/gcc.c */ -+ #define ESPF_CC1_OPTIONS_SPEC "%(espf_cc1_options_ssp) %(espf_cc1_options_pie_incompatible)" -+ -+ /* This will add -z now if we don't have -z nonow or -z lazy -+ ESPF_LINK_SPEC is added to LINK_COMMAND_SPEC in gcc/gcc.c */ -+ #define ESPF_LINK_SPEC "%{!now:%{!lazy:%{!nonow:-z now}}}" -+ -+ /* This will add -fstack-protector-all if we don't have -D__KERNEL__ -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector -+ -fstack-protector-all and we have ENABLE_LIBSSP or TARGET_LIBC_PROVIDES_SSP defined. */ -+ #if defined (ENABLE_LIBSSP) || defined (TARGET_LIBC_PROVIDES_SSP) -+ #define ESPF_CC1_OPTIONS_SSP_SPEC \ -+ "%{!D__KERNEL__:%{!nostdlib:%{!nodefaultlibs: %{!fno-stack-protector: \ -+ %{!fstack-protector:%{!fstack-protector-all:-fstack-protector-all}}}}}}" -+ #else -+ #define ESPF_CC1_OPTIONS_SSP_SPEC "" -+ #endif -+ -+ /* If HAVE_LD_PIE not defined we will not add any -pie -fPIE commands and incompatible pie check */ -+ #ifdef HAVE_LD_PIE -+ -+ /* This will add -fPIE if we don't have -D__KERNEL__ -pie -fpic -fPIC -fpie -fPIE -fno-pic -fno-PIC -fno-pie -fno-PIE -+ -shared -static -nostdlib -nostartfiles -nopie -+ We use ESPF_COMPILER_COMMAND_SPEC to add -fPIE before do_spec (compiler_command_spec) is run in gcc/gcc.c main() */ -+ #define ESPF_COMPILER_COMMAND_SPEC "%(espf_compiler_command_pie)" -+ #define ESPF_COMPILER_COMMAND_PIE_SPEC \ -+ "%{!D__KERNEL__:%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \ -+ %{!shared: %{!static: %{!nostdlib: %{!nostartfiles:%{!nopie:-fPIE}} } }}}} }}}} }}}}" -+ -+ /* This adds some incompatible rules for -pie and -shared -+ We can't have -shared when -static -pie -fPIE -fpie -fno-PIC -fno-pic -+ and -pie when -static -pg -p -profile */ -+ #define ESPF_CC1_OPTIONS_PIE_INCOMPATIBLE_SPEC \ -+ "%{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}} \ -+ %{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible}}" -+ -+ /* This will add -pie if we don't have -pie A -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static -r -+ -nostdlib -nostartfiles -nopie -+ We use ESPF_LINK_COMMAND_SPEC to add -pie before do_spec (link_command_spec) is run in gcc/gcc.c main() */ -+ #define ESPF_LINK_COMMAND_SPEC "%(espf_link_command_pie)" -+ #define ESPF_LINK_COMMAND_PIE_SPEC \ -+ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r: \ -+ %{!nostdlib:%{!nostartfiles:%{!nopie:-pie}}}}}}}}}}}}" -+ #else -+ #define ESPF_COMPILER_COMMAND_SPEC "" -+ #define ESPF_CC1_OPTIONS_PIE_INCOMPATIBLE_SPEC "" -+ #define ESPF_LINK_COMMAND_SPEC "" -+ #endif -+ -+ /* We add extra spec name's to the EXTRA_SPECS list */ -+ #define ESPF_EXTRA_SPECS \ -+ { "espf_link", ESPF_LINK_SPEC }, \ -+ { "espf_link_command", ESPF_LINK_COMMAND_SPEC }, \ -+ { "espf_link_command_pie", ESPF_LINK_COMMAND_PIE_SPEC }, \ -+ { "espf_compiler_command", ESPF_COMPILER_COMMAND_SPEC }, \ -+ { "espf_compiler_command_pie", ESPF_COMPILER_COMMAND_PIE_SPEC }, \ -+ { "espf_cc1", ESPF_CC1_SPEC }, \ -+ { "espf_cc1_options", ESPF_CC1_OPTIONS_SPEC }, \ -+ { "espf_cc1_options_ssp", ESPF_CC1_OPTIONS_SSP_SPEC }, \ -+ { "espf_cc1_options_pie_incompatible", ESPF_CC1_OPTIONS_PIE_INCOMPATIBLE_SPEC } -+ -+ static const char *cc1_spec = CC1_SPEC ESPF_CC1_SPEC; -+ static const char *espf_compiler_command_spec = ESPF_COMPILER_COMMAND_SPEC; -+ static const char *espf_link_command_spec = ESPF_LINK_COMMAND_SPEC; -+ -+#else -+ -+ #define ESPF_CC1_OPTIONS_SPEC "" -+ #define ESPF_LINK_SPEC "" -+ #define ESPF_EXTRA_SPECS \ -+ { "espf_cc1_options", ESPF_CC1_OPTIONS_SPEC }, \ -+ { "espf_link", ESPF_LINK_SPEC } -+ -+#endif -+ -+#endif /* End GCC_ESPF_H */ -diff -Nur gcc-4.4.0_vanilla/gcc/gcc.c gcc-4.4.0/gcc/gcc.c ---- gcc-4.4.0_vanilla/gcc/gcc.c 2009-03-17 22:25:59.000000000 +0100 -+++ gcc-4.4.0/gcc/gcc.c 2009-07-11 12:36:43.000000000 +0200 -@@ -83,6 +83,7 @@ - #include "gcc.h" - #include "flags.h" - #include "opts.h" -+#include "espf.h" /* for espf support */ - - /* By default there is no special suffix for target executables. */ - /* FIXME: when autoconf is fixed, remove the host check - dj */ -@@ -726,7 +727,7 @@ - #ifndef LINK_COMMAND_SPEC - #define LINK_COMMAND_SPEC "\ - %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ -- %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\ -+ %(linker) %l " LINK_PIE_SPEC " %(espf_link) %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\ - %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ - %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\ - %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)} %(mflib)\ -@@ -758,7 +759,9 @@ - - static const char *asm_debug; - static const char *cpp_spec = CPP_SPEC; -+#ifndef ENABLE_ESPF - 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; -@@ -826,6 +829,7 @@ - /* NB: This is shared amongst all front-ends, except for Ada. */ - static const char *cc1_options = - "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ -+ %(espf_cc1_options)\ - %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\ - %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}\ - %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs}\ -@@ -1628,7 +1632,7 @@ - const char *const ptr; - }; - --static const struct spec_list_1 extra_specs_1[] = { EXTRA_SPECS }; -+static const struct spec_list_1 extra_specs_1[] = { ESPF_EXTRA_SPECS, EXTRA_SPECS }; - static struct spec_list *extra_specs = (struct spec_list *) 0; - #endif - -@@ -6782,6 +6786,12 @@ - - if (input_file_compiler) - { -+ -+#ifdef ENABLE_ESPF -+ /* We add -fpie or -fPIE as default if the spec allow it */ -+ do_self_spec (espf_compiler_command_spec); -+#endif -+ - /* Ok, we found an applicable compiler. Run its spec. */ - - if (input_file_compiler->spec[0] == '#') -@@ -6873,6 +6883,10 @@ - " to the linker.\n\n")); - fflush (stdout); - } -+#ifdef ENABLE_ESPF -+ /* We add -pie as default if the spec allow it */ -+ do_self_spec (espf_link_command_spec); -+#endif - value = do_spec (link_command_spec); - if (value < 0) - error_count = 1; -diff -Nur gcc-4.4.0_vanilla/gcc/Makefile.in gcc-4.4.0/gcc/Makefile.in ---- gcc-4.4.0_vanilla/gcc/Makefile.in 2009-03-25 13:00:32.000000000 +0100 -+++ gcc-4.4.0/gcc/Makefile.in 2009-07-11 12:36:10.000000000 +0200 -@@ -580,13 +580,23 @@ - INHIBIT_LIBC_CFLAGS = -Dinhibit_libc - endif - -+# Doesn't compile with PIE or SSP -+enable_espf = @enable_espf@ -+ifeq ($(enable_espf),yes) -+ESPF_NOPIE_CFLAGS = -fno-PIE -+ESPF_NOSSP_CFLAGS = -fno-stack-protector -+else -+ESPF_NOPIE_CFLAGS= -+ESPF_NOSSP_CFLAGS= -+endif -+ - # Options to use when compiling libgcc2.a. - # - LIBGCC2_DEBUG_CFLAGS = -g - LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \ - $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \ - -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ -- $(INHIBIT_LIBC_CFLAGS) -+ $(INHIBIT_LIBC_CFLAGS) $(ESPF_NOSSP_CFLAGS) - - # Additional options to use when compiling libgcc2.a. - # Some targets override this to -isystem include -@@ -599,7 +609,7 @@ - CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ - -finhibit-size-directive -fno-inline-functions -fno-exceptions \ - -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \ -- $(INHIBIT_LIBC_CFLAGS) -+ $(INHIBIT_LIBC_CFLAGS) $(ESPF_NOSSP_CFLAGS) - - # Additional sources to handle exceptions; overridden by targets as needed. - LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ -@@ -1719,7 +1729,7 @@ - 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) $(ESPF_NOPIE_CFLAGS)' >> tmp-libgcc.mvars - echo CRTSTUFF_T_CFLAGS_S = '$(CRTSTUFF_T_CFLAGS_S)' >> tmp-libgcc.mvars - - mv tmp-libgcc.mvars libgcc.mvars -@@ -1754,12 +1764,14 @@ - $(T)crtbegin.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) \ -+ $(ESPF_NOPIE_CFLAGS) \ - -c $(srcdir)/crtstuff.c -DCRT_BEGIN \ - -o $(T)crtbegin$(objext) - - $(T)crtend.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) \ -+ $(ESPF_NOPIE_CFLAGS) \ - -c $(srcdir)/crtstuff.c -DCRT_END \ - -o $(T)crtend$(objext) - -@@ -1780,6 +1792,7 @@ - $(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) \ -+ $(ESPF_NOPIE_CFLAGS) \ - -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \ - -o $(T)crtbeginT$(objext) - -@@ -3057,7 +3070,7 @@ - output.h $(INSN_ATTR_H) $(SYSTEM_H) $(TOPLEV_H) $(TARGET_H) libfuncs.h \ - $(TARGET_DEF_H) $(FUNCTION_H) $(SCHED_INT_H) $(TM_P_H) $(EXPR_H) \ - langhooks.h $(GGC_H) $(OPTABS_H) $(REAL_H) tm-constrs.h $(GIMPLE_H) -- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ -+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(ESPF_NOSSP_CFLAGS)\ - $(out_file) $(OUTPUT_OPTION) - - # Build auxiliary files that support ecoff format. -diff -Nur gcc-4.4.0_vanilla/gcc/opts.c gcc-4.4.0/gcc/opts.c ---- gcc-4.4.0_vanilla/gcc/opts.c 2009-03-28 18:28:45.000000000 +0100 -+++ gcc-4.4.0/gcc/opts.c 2009-07-11 12:36:31.000000000 +0200 -@@ -897,7 +897,9 @@ - #endif - flag_regmove = opt2; - flag_strict_aliasing = opt2; -+#ifndef ENABLE_ESPF - flag_strict_overflow = opt2; -+#endif - flag_delete_null_pointer_checks = opt2; - flag_reorder_blocks = opt2; - flag_reorder_functions = opt2; -diff -Nur gcc-4.4.0_vanilla/gcc/varasm.c gcc-4.4.0/gcc/varasm.c ---- gcc-4.4.0_vanilla/gcc/varasm.c 2009-03-17 21:18:21.000000000 +0100 -+++ gcc-4.4.0/gcc/varasm.c 2009-07-11 12:36:25.000000000 +0200 -@@ -5607,7 +5607,11 @@ - bool is_local; - - is_local = targetm.binds_local_p (decl); -- if (!flag_shlib) -+ #ifdef ENABLE_ESPF -+ if (!flag_pic) -+ #else -+ if (!flag_shlib) -+ #endif - { - if (is_local) - kind = TLS_MODEL_LOCAL_EXEC; diff --git a/pkgs/toolchain/gcc-static/patches/gcc-4.5.0-piepatches-20100421.patch b/pkgs/toolchain/gcc-static/patches/gcc-4.5.0-piepatches-20100421.patch new file mode 100644 index 0000000..e525d5b --- /dev/null +++ b/pkgs/toolchain/gcc-static/patches/gcc-4.5.0-piepatches-20100421.patch @@ -0,0 +1,1056 @@ +diff -Nur gcc-4.5.0-vanilla/configure gcc-4.5.0/configure +--- gcc-4.5.0-vanilla/configure 2010-04-02 19:35:47.000000000 +0200 ++++ gcc-4.5.0/configure 2010-04-21 15:21:09.762948361 +0200 +@@ -707,6 +707,7 @@ + CFLAGS + CC + target_subdir ++enable_esp + host_subdir + build_subdir + build_libsubdir +@@ -1485,6 +1486,11 @@ + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-gold use gold instead of ld + --enable-libada build libada directory ++ --enable-esp ++ Enable Stack protector, Position independent executable and ++ Fortify_sources 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*, ia64, arm* and mips + --enable-libssp build libssp directory + --enable-build-with-cxx build with C++ compiler instead of C compiler + --disable-ppl-version-check disable check for PPL version +@@ -3164,6 +3170,24 @@ + noconfigdirs="$noconfigdirs gnattools" + fi + ++# Check whether --enable-esp was given and target have the support. ++# Check whether --enable-esp or --disable-esp was given. ++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* | mips-*-linux*) ++ enable_esp=yes ++ ;; ++ *) ++ { { echo "$as_me:$LINENO: error: *** --enable-esp is not supported on this $target target." >&5 ++echo "$as_me: error: *** --enable-esp is not supported on this $target target." >&2;} ++ { (exit 1); exit 1; }; } ++ ;; ++ esac ++ ++fi; ++ + # Check whether --enable-libssp was given. + if test "${enable_libssp+set}" = set; then : + enableval=$enable_libssp; ENABLE_LIBSSP=$enableval +@@ -14290,6 +14314,9 @@ + *) stage1_cflags="-g -J" ;; + esac ;; + esac ++if test x$enable_esp = xyes; then ++ stage1_cflags="$stage1_cflags -fno-stack-protector" ++fi + + # This is aimed to mimic bootstrap with a non-GCC compiler to catch problems. + if test "$GCC" = yes -a "$ENABLE_BUILD_WITH_CXX" != yes; then +diff -Nur gcc-4.5.0-vanilla/gcc/config/i386/linux64.h gcc-4.5.0/gcc/config/i386/linux64.h +--- gcc-4.5.0-vanilla/gcc/config/i386/linux64.h 2010-03-24 21:44:48.000000000 +0100 ++++ gcc-4.5.0/gcc/config/i386/linux64.h 2010-04-21 15:21:16.730815972 +0200 +@@ -115,7 +115,7 @@ + /* This macro may be overridden in i386/k*bsd-gnu.h. */ + #define REG_NAME(reg) reg + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* i386 glibc provides __stack_chk_guard in %gs:0x14, + x86_64 glibc provides it in %fs:0x28. */ + #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14) +diff -Nur gcc-4.5.0-vanilla/gcc/config/i386/linux.h gcc-4.5.0/gcc/config/i386/linux.h +--- gcc-4.5.0-vanilla/gcc/config/i386/linux.h 2010-03-24 21:44:48.000000000 +0100 ++++ gcc-4.5.0/gcc/config/i386/linux.h 2010-04-21 15:21:16.721813554 +0200 +@@ -212,7 +212,7 @@ + /* This macro may be overridden in i386/k*bsd-gnu.h. */ + #define REG_NAME(reg) reg + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* i386 glibc provides __stack_chk_guard in %gs:0x14. */ + #define TARGET_THREAD_SSP_OFFSET 0x14 + #endif +diff -Nur gcc-4.5.0-vanilla/gcc/config/linux.h gcc-4.5.0/gcc/config/linux.h +--- gcc-4.5.0-vanilla/gcc/config/linux.h 2009-04-09 17:00:19.000000000 +0200 ++++ gcc-4.5.0/gcc/config/linux.h 2010-04-21 15:21:16.667815357 +0200 +@@ -43,7 +43,11 @@ + object constructed before entering `main'. */ + + #undef STARTFILE_SPEC +-#if defined HAVE_LD_PIE ++#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINTS) ++#define 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 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.5.0-vanilla/gcc/config/rs6000/linux64.h gcc-4.5.0/gcc/config/rs6000/linux64.h +--- gcc-4.5.0-vanilla/gcc/config/rs6000/linux64.h 2010-03-17 05:44:37.000000000 +0100 ++++ gcc-4.5.0/gcc/config/rs6000/linux64.h 2010-04-21 15:21:16.732816308 +0200 +@@ -162,7 +162,7 @@ + #endif + + #define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \ +-%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \ ++%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} \ + %{memb} %{!memb: %{msdata=eabi: -memb}} \ + %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \ + %{mcall-freebsd: -mbig} \ +@@ -525,7 +525,7 @@ + + #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* ppc32 glibc provides __stack_chk_guard in -0x7008(2), + ppc64 glibc provides it at -0x7010(13). */ + #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008) +diff -Nur gcc-4.5.0-vanilla/gcc/config/rs6000/linux.h gcc-4.5.0/gcc/config/rs6000/linux.h +--- gcc-4.5.0-vanilla/gcc/config/rs6000/linux.h 2007-08-02 12:49:31.000000000 +0200 ++++ gcc-4.5.0/gcc/config/rs6000/linux.h 2010-04-21 15:21:16.731819651 +0200 +@@ -117,7 +117,7 @@ + + #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* ppc32 glibc provides __stack_chk_guard in -0x7008(2). */ + #define TARGET_THREAD_SSP_OFFSET -0x7008 + #endif +diff -Nur gcc-4.5.0-vanilla/gcc/config/rs6000/sysv4.h gcc-4.5.0/gcc/config/rs6000/sysv4.h +--- gcc-4.5.0-vanilla/gcc/config/rs6000/sysv4.h 2009-11-25 21:23:20.000000000 +0100 ++++ gcc-4.5.0/gcc/config/rs6000/sysv4.h 2010-04-21 15:21:16.674812959 +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 -Nur gcc-4.5.0-vanilla/gcc/config/s390/linux.h gcc-4.5.0/gcc/config/s390/linux.h +--- gcc-4.5.0-vanilla/gcc/config/s390/linux.h 2007-08-02 12:49:31.000000000 +0200 ++++ gcc-4.5.0/gcc/config/s390/linux.h 2010-04-21 15:21:16.738814124 +0200 +@@ -93,7 +93,7 @@ + + #define MD_UNWIND_SUPPORT "config/s390/linux-unwind.h" + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* s390 glibc provides __stack_chk_guard in 0x14(tp), + s390x glibc provides it at 0x28(tp). */ + #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14) +diff -Nur gcc-4.5.0-vanilla/gcc/config/sparc/linux64.h gcc-4.5.0/gcc/config/sparc/linux64.h +--- gcc-4.5.0-vanilla/gcc/config/sparc/linux64.h 2009-12-08 00:31:01.000000000 +0100 ++++ gcc-4.5.0/gcc/config/sparc/linux64.h 2010-04-21 15:21:16.749816158 +0200 +@@ -298,7 +298,7 @@ + #undef NEED_INDICATE_EXEC_STACK + #define NEED_INDICATE_EXEC_STACK 1 + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14], + sparc64 glibc provides it at [%g7 + 0x28]. */ + #define TARGET_THREAD_SSP_OFFSET (TARGET_ARCH64 ? 0x28 : 0x14) +diff -Nur gcc-4.5.0-vanilla/gcc/config/sparc/linux.h gcc-4.5.0/gcc/config/sparc/linux.h +--- gcc-4.5.0-vanilla/gcc/config/sparc/linux.h 2009-12-08 00:31:01.000000000 +0100 ++++ gcc-4.5.0/gcc/config/sparc/linux.h 2010-04-21 15:21:16.746815839 +0200 +@@ -172,7 +172,7 @@ + #undef NEED_INDICATE_EXEC_STACK + #define NEED_INDICATE_EXEC_STACK 1 + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14]. */ + #define TARGET_THREAD_SSP_OFFSET 0x14 + #endif +diff -Nur gcc-4.5.0-vanilla/gcc/config.in gcc-4.5.0/gcc/config.in +--- gcc-4.5.0-vanilla/gcc/config.in 2010-04-14 11:30:07.000000000 +0200 ++++ gcc-4.5.0/gcc/config.in 2010-04-21 15:21:09.879812904 +0200 +@@ -52,6 +52,12 @@ + #endif + + ++/* Define to 1 to enable crtbeginTS.o. */ ++#ifndef USED_FOR_TARGET ++#undef ENABLE_CRTBEGINTS ++#endif ++ ++ + /* Define to 1 to specify that we are using the BID decimal floating point + format instead of DPD */ + #ifndef USED_FOR_TARGET +@@ -71,6 +77,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 +@@ -996,6 +1008,12 @@ + #endif + + ++/* Define to 1 if your compiler supports -fstack-protector */ ++#ifndef USED_FOR_TARGET ++#undef HAVE_GCC_SSP ++#endif ++ ++ + /* Define to 1 if you have the `getchar_unlocked' function. */ + #ifndef USED_FOR_TARGET + #undef HAVE_GETCHAR_UNLOCKED +diff -Nur gcc-4.5.0-vanilla/gcc/configure gcc-4.5.0/gcc/configure +--- gcc-4.5.0-vanilla/gcc/configure 2010-03-26 06:40:32.000000000 +0100 ++++ gcc-4.5.0/gcc/configure 2010-04-21 15:21:09.784072083 +0200 +@@ -678,6 +678,8 @@ + HOST_LIBS + GGC + libgcc_visibility ++enable_esp ++enable_crtbeginTS + gcc_cv_readelf + gcc_cv_objdump + ORIGINAL_NM_FOR_TARGET +@@ -24576,6 +24578,50 @@ + ;; + esac + ++echo "$as_me:$LINENO: checking linker -z now support" >&5 ++echo $ECHO_N "checking linker -z now support... $ECHO_C" >&6 ++if test "${gcc_cv_ld_now+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&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 ++echo "$as_me:$LINENO: result: $gcc_cv_ld_now" >&5 ++echo "${ECHO_T}$gcc_cv_ld_now" >&6 ++ ++echo "$as_me:$LINENO: checking linker -z relro support" >&5 ++echo $ECHO_N "checking linker -z relro support... $ECHO_C" >&6 ++if test "${gcc_cv_ld_relro+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ gcc_cv_ld_relro=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_relro=yes ++ fi ++elif test x$gcc_cv_ld != x; then ++ # Check if linker supports -z relro and -z norelro options ++ if $gcc_cv_ld --help 2>/dev/null | grep relro > /dev/null; then ++ gcc_cv_ld_relro=yes ++ fi ++fi ++ ++fi ++echo "$as_me:$LINENO: result: $gcc_cv_ld_relro" >&5 ++echo "${ECHO_T}$gcc_cv_ld_relro" >&6 ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --build-id support" >&5 + $as_echo_n "checking linker --build-id support... " >&6; } + if test "${gcc_cv_ld_buildid+set}" = set; then : +@@ -24729,6 +24775,146 @@ + + fi + ++if test x$gcc_cv_libc_provides_ssp = xyes; then ++ echo "$as_me:$LINENO: checking whether $CC support -fstack-protector" >&5 ++echo $ECHO_N "checking whether $CC support -fstack-protector... $ECHO_C" >&6 ++if test "${gcc_cv_cc_stack_protector+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ++ saved_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -fstack-protector" ++ cat >conftest.$ac_ext <<_ACEOF ++#ifndef __SSP__ ++#error ++#endif ++ ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: "$ac_compile"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: $? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: "$ac_try"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: $? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: "$ac_try"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: $? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ++ case $target in ++ i?86*-*-linux* | x86_64*-*-linux* | powerpc-*-linux* | powerpc64-*-linux*) ++ if test x$set_have_as_tls = xyes; then ++ gcc_cv_cc_stack_protector=yes ++ else ++ gcc_cv_cc_stack_protector=no ++ fi ++ ;; ++ *) ++ cc_cv_cc_stack_protector=yes ++ ;; ++ esac ++ ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++gcc_cv_cc_stack_protector=no ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ CFLAGS="$saved_CFLAGS" ++ ++fi ++echo "$as_me:$LINENO: result: $gcc_cv_cc_stack_protector" >&5 ++echo "${ECHO_T}$gcc_cv_cc_stack_protector" >&6 ++fi ++if test x$gcc_cv_cc_stack_protector = xyes; then ++ ++cat >>confdefs.h <<_ACEOF ++#define HAVE_GCC_SSP 1 ++_ACEOF ++ ++fi ++ ++ ++if test x$enable_esp = xyes ; then ++case $target in ++ ia64*-*-linux*) ++ if test x$gcc_cv_ld_now = xyes; then ++ enable_esp_ld=yes ++ else ++ enable_esp_ld=no ++ fi ++ ;; ++ *-*-linux*) ++ if test x$gcc_cv_ld_relro = xyes && test x$gcc_cv_ld_now = xyes; then ++ enable_esp_ld=yes ++ else ++ enable_esp_ld=no ++ fi ++ ;; ++ *) ++ enable_esp_ld=no ++ ;; ++ esac ++else ++ enable_esp_ld=no ++fi ++if test x$enable_esp_ld = xyes; then ++ ++cat >>confdefs.h <<_ACEOF ++#define ENABLE_ESP 1 ++_ACEOF ++ ++fi ++if test x$enable_esp = xyes && test x$enable_esp_ld = xno; then ++ { { echo "$as_me:$LINENO: error: *** --enable-esp is not supported. You don't have -z,relro or -z,now support in the linker." >&5 ++echo "$as_me: error: *** --enable-esp is not supported. You don't have -z,relro or -z,now support in the linker." >&2;} ++ { (exit 1); exit 1; }; } ++fi ++ ++echo "$as_me:$LINENO: checking for crtbeginTS.o support" >&5 ++echo $ECHO_N "checking for crtbeginTS.o support... $ECHO_C" >&6 ++if test "${enable_crtbeginTS+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ++if test x$enable_esp = xyes ; then ++ case "$target" in ++ ia64*-*-linux*) ++ enable_crtbeginTS=no ;; ++ *-*-linux*) ++ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then ++ enable_crtbeginTS=yes ++ fi ++ ;; ++ *) enable_crtbeginTS=no ;; ++ esac ++fi ++ ++fi ++echo "$as_me:$LINENO: result: $enable_crtbeginTS" >&5 ++echo "${ECHO_T}$enable_crtbeginTS" >&6 ++ ++if test x$enable_crtbeginTS = xyes; then ++ ++cat >>confdefs.h <<_ACEOF ++#define ENABLE_CRTBEGINTS 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 -Nur gcc-4.5.0-vanilla/gcc/cp/lang-specs.h gcc-4.5.0/gcc/cp/lang-specs.h +--- gcc-4.5.0-vanilla/gcc/cp/lang-specs.h 2007-08-06 13:10:19.000000000 +0200 ++++ gcc-4.5.0/gcc/cp/lang-specs.h 2010-04-21 15:21:16.684816335 +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 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + %{!fsyntax-only:-o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {"@c++", +@@ -57,11 +57,11 @@ + %(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 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + %{!fsyntax-only:%(invoke_as)}}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {".ii", "@c++-cpp-output", 0, 0, 0}, + {"@c++-cpp-output", + "%{!M:%{!MM:%{!E:\ +- cc1plus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ ++ cc1plus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, +diff -Nur gcc-4.5.0-vanilla/gcc/doc/invoke.texi gcc-4.5.0/gcc/doc/invoke.texi +--- gcc-4.5.0-vanilla/gcc/doc/invoke.texi 2010-04-06 16:02:22.000000000 +0200 ++++ gcc-4.5.0/gcc/doc/invoke.texi 2010-04-21 15:21:16.796812184 +0200 +@@ -7856,6 +7856,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 +@@ -8705,6 +8710,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 +@@ -17251,6 +17262,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.5.0-vanilla/gcc/esp.h gcc-4.5.0/gcc/esp.h +--- gcc-4.5.0-vanilla/gcc/esp.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.5.0/gcc/esp.h 2010-04-21 15:21:16.622811922 +0200 +@@ -0,0 +1,148 @@ ++/* License terms see GNU GENERAL PUBLIC LICENSE Version 3. ++ * Version 20100409.1 ++ * Magnus Granberg (Zorry) zorry@gentoo.org */ ++#ifndef GCC_ESP_H ++#define GCC_ESP_H ++ ++/* This file will add -fstack-protector, -fPIE, -pie -D_FORTIFY_SOURCES=2 -z,relro and -z,now ++ as default if the defines and the spec allow it. ++ ++ On Gentoo ++ 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. ++ We use -fstack-protector-all instead of -fstack-protector ++ This will add some unsupported upstream commands options as -nopie. ++ -D__KERNEL__ is added so we don't have -fPIE and -fstack-protector-all when building kernels. ++ ESP_CC1_SPEC is added to CC1_SPEC. ++ -D_FORTIFY_SOURCES=2 is added with gentoo's patchset as default so no need to set it hear. ++ ESP_LINK_SPEC will not add -z,relro as it default on with binutils. ++ ESP_CC1_STRICT_SPEC is added so we don't use gcc/opts.c to disable it. ++ ESP_OPTIONS_PIE_CHECK_SPEC check for -pie, -p, -pg, -profile, -static and -shared. ++ 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)" ++ #ifdef HAVE_GCC_SSP ++ #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: }}" ++ #else ++ #define ESP_CC1_SSP_SPEC "" ++ #endif ++ #define ESP_CC1_PIE_SPEC "%{!nopie: }" ++ #define ESP_CC1_STRICT_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 */ ++ #define ESP_LINK_SPEC "%(esp_link_now)" ++ #define ESP_LINK_NOW_SPEC "%{!now:-z now}" ++ ++ /* 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 TARGET_LIBC_PROVIDES_SSP and HAVE_GCC_SSP defined. */ ++ #ifdef HAVE_GCC_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 HAVE_LD_PIE not defined we will not add any -fPIE -pie */ ++ #ifdef HAVE_LD_PIE ++ ++ /* 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)}}" ++ ++ /* 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 shared is set when -static -pie -fPIE -fpie -fno-PIC -fno-pic, -pie is set when -static -pg -p -profile. ++ If set it will make gcc print out "-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible" or ++ "-pie and pg|p|profile are incompatible" */ ++ /* With ENABLE_CRTBEGINTS we don't need to check for -static */ ++ #ifdef ENABLE_CRTBEGINTS ++ #define ESP_OPTIONS_PIE_CHECK_SPEC \ ++ "%{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}} \ ++ %{pie:%{pg|p|profile:%e-pie and -pg|p|profile are incompatible}}" ++ #else ++ #define ESP_OPTIONS_PIE_CHECK_SPEC \ ++ "%{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}} \ ++ %{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible}}" ++ #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_OPTIONS_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", ESP_CC1_STRICT_SPEC }, \ ++ { "esp_link", ESP_LINK_SPEC }, \ ++ { "esp_link_now", ESP_LINK_NOW_SPEC }, \ ++ { "esp_link_pie", ESP_LINK_PIE_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_pie_check", ESP_OPTIONS_PIE_CHECK_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.5.0-vanilla/gcc/gcc.c gcc-4.5.0/gcc/gcc.c +--- gcc-4.5.0-vanilla/gcc/gcc.c 2010-02-11 13:23:08.000000000 +0100 ++++ gcc-4.5.0/gcc/gcc.c 2010-04-21 15:21:16.589812777 +0200 +@@ -84,6 +84,7 @@ + #include "gcc.h" + #include "flags.h" + #include "opts.h" ++#include "esp.h" /* for --enable-esp support */ + + #ifdef HAVE_MMAP_FILE + # include <sys/mman.h> +@@ -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; +@@ -885,7 +888,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. */ +@@ -893,6 +896,9 @@ + + /* NB: This is shared amongst all front-ends, except for Ada. */ + static const char *cc1_options = ++#ifdef ENABLE_ESP ++"%(esp_options_pie_check)" ++#endif + "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %1 %{!Q:-quiet} %{!dumpbase:-dumpbase %B} %{d*} %{m*} %{a*}\ + %{fcompare-debug-second:%:compare-debug-auxbase-opt(%b)} \ +@@ -1075,15 +1081,15 @@ + %{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)}} \ + %{combine:\ + %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \ + %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i}}\ + %{!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, 1, 1}, + {"-", + "%{!E:%e-E or -x required when input is from standard input}\ +@@ -1106,7 +1112,7 @@ + %W{o*:--output-pch=%*}%V}}}}}}", 0, 0, 0}, + {".i", "@cpp-output", 0, 1, 0}, + {"@cpp-output", +- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0}, ++ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(esp_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0}, + {".s", "@assembler", 0, 1, 0}, + {"@assembler", + "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 1, 0}, +@@ -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--) + { +@@ -7111,6 +7120,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.5.0-vanilla/gcc/Makefile.in gcc-4.5.0/gcc/Makefile.in +--- gcc-4.5.0-vanilla/gcc/Makefile.in 2010-04-02 09:49:06.000000000 +0200 ++++ gcc-4.5.0/gcc/Makefile.in 2010-04-21 15:21:10.033812913 +0200 +@@ -636,13 +636,24 @@ + INHIBIT_LIBC_CFLAGS = -Dinhibit_libc + endif + ++# We don't want __stack_chk_fail in crt* and libgcc2.a. ++# We don't want to compile crtbegin, crtend and crtbeginT with -fPIE. ++enable_esp = @enable_esp@ ++ifeq ($(enable_esp),yes) ++ESP_NOPIE_CFLAGS = -fno-PIE ++ESP_NOSSP_CFLAGS = -fno-stack-protector ++else ++ESP_NOPIE_CFLAGS= ++ESP_NOSSP_CFLAGS= ++endif ++ + # Options to use when compiling libgcc2.a. + # + LIBGCC2_DEBUG_CFLAGS = -g + LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \ + $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \ + -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ +- $(INHIBIT_LIBC_CFLAGS) ++ $(INHIBIT_LIBC_CFLAGS) $(ESP_NOSSP_CFLAGS) + + # Additional options to use when compiling libgcc2.a. + # Some targets override this to -isystem include +@@ -655,7 +666,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 \ +- $(INHIBIT_LIBC_CFLAGS) ++ $(INHIBIT_LIBC_CFLAGS) $(ESP_NOSSP_CFLAGS) + + # Additional sources to handle exceptions; overridden by targets as needed. + LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ +@@ -685,6 +696,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@ +@@ -1863,9 +1880,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 + +@@ -1899,12 +1917,14 @@ + $(T)crtbegin.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 \ + -o $(T)crtbegin$(objext) + + $(T)crtend.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_END \ + -o $(T)crtend$(objext) + +@@ -1925,9 +1945,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 +diff -Nur gcc-4.5.0-vanilla/gcc/objc/lang-specs.h gcc-4.5.0/gcc/objc/lang-specs.h +--- gcc-4.5.0-vanilla/gcc/objc/lang-specs.h 2007-08-02 12:37:36.000000000 +0200 ++++ gcc-4.5.0/gcc/objc/lang-specs.h 2010-04-21 15:21:16.702913793 +0200 +@@ -30,13 +30,13 @@ + %{traditional|ftraditional|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}, + {".mi", "@objc-cpp-output", 0, 0, 0}, + {"@objc-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}, + {"@objective-c-header", + "%{E|M|MM:cc1obj -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}\ +@@ -45,10 +45,10 @@ + %{traditional|ftraditional|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}, +diff -Nur gcc-4.5.0-vanilla/gcc/objcp/lang-specs.h gcc-4.5.0/gcc/objcp/lang-specs.h +--- gcc-4.5.0-vanilla/gcc/objcp/lang-specs.h 2007-08-02 12:38:44.000000000 +0200 ++++ gcc-4.5.0/gcc/objcp/lang-specs.h 2010-04-21 15:21:16.708817730 +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 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {"@objective-c++", +@@ -46,15 +46,15 @@ + %(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 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + %{!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 %{+e*}\ ++ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, + {"@objc++-cpp-output", + "%{!M:%{!MM:%{!E:\ +- cc1objplus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ ++ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, +diff -Nur gcc-4.5.0-vanilla/gcc/varasm.c gcc-4.5.0/gcc/varasm.c +--- gcc-4.5.0-vanilla/gcc/varasm.c 2010-03-27 12:56:30.000000000 +0100 ++++ gcc-4.5.0/gcc/varasm.c 2010-04-21 15:21:16.606812404 +0200 +@@ -5961,7 +5961,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.5.0-vanilla/libgcc/Makefile.in gcc-4.5.0/libgcc/Makefile.in +--- gcc-4.5.0-vanilla/libgcc/Makefile.in 2010-03-30 15:08:52.000000000 +0200 ++++ gcc-4.5.0/libgcc/Makefile.in 2010-04-21 15:21:10.824811514 +0200 +@@ -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 -Nur gcc-4.5.0-vanilla/libmudflap/configure gcc-4.5.0/libmudflap/configure +--- gcc-4.5.0-vanilla/libmudflap/configure 2009-12-05 18:18:53.000000000 +0100 ++++ gcc-4.5.0/libmudflap/configure 2010-04-21 15:21:09.843811773 +0200 +@@ -652,6 +652,7 @@ + MAINTAINER_MODE_FALSE + MAINTAINER_MODE_TRUE + am__untar ++enable_esp + am__tar + AMTAR + am__leading_dot +diff -Nur gcc-4.5.0-vanilla/libmudflap/Makefile.in gcc-4.5.0/libmudflap/Makefile.in +--- gcc-4.5.0-vanilla/libmudflap/Makefile.in 2010-04-02 20:18:06.000000000 +0200 ++++ gcc-4.5.0/libmudflap/Makefile.in 2010-04-21 15:21:10.844815108 +0200 +@@ -304,10 +304,18 @@ + MAINT_CHARSET = latin1 + SUBDIRS = testsuite + ++# Some stuff don't compile with PIE or SSP ++enable_esp = @enable_esp@ ++ifeq ($(enable_esp),yes) ++NO_ESP_CFLAGS = -fno-stack-protector -U_FORTIFY_SOURCE ++else ++NO_ESP_CFLAGS = ++endif ++ + # May be used by various substitution variables. + gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) +-AM_CFLAGS = -Wall $(SECTION_FLAGS) +-@LIBMUDFLAPTH_FALSE@libmudflapth = ++AM_CFLAGS = -Wall $(SECTION_FLAGS) $(NO_ESP_CFLAGS) ++@LIBMUDFLAPTH_FALSE@libmudflapth = + @LIBMUDFLAPTH_TRUE@libmudflapth = libmudflapth.la + toolexeclib_LTLIBRARIES = libmudflap.la $(libmudflapth) + libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include +diff -Nur gcc-4.5.0-vanilla/Makefile.in gcc-4.5.0/Makefile.in +--- gcc-4.5.0-vanilla/Makefile.in 2010-02-17 12:01:44.000000000 +0100 ++++ gcc-4.5.0/Makefile.in 2010-04-21 15:21:10.022812548 +0200 +@@ -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 + +@@ -397,9 +405,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) + + TFLAGS = + diff --git a/pkgs/toolchain/gcc/gcc.nm b/pkgs/toolchain/gcc/gcc.nm index 3fda3d7..dbe5965 100644 --- a/pkgs/toolchain/gcc/gcc.nm +++ b/pkgs/toolchain/gcc/gcc.nm @@ -36,7 +36,7 @@ define STAGE_BUILD --disable-libstdcxx-pch \ --disable-multilib \ --disable-libssp \ - --enable-espf \ + --enable-esp \ \ $(CONFIG_CPU)
diff --git a/pkgs/toolchain/gcc/patches/gcc-4.4.1-espf-1.patch b/pkgs/toolchain/gcc/patches/gcc-4.4.1-espf-1.patch deleted file mode 100644 index e531e13..0000000 --- a/pkgs/toolchain/gcc/patches/gcc-4.4.1-espf-1.patch +++ /dev/null @@ -1,504 +0,0 @@ -diff -Nur gcc-4.4.0_vanilla/gcc/config.in gcc-4.4.0/gcc/config.in ---- gcc-4.4.0_vanilla/gcc/config.in 2009-04-21 11:08:08.000000000 +0200 -+++ gcc-4.4.0/gcc/config.in 2009-07-11 12:35:50.000000000 +0200 -@@ -65,6 +65,12 @@ - #endif - - -+/* Define to 1 to enable espf. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_ESPF -+#endif -+ -+ - /* Define to 1 to enable fixed-point arithmetic extension to C. */ - #ifndef USED_FOR_TARGET - #undef ENABLE_FIXED_POINT -@@ -101,6 +107,12 @@ - #endif - - -+/* Define to 1 to enable libssp. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_LIBSSP -+#endif -+ -+ - /* Define to 1 if translation of program messages to the user's native - language is requested. */ - #ifndef USED_FOR_TARGET -@@ -1465,6 +1477,12 @@ - #endif - - -+/* Define if your target C library provides fortify_sources level 2 support */ -+#ifndef USED_FOR_TARGET -+#undef TARGET_LIBC_PROVIDES_FORTIFY2 -+#endif -+ -+ - /* Define if your target C library provides stack protector support */ - #ifndef USED_FOR_TARGET - #undef TARGET_LIBC_PROVIDES_SSP -diff -Nur gcc-4.4.0_vanilla/gcc/configure gcc-4.4.0/gcc/configure ---- gcc-4.4.0_vanilla/gcc/configure 2009-03-24 18:46:03.000000000 +0100 -+++ gcc-4.4.0/gcc/configure 2009-07-11 12:35:57.000000000 +0200 -@@ -458,7 +458,7 @@ - # include <unistd.h> - #endif" - --ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC STMP_FIXPROTO collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC LIBOBJS LTLIBOBJS' -+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC STMP_FIXPROTO collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility enable_espf GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC LIBOBJS LTLIBOBJS' - ac_subst_files='language_hooks' - ac_pwd=`pwd` - -@@ -1078,6 +1078,11 @@ - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) -+ --enable-espf -+ Enable Stack protector, Position independent executable and -+ Fortify_sources 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 - --enable-maintainer-mode - enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer -@@ -24177,6 +24182,50 @@ - ;; - esac - -+echo "$as_me:$LINENO: checking linker -z now support" >&5 -+echo $ECHO_N "checking linker -z now support... $ECHO_C" >&6 -+if test "${gcc_cv_ld_now+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 -+echo "$as_me:$LINENO: result: $gcc_cv_ld_now" >&5 -+echo "${ECHO_T}$gcc_cv_ld_now" >&6 -+ -+echo "$as_me:$LINENO: checking linker -z relro support" >&5 -+echo $ECHO_N "checking linker -z relro support... $ECHO_C" >&6 -+if test "${gcc_cv_ld_relro+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ gcc_cv_ld_relro=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_relro=yes -+ fi -+elif test x$gcc_cv_ld != x; then -+ # Check if linker supports -z relro and -z norelro options -+ if $gcc_cv_ld --help 2>/dev/null | grep relro > /dev/null; then -+ gcc_cv_ld_relro=yes -+ fi -+fi -+ -+fi -+echo "$as_me:$LINENO: result: $gcc_cv_ld_relro" >&5 -+echo "${ECHO_T}$gcc_cv_ld_relro" >&6 -+ - echo "$as_me:$LINENO: checking linker --sysroot support" >&5 - echo $ECHO_N "checking linker --sysroot support... $ECHO_C" >&6 - if test "${gcc_cv_ld_sysroot+set}" = set; then -@@ -24213,6 +24262,49 @@ - - fi - -+# Test for fortify_sources support level 2 in target C library. -+echo "$as_me:$LINENO: checking for FORTIFY_SOURCES level 2 in target C library" >&5 -+echo $ECHO_N "checking for FORTIFY_SOURCES level 2 in target C library... $ECHO_C" >&6 -+if test "${gcc_cv_libc_provides_fortify2+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ gcc_cv_libc_provides_fortify2=no -+ case "$target" in -+ *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) -+ if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then -+ if test "x$with_sysroot" = x; then -+ glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include" -+ elif test "x$with_build_sysroot" != "x"; then -+ glibc_header_dir="${with_build_sysroot}/usr/include" -+ elif test "x$with_sysroot" = xyes; then -+ glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include" -+ else -+ glibc_header_dir="${with_sysroot}/usr/include" -+ fi -+ else -+ glibc_header_dir=/usr/include -+ fi -+ # grep __USE_FORTIFY_LEVEL 2 in $glibc_header_dir/features.h -+ if test -f $glibc_header_dir/features.h \ -+ && grep '__USE_FORTIFY_LEVEL 2' $glibc_header_dir/features.h > /dev/null; then -+ gcc_cv_libc_provides_fortify2=yes -+ else -+ gcc_cv_libc_provides_fortify2=no -+ fi -+ ;; -+ *) gcc_cv_libc_provides_fortify2=no ;; -+ esac -+fi -+echo "$as_me:$LINENO: result: $gcc_cv_libc_provides_fortify2" >&5 -+echo "${ECHO_T}$gcc_cv_libc_provides_fortify2" >&6 -+if test x$gcc_cv_libc_provides_fortify2 = xyes; then -+ -+cat >>confdefs.h <<_ACEOF -+#define TARGET_LIBC_PROVIDES_FORTIFY2 1 -+_ACEOF -+ -+fi -+ - # Test for stack protector support in target C library. - echo "$as_me:$LINENO: checking __stack_chk_fail in target C library" >&5 - echo $ECHO_N "checking __stack_chk_fail in target C library... $ECHO_C" >&6 -@@ -24375,6 +24467,42 @@ - - fi - -+if test x"$enable_libssp" = xyes; then -+ -+cat >>confdefs.h <<_ACEOF -+#define ENABLE_LIBSSP 1 -+_ACEOF -+ -+fi -+ -+# Check whether --enable-espf was given and we have -z now and -z relro support. -+# Check whether --enable-espf or --disable-espf was given. -+if test "${enable_espf+set}" = set; then -+ enableval="$enable_espf" -+ -+ case $target in -+ i?86*-*-linux* | x86_64*-*-linux*) -+ if test x$gcc_cv_ld_relro = xyes && test x"$gcc_cv_ld_now" = xyes; then -+ enable_espf=yes -+ else -+ enable_espf=no -+ fi -+ ;; -+ *) -+ enable_espf=no -+ ;; -+ esac -+ -+fi; -+if test x$enable_espf = xyes; then -+ -+cat >>confdefs.h <<_ACEOF -+#define ENABLE_ESPF 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. -@@ -25581,6 +25709,7 @@ - s,@gcc_cv_objdump@,$gcc_cv_objdump,;t t - s,@gcc_cv_readelf@,$gcc_cv_readelf,;t t - s,@libgcc_visibility@,$libgcc_visibility,;t t -+s,@enable_espf@,$enable_espf,;t t - s,@GGC@,$GGC,;t t - s,@zlibdir@,$zlibdir,;t t - s,@zlibinc@,$zlibinc,;t t -diff -Nur gcc-4.4.0_vanilla/gcc/espf.h gcc-4.4.0/gcc/espf.h ---- gcc-4.4.0_vanilla/gcc/espf.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.4.0/gcc/espf.h 2009-07-11 12:36:43.000000000 +0200 -@@ -0,0 +1,104 @@ -+#ifndef GCC_ESPF_H -+#define GCC_ESPF_H -+/* Version 0.2.20090614.1 (C) 2009 by Magnus Granberg zorry@ume.nu */ -+/* Gentoo espf.h patch Version 20090614.1 (C) 2009 by Magnus Granberg zorry@ume.nu */ -+ -+/* FIXME: -+ 1. Fix so that we can have -fPIE or -fpie options. -+*/ -+/* This file add's -fstack-protector-all, -Fpie|-fpie, -pie, -D_FORTIFY_SOURCES=2, -z relro, -z now, -Wformat -+ and -Wformat-security as default if the define's and the spec allow it. -+ -+ On Gentoo -+ Added a hack for gcc-specs-* in toolchain-funcs.eclass to support older hardened GCC patches and -+ we don't need to change the code on gcc-specs-*. -+ This will add some unsupported upstream commands options as -nopie and -z nonow. -+ -D__KERNEL__ is added so we don't have -fPIE|-fpie and -fstack-protector-all when building kernels. -+ ESPF_CC1_SPEC is added to CC1_SPEC. -+ -D_FORTIFY_SOURCES=2 is added with gentoo's patchset as default so no need to set it hear. -+ -Wformat* is added with gentoo's patchset as default so no need to set it hear. -+ -z relro is set by binutils as default so no need to set it hear. -+*/ -+ -+#ifdef ENABLE_ESPF -+ -+ /* Hack to support gcc-specs-* in toolchain-funcs.eclass */ -+ #define ESPF_CC1_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: %{!nopie: %{!fstrict-overflow: }}}}" -+ -+ /* This will add -Wformat -Wformat-security -Wstack-protector in espf_cc1_options_warnings and -fstack-protector-all in -+ espf_cc1_options_ssp and incompatible pie commands in espf_cc1_options_pie_incompatible. -+ ESPF_CC1_OPTIONS_SPEC is added to CC1_OPTIONS_SPEC in gcc/gcc.c */ -+ #define ESPF_CC1_OPTIONS_SPEC "%(espf_cc1_options_ssp) %(espf_cc1_options_pie_incompatible)" -+ -+ /* This will add -z now if we don't have -z nonow or -z lazy -+ ESPF_LINK_SPEC is added to LINK_COMMAND_SPEC in gcc/gcc.c */ -+ #define ESPF_LINK_SPEC "%{!now:%{!lazy:%{!nonow:-z now}}}" -+ -+ /* This will add -fstack-protector-all if we don't have -D__KERNEL__ -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector -+ -fstack-protector-all and we have ENABLE_LIBSSP or TARGET_LIBC_PROVIDES_SSP defined. */ -+ #if defined (ENABLE_LIBSSP) || defined (TARGET_LIBC_PROVIDES_SSP) -+ #define ESPF_CC1_OPTIONS_SSP_SPEC \ -+ "%{!D__KERNEL__:%{!nostdlib:%{!nodefaultlibs: %{!fno-stack-protector: \ -+ %{!fstack-protector:%{!fstack-protector-all:-fstack-protector-all}}}}}}" -+ #else -+ #define ESPF_CC1_OPTIONS_SSP_SPEC "" -+ #endif -+ -+ /* If HAVE_LD_PIE not defined we will not add any -pie -fPIE commands and incompatible pie check */ -+ #ifdef HAVE_LD_PIE -+ -+ /* This will add -fPIE if we don't have -D__KERNEL__ -pie -fpic -fPIC -fpie -fPIE -fno-pic -fno-PIC -fno-pie -fno-PIE -+ -shared -static -nostdlib -nostartfiles -nopie -+ We use ESPF_COMPILER_COMMAND_SPEC to add -fPIE before do_spec (compiler_command_spec) is run in gcc/gcc.c main() */ -+ #define ESPF_COMPILER_COMMAND_SPEC "%(espf_compiler_command_pie)" -+ #define ESPF_COMPILER_COMMAND_PIE_SPEC \ -+ "%{!D__KERNEL__:%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \ -+ %{!shared: %{!static: %{!nostdlib: %{!nostartfiles:%{!nopie:-fPIE}} } }}}} }}}} }}}}" -+ -+ /* This adds some incompatible rules for -pie and -shared -+ We can't have -shared when -static -pie -fPIE -fpie -fno-PIC -fno-pic -+ and -pie when -static -pg -p -profile */ -+ #define ESPF_CC1_OPTIONS_PIE_INCOMPATIBLE_SPEC \ -+ "%{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}} \ -+ %{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible}}" -+ -+ /* This will add -pie if we don't have -pie A -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static -r -+ -nostdlib -nostartfiles -nopie -+ We use ESPF_LINK_COMMAND_SPEC to add -pie before do_spec (link_command_spec) is run in gcc/gcc.c main() */ -+ #define ESPF_LINK_COMMAND_SPEC "%(espf_link_command_pie)" -+ #define ESPF_LINK_COMMAND_PIE_SPEC \ -+ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r: \ -+ %{!nostdlib:%{!nostartfiles:%{!nopie:-pie}}}}}}}}}}}}" -+ #else -+ #define ESPF_COMPILER_COMMAND_SPEC "" -+ #define ESPF_CC1_OPTIONS_PIE_INCOMPATIBLE_SPEC "" -+ #define ESPF_LINK_COMMAND_SPEC "" -+ #endif -+ -+ /* We add extra spec name's to the EXTRA_SPECS list */ -+ #define ESPF_EXTRA_SPECS \ -+ { "espf_link", ESPF_LINK_SPEC }, \ -+ { "espf_link_command", ESPF_LINK_COMMAND_SPEC }, \ -+ { "espf_link_command_pie", ESPF_LINK_COMMAND_PIE_SPEC }, \ -+ { "espf_compiler_command", ESPF_COMPILER_COMMAND_SPEC }, \ -+ { "espf_compiler_command_pie", ESPF_COMPILER_COMMAND_PIE_SPEC }, \ -+ { "espf_cc1", ESPF_CC1_SPEC }, \ -+ { "espf_cc1_options", ESPF_CC1_OPTIONS_SPEC }, \ -+ { "espf_cc1_options_ssp", ESPF_CC1_OPTIONS_SSP_SPEC }, \ -+ { "espf_cc1_options_pie_incompatible", ESPF_CC1_OPTIONS_PIE_INCOMPATIBLE_SPEC } -+ -+ static const char *cc1_spec = CC1_SPEC ESPF_CC1_SPEC; -+ static const char *espf_compiler_command_spec = ESPF_COMPILER_COMMAND_SPEC; -+ static const char *espf_link_command_spec = ESPF_LINK_COMMAND_SPEC; -+ -+#else -+ -+ #define ESPF_CC1_OPTIONS_SPEC "" -+ #define ESPF_LINK_SPEC "" -+ #define ESPF_EXTRA_SPECS \ -+ { "espf_cc1_options", ESPF_CC1_OPTIONS_SPEC }, \ -+ { "espf_link", ESPF_LINK_SPEC } -+ -+#endif -+ -+#endif /* End GCC_ESPF_H */ -diff -Nur gcc-4.4.0_vanilla/gcc/gcc.c gcc-4.4.0/gcc/gcc.c ---- gcc-4.4.0_vanilla/gcc/gcc.c 2009-03-17 22:25:59.000000000 +0100 -+++ gcc-4.4.0/gcc/gcc.c 2009-07-11 12:36:43.000000000 +0200 -@@ -83,6 +83,7 @@ - #include "gcc.h" - #include "flags.h" - #include "opts.h" -+#include "espf.h" /* for espf support */ - - /* By default there is no special suffix for target executables. */ - /* FIXME: when autoconf is fixed, remove the host check - dj */ -@@ -726,7 +727,7 @@ - #ifndef LINK_COMMAND_SPEC - #define LINK_COMMAND_SPEC "\ - %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ -- %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\ -+ %(linker) %l " LINK_PIE_SPEC " %(espf_link) %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\ - %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ - %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\ - %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)} %(mflib)\ -@@ -758,7 +759,9 @@ - - static const char *asm_debug; - static const char *cpp_spec = CPP_SPEC; -+#ifndef ENABLE_ESPF - 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; -@@ -826,6 +829,7 @@ - /* NB: This is shared amongst all front-ends, except for Ada. */ - static const char *cc1_options = - "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ -+ %(espf_cc1_options)\ - %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\ - %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}\ - %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs}\ -@@ -1628,7 +1632,7 @@ - const char *const ptr; - }; - --static const struct spec_list_1 extra_specs_1[] = { EXTRA_SPECS }; -+static const struct spec_list_1 extra_specs_1[] = { ESPF_EXTRA_SPECS, EXTRA_SPECS }; - static struct spec_list *extra_specs = (struct spec_list *) 0; - #endif - -@@ -6782,6 +6786,12 @@ - - if (input_file_compiler) - { -+ -+#ifdef ENABLE_ESPF -+ /* We add -fpie or -fPIE as default if the spec allow it */ -+ do_self_spec (espf_compiler_command_spec); -+#endif -+ - /* Ok, we found an applicable compiler. Run its spec. */ - - if (input_file_compiler->spec[0] == '#') -@@ -6873,6 +6883,10 @@ - " to the linker.\n\n")); - fflush (stdout); - } -+#ifdef ENABLE_ESPF -+ /* We add -pie as default if the spec allow it */ -+ do_self_spec (espf_link_command_spec); -+#endif - value = do_spec (link_command_spec); - if (value < 0) - error_count = 1; -diff -Nur gcc-4.4.0_vanilla/gcc/Makefile.in gcc-4.4.0/gcc/Makefile.in ---- gcc-4.4.0_vanilla/gcc/Makefile.in 2009-03-25 13:00:32.000000000 +0100 -+++ gcc-4.4.0/gcc/Makefile.in 2009-07-11 12:36:10.000000000 +0200 -@@ -580,13 +580,23 @@ - INHIBIT_LIBC_CFLAGS = -Dinhibit_libc - endif - -+# Doesn't compile with PIE or SSP -+enable_espf = @enable_espf@ -+ifeq ($(enable_espf),yes) -+ESPF_NOPIE_CFLAGS = -fno-PIE -+ESPF_NOSSP_CFLAGS = -fno-stack-protector -+else -+ESPF_NOPIE_CFLAGS= -+ESPF_NOSSP_CFLAGS= -+endif -+ - # Options to use when compiling libgcc2.a. - # - LIBGCC2_DEBUG_CFLAGS = -g - LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \ - $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \ - -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ -- $(INHIBIT_LIBC_CFLAGS) -+ $(INHIBIT_LIBC_CFLAGS) $(ESPF_NOSSP_CFLAGS) - - # Additional options to use when compiling libgcc2.a. - # Some targets override this to -isystem include -@@ -599,7 +609,7 @@ - CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ - -finhibit-size-directive -fno-inline-functions -fno-exceptions \ - -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \ -- $(INHIBIT_LIBC_CFLAGS) -+ $(INHIBIT_LIBC_CFLAGS) $(ESPF_NOSSP_CFLAGS) - - # Additional sources to handle exceptions; overridden by targets as needed. - LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ -@@ -1719,7 +1729,7 @@ - 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) $(ESPF_NOPIE_CFLAGS)' >> tmp-libgcc.mvars - echo CRTSTUFF_T_CFLAGS_S = '$(CRTSTUFF_T_CFLAGS_S)' >> tmp-libgcc.mvars - - mv tmp-libgcc.mvars libgcc.mvars -@@ -1754,12 +1764,14 @@ - $(T)crtbegin.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) \ -+ $(ESPF_NOPIE_CFLAGS) \ - -c $(srcdir)/crtstuff.c -DCRT_BEGIN \ - -o $(T)crtbegin$(objext) - - $(T)crtend.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) \ -+ $(ESPF_NOPIE_CFLAGS) \ - -c $(srcdir)/crtstuff.c -DCRT_END \ - -o $(T)crtend$(objext) - -@@ -1780,6 +1792,7 @@ - $(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) \ -+ $(ESPF_NOPIE_CFLAGS) \ - -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \ - -o $(T)crtbeginT$(objext) - -@@ -3057,7 +3070,7 @@ - output.h $(INSN_ATTR_H) $(SYSTEM_H) $(TOPLEV_H) $(TARGET_H) libfuncs.h \ - $(TARGET_DEF_H) $(FUNCTION_H) $(SCHED_INT_H) $(TM_P_H) $(EXPR_H) \ - langhooks.h $(GGC_H) $(OPTABS_H) $(REAL_H) tm-constrs.h $(GIMPLE_H) -- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ -+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(ESPF_NOSSP_CFLAGS)\ - $(out_file) $(OUTPUT_OPTION) - - # Build auxiliary files that support ecoff format. -diff -Nur gcc-4.4.0_vanilla/gcc/opts.c gcc-4.4.0/gcc/opts.c ---- gcc-4.4.0_vanilla/gcc/opts.c 2009-03-28 18:28:45.000000000 +0100 -+++ gcc-4.4.0/gcc/opts.c 2009-07-11 12:36:31.000000000 +0200 -@@ -897,7 +897,9 @@ - #endif - flag_regmove = opt2; - flag_strict_aliasing = opt2; -+#ifndef ENABLE_ESPF - flag_strict_overflow = opt2; -+#endif - flag_delete_null_pointer_checks = opt2; - flag_reorder_blocks = opt2; - flag_reorder_functions = opt2; -diff -Nur gcc-4.4.0_vanilla/gcc/varasm.c gcc-4.4.0/gcc/varasm.c ---- gcc-4.4.0_vanilla/gcc/varasm.c 2009-03-17 21:18:21.000000000 +0100 -+++ gcc-4.4.0/gcc/varasm.c 2009-07-11 12:36:25.000000000 +0200 -@@ -5607,7 +5607,11 @@ - bool is_local; - - is_local = targetm.binds_local_p (decl); -- if (!flag_shlib) -+ #ifdef ENABLE_ESPF -+ if (!flag_pic) -+ #else -+ if (!flag_shlib) -+ #endif - { - if (is_local) - kind = TLS_MODEL_LOCAL_EXEC; diff --git a/pkgs/toolchain/gcc/patches/gcc-4.5.0-piepatches-20100421.patch b/pkgs/toolchain/gcc/patches/gcc-4.5.0-piepatches-20100421.patch new file mode 100644 index 0000000..e525d5b --- /dev/null +++ b/pkgs/toolchain/gcc/patches/gcc-4.5.0-piepatches-20100421.patch @@ -0,0 +1,1056 @@ +diff -Nur gcc-4.5.0-vanilla/configure gcc-4.5.0/configure +--- gcc-4.5.0-vanilla/configure 2010-04-02 19:35:47.000000000 +0200 ++++ gcc-4.5.0/configure 2010-04-21 15:21:09.762948361 +0200 +@@ -707,6 +707,7 @@ + CFLAGS + CC + target_subdir ++enable_esp + host_subdir + build_subdir + build_libsubdir +@@ -1485,6 +1486,11 @@ + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-gold use gold instead of ld + --enable-libada build libada directory ++ --enable-esp ++ Enable Stack protector, Position independent executable and ++ Fortify_sources 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*, ia64, arm* and mips + --enable-libssp build libssp directory + --enable-build-with-cxx build with C++ compiler instead of C compiler + --disable-ppl-version-check disable check for PPL version +@@ -3164,6 +3170,24 @@ + noconfigdirs="$noconfigdirs gnattools" + fi + ++# Check whether --enable-esp was given and target have the support. ++# Check whether --enable-esp or --disable-esp was given. ++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* | mips-*-linux*) ++ enable_esp=yes ++ ;; ++ *) ++ { { echo "$as_me:$LINENO: error: *** --enable-esp is not supported on this $target target." >&5 ++echo "$as_me: error: *** --enable-esp is not supported on this $target target." >&2;} ++ { (exit 1); exit 1; }; } ++ ;; ++ esac ++ ++fi; ++ + # Check whether --enable-libssp was given. + if test "${enable_libssp+set}" = set; then : + enableval=$enable_libssp; ENABLE_LIBSSP=$enableval +@@ -14290,6 +14314,9 @@ + *) stage1_cflags="-g -J" ;; + esac ;; + esac ++if test x$enable_esp = xyes; then ++ stage1_cflags="$stage1_cflags -fno-stack-protector" ++fi + + # This is aimed to mimic bootstrap with a non-GCC compiler to catch problems. + if test "$GCC" = yes -a "$ENABLE_BUILD_WITH_CXX" != yes; then +diff -Nur gcc-4.5.0-vanilla/gcc/config/i386/linux64.h gcc-4.5.0/gcc/config/i386/linux64.h +--- gcc-4.5.0-vanilla/gcc/config/i386/linux64.h 2010-03-24 21:44:48.000000000 +0100 ++++ gcc-4.5.0/gcc/config/i386/linux64.h 2010-04-21 15:21:16.730815972 +0200 +@@ -115,7 +115,7 @@ + /* This macro may be overridden in i386/k*bsd-gnu.h. */ + #define REG_NAME(reg) reg + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* i386 glibc provides __stack_chk_guard in %gs:0x14, + x86_64 glibc provides it in %fs:0x28. */ + #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14) +diff -Nur gcc-4.5.0-vanilla/gcc/config/i386/linux.h gcc-4.5.0/gcc/config/i386/linux.h +--- gcc-4.5.0-vanilla/gcc/config/i386/linux.h 2010-03-24 21:44:48.000000000 +0100 ++++ gcc-4.5.0/gcc/config/i386/linux.h 2010-04-21 15:21:16.721813554 +0200 +@@ -212,7 +212,7 @@ + /* This macro may be overridden in i386/k*bsd-gnu.h. */ + #define REG_NAME(reg) reg + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* i386 glibc provides __stack_chk_guard in %gs:0x14. */ + #define TARGET_THREAD_SSP_OFFSET 0x14 + #endif +diff -Nur gcc-4.5.0-vanilla/gcc/config/linux.h gcc-4.5.0/gcc/config/linux.h +--- gcc-4.5.0-vanilla/gcc/config/linux.h 2009-04-09 17:00:19.000000000 +0200 ++++ gcc-4.5.0/gcc/config/linux.h 2010-04-21 15:21:16.667815357 +0200 +@@ -43,7 +43,11 @@ + object constructed before entering `main'. */ + + #undef STARTFILE_SPEC +-#if defined HAVE_LD_PIE ++#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINTS) ++#define 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 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.5.0-vanilla/gcc/config/rs6000/linux64.h gcc-4.5.0/gcc/config/rs6000/linux64.h +--- gcc-4.5.0-vanilla/gcc/config/rs6000/linux64.h 2010-03-17 05:44:37.000000000 +0100 ++++ gcc-4.5.0/gcc/config/rs6000/linux64.h 2010-04-21 15:21:16.732816308 +0200 +@@ -162,7 +162,7 @@ + #endif + + #define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \ +-%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \ ++%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} \ + %{memb} %{!memb: %{msdata=eabi: -memb}} \ + %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \ + %{mcall-freebsd: -mbig} \ +@@ -525,7 +525,7 @@ + + #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* ppc32 glibc provides __stack_chk_guard in -0x7008(2), + ppc64 glibc provides it at -0x7010(13). */ + #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008) +diff -Nur gcc-4.5.0-vanilla/gcc/config/rs6000/linux.h gcc-4.5.0/gcc/config/rs6000/linux.h +--- gcc-4.5.0-vanilla/gcc/config/rs6000/linux.h 2007-08-02 12:49:31.000000000 +0200 ++++ gcc-4.5.0/gcc/config/rs6000/linux.h 2010-04-21 15:21:16.731819651 +0200 +@@ -117,7 +117,7 @@ + + #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* ppc32 glibc provides __stack_chk_guard in -0x7008(2). */ + #define TARGET_THREAD_SSP_OFFSET -0x7008 + #endif +diff -Nur gcc-4.5.0-vanilla/gcc/config/rs6000/sysv4.h gcc-4.5.0/gcc/config/rs6000/sysv4.h +--- gcc-4.5.0-vanilla/gcc/config/rs6000/sysv4.h 2009-11-25 21:23:20.000000000 +0100 ++++ gcc-4.5.0/gcc/config/rs6000/sysv4.h 2010-04-21 15:21:16.674812959 +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 -Nur gcc-4.5.0-vanilla/gcc/config/s390/linux.h gcc-4.5.0/gcc/config/s390/linux.h +--- gcc-4.5.0-vanilla/gcc/config/s390/linux.h 2007-08-02 12:49:31.000000000 +0200 ++++ gcc-4.5.0/gcc/config/s390/linux.h 2010-04-21 15:21:16.738814124 +0200 +@@ -93,7 +93,7 @@ + + #define MD_UNWIND_SUPPORT "config/s390/linux-unwind.h" + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* s390 glibc provides __stack_chk_guard in 0x14(tp), + s390x glibc provides it at 0x28(tp). */ + #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14) +diff -Nur gcc-4.5.0-vanilla/gcc/config/sparc/linux64.h gcc-4.5.0/gcc/config/sparc/linux64.h +--- gcc-4.5.0-vanilla/gcc/config/sparc/linux64.h 2009-12-08 00:31:01.000000000 +0100 ++++ gcc-4.5.0/gcc/config/sparc/linux64.h 2010-04-21 15:21:16.749816158 +0200 +@@ -298,7 +298,7 @@ + #undef NEED_INDICATE_EXEC_STACK + #define NEED_INDICATE_EXEC_STACK 1 + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14], + sparc64 glibc provides it at [%g7 + 0x28]. */ + #define TARGET_THREAD_SSP_OFFSET (TARGET_ARCH64 ? 0x28 : 0x14) +diff -Nur gcc-4.5.0-vanilla/gcc/config/sparc/linux.h gcc-4.5.0/gcc/config/sparc/linux.h +--- gcc-4.5.0-vanilla/gcc/config/sparc/linux.h 2009-12-08 00:31:01.000000000 +0100 ++++ gcc-4.5.0/gcc/config/sparc/linux.h 2010-04-21 15:21:16.746815839 +0200 +@@ -172,7 +172,7 @@ + #undef NEED_INDICATE_EXEC_STACK + #define NEED_INDICATE_EXEC_STACK 1 + +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ + /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14]. */ + #define TARGET_THREAD_SSP_OFFSET 0x14 + #endif +diff -Nur gcc-4.5.0-vanilla/gcc/config.in gcc-4.5.0/gcc/config.in +--- gcc-4.5.0-vanilla/gcc/config.in 2010-04-14 11:30:07.000000000 +0200 ++++ gcc-4.5.0/gcc/config.in 2010-04-21 15:21:09.879812904 +0200 +@@ -52,6 +52,12 @@ + #endif + + ++/* Define to 1 to enable crtbeginTS.o. */ ++#ifndef USED_FOR_TARGET ++#undef ENABLE_CRTBEGINTS ++#endif ++ ++ + /* Define to 1 to specify that we are using the BID decimal floating point + format instead of DPD */ + #ifndef USED_FOR_TARGET +@@ -71,6 +77,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 +@@ -996,6 +1008,12 @@ + #endif + + ++/* Define to 1 if your compiler supports -fstack-protector */ ++#ifndef USED_FOR_TARGET ++#undef HAVE_GCC_SSP ++#endif ++ ++ + /* Define to 1 if you have the `getchar_unlocked' function. */ + #ifndef USED_FOR_TARGET + #undef HAVE_GETCHAR_UNLOCKED +diff -Nur gcc-4.5.0-vanilla/gcc/configure gcc-4.5.0/gcc/configure +--- gcc-4.5.0-vanilla/gcc/configure 2010-03-26 06:40:32.000000000 +0100 ++++ gcc-4.5.0/gcc/configure 2010-04-21 15:21:09.784072083 +0200 +@@ -678,6 +678,8 @@ + HOST_LIBS + GGC + libgcc_visibility ++enable_esp ++enable_crtbeginTS + gcc_cv_readelf + gcc_cv_objdump + ORIGINAL_NM_FOR_TARGET +@@ -24576,6 +24578,50 @@ + ;; + esac + ++echo "$as_me:$LINENO: checking linker -z now support" >&5 ++echo $ECHO_N "checking linker -z now support... $ECHO_C" >&6 ++if test "${gcc_cv_ld_now+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&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 ++echo "$as_me:$LINENO: result: $gcc_cv_ld_now" >&5 ++echo "${ECHO_T}$gcc_cv_ld_now" >&6 ++ ++echo "$as_me:$LINENO: checking linker -z relro support" >&5 ++echo $ECHO_N "checking linker -z relro support... $ECHO_C" >&6 ++if test "${gcc_cv_ld_relro+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ gcc_cv_ld_relro=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_relro=yes ++ fi ++elif test x$gcc_cv_ld != x; then ++ # Check if linker supports -z relro and -z norelro options ++ if $gcc_cv_ld --help 2>/dev/null | grep relro > /dev/null; then ++ gcc_cv_ld_relro=yes ++ fi ++fi ++ ++fi ++echo "$as_me:$LINENO: result: $gcc_cv_ld_relro" >&5 ++echo "${ECHO_T}$gcc_cv_ld_relro" >&6 ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --build-id support" >&5 + $as_echo_n "checking linker --build-id support... " >&6; } + if test "${gcc_cv_ld_buildid+set}" = set; then : +@@ -24729,6 +24775,146 @@ + + fi + ++if test x$gcc_cv_libc_provides_ssp = xyes; then ++ echo "$as_me:$LINENO: checking whether $CC support -fstack-protector" >&5 ++echo $ECHO_N "checking whether $CC support -fstack-protector... $ECHO_C" >&6 ++if test "${gcc_cv_cc_stack_protector+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ++ saved_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -fstack-protector" ++ cat >conftest.$ac_ext <<_ACEOF ++#ifndef __SSP__ ++#error ++#endif ++ ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: "$ac_compile"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: $? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: "$ac_try"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: $? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: "$ac_try"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: $? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ++ case $target in ++ i?86*-*-linux* | x86_64*-*-linux* | powerpc-*-linux* | powerpc64-*-linux*) ++ if test x$set_have_as_tls = xyes; then ++ gcc_cv_cc_stack_protector=yes ++ else ++ gcc_cv_cc_stack_protector=no ++ fi ++ ;; ++ *) ++ cc_cv_cc_stack_protector=yes ++ ;; ++ esac ++ ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++gcc_cv_cc_stack_protector=no ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ CFLAGS="$saved_CFLAGS" ++ ++fi ++echo "$as_me:$LINENO: result: $gcc_cv_cc_stack_protector" >&5 ++echo "${ECHO_T}$gcc_cv_cc_stack_protector" >&6 ++fi ++if test x$gcc_cv_cc_stack_protector = xyes; then ++ ++cat >>confdefs.h <<_ACEOF ++#define HAVE_GCC_SSP 1 ++_ACEOF ++ ++fi ++ ++ ++if test x$enable_esp = xyes ; then ++case $target in ++ ia64*-*-linux*) ++ if test x$gcc_cv_ld_now = xyes; then ++ enable_esp_ld=yes ++ else ++ enable_esp_ld=no ++ fi ++ ;; ++ *-*-linux*) ++ if test x$gcc_cv_ld_relro = xyes && test x$gcc_cv_ld_now = xyes; then ++ enable_esp_ld=yes ++ else ++ enable_esp_ld=no ++ fi ++ ;; ++ *) ++ enable_esp_ld=no ++ ;; ++ esac ++else ++ enable_esp_ld=no ++fi ++if test x$enable_esp_ld = xyes; then ++ ++cat >>confdefs.h <<_ACEOF ++#define ENABLE_ESP 1 ++_ACEOF ++ ++fi ++if test x$enable_esp = xyes && test x$enable_esp_ld = xno; then ++ { { echo "$as_me:$LINENO: error: *** --enable-esp is not supported. You don't have -z,relro or -z,now support in the linker." >&5 ++echo "$as_me: error: *** --enable-esp is not supported. You don't have -z,relro or -z,now support in the linker." >&2;} ++ { (exit 1); exit 1; }; } ++fi ++ ++echo "$as_me:$LINENO: checking for crtbeginTS.o support" >&5 ++echo $ECHO_N "checking for crtbeginTS.o support... $ECHO_C" >&6 ++if test "${enable_crtbeginTS+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ++if test x$enable_esp = xyes ; then ++ case "$target" in ++ ia64*-*-linux*) ++ enable_crtbeginTS=no ;; ++ *-*-linux*) ++ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then ++ enable_crtbeginTS=yes ++ fi ++ ;; ++ *) enable_crtbeginTS=no ;; ++ esac ++fi ++ ++fi ++echo "$as_me:$LINENO: result: $enable_crtbeginTS" >&5 ++echo "${ECHO_T}$enable_crtbeginTS" >&6 ++ ++if test x$enable_crtbeginTS = xyes; then ++ ++cat >>confdefs.h <<_ACEOF ++#define ENABLE_CRTBEGINTS 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 -Nur gcc-4.5.0-vanilla/gcc/cp/lang-specs.h gcc-4.5.0/gcc/cp/lang-specs.h +--- gcc-4.5.0-vanilla/gcc/cp/lang-specs.h 2007-08-06 13:10:19.000000000 +0200 ++++ gcc-4.5.0/gcc/cp/lang-specs.h 2010-04-21 15:21:16.684816335 +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 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + %{!fsyntax-only:-o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {"@c++", +@@ -57,11 +57,11 @@ + %(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 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + %{!fsyntax-only:%(invoke_as)}}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {".ii", "@c++-cpp-output", 0, 0, 0}, + {"@c++-cpp-output", + "%{!M:%{!MM:%{!E:\ +- cc1plus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ ++ cc1plus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, +diff -Nur gcc-4.5.0-vanilla/gcc/doc/invoke.texi gcc-4.5.0/gcc/doc/invoke.texi +--- gcc-4.5.0-vanilla/gcc/doc/invoke.texi 2010-04-06 16:02:22.000000000 +0200 ++++ gcc-4.5.0/gcc/doc/invoke.texi 2010-04-21 15:21:16.796812184 +0200 +@@ -7856,6 +7856,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 +@@ -8705,6 +8710,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 +@@ -17251,6 +17262,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.5.0-vanilla/gcc/esp.h gcc-4.5.0/gcc/esp.h +--- gcc-4.5.0-vanilla/gcc/esp.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.5.0/gcc/esp.h 2010-04-21 15:21:16.622811922 +0200 +@@ -0,0 +1,148 @@ ++/* License terms see GNU GENERAL PUBLIC LICENSE Version 3. ++ * Version 20100409.1 ++ * Magnus Granberg (Zorry) zorry@gentoo.org */ ++#ifndef GCC_ESP_H ++#define GCC_ESP_H ++ ++/* This file will add -fstack-protector, -fPIE, -pie -D_FORTIFY_SOURCES=2 -z,relro and -z,now ++ as default if the defines and the spec allow it. ++ ++ On Gentoo ++ 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. ++ We use -fstack-protector-all instead of -fstack-protector ++ This will add some unsupported upstream commands options as -nopie. ++ -D__KERNEL__ is added so we don't have -fPIE and -fstack-protector-all when building kernels. ++ ESP_CC1_SPEC is added to CC1_SPEC. ++ -D_FORTIFY_SOURCES=2 is added with gentoo's patchset as default so no need to set it hear. ++ ESP_LINK_SPEC will not add -z,relro as it default on with binutils. ++ ESP_CC1_STRICT_SPEC is added so we don't use gcc/opts.c to disable it. ++ ESP_OPTIONS_PIE_CHECK_SPEC check for -pie, -p, -pg, -profile, -static and -shared. ++ 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)" ++ #ifdef HAVE_GCC_SSP ++ #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: }}" ++ #else ++ #define ESP_CC1_SSP_SPEC "" ++ #endif ++ #define ESP_CC1_PIE_SPEC "%{!nopie: }" ++ #define ESP_CC1_STRICT_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 */ ++ #define ESP_LINK_SPEC "%(esp_link_now)" ++ #define ESP_LINK_NOW_SPEC "%{!now:-z now}" ++ ++ /* 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 TARGET_LIBC_PROVIDES_SSP and HAVE_GCC_SSP defined. */ ++ #ifdef HAVE_GCC_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 HAVE_LD_PIE not defined we will not add any -fPIE -pie */ ++ #ifdef HAVE_LD_PIE ++ ++ /* 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)}}" ++ ++ /* 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 shared is set when -static -pie -fPIE -fpie -fno-PIC -fno-pic, -pie is set when -static -pg -p -profile. ++ If set it will make gcc print out "-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible" or ++ "-pie and pg|p|profile are incompatible" */ ++ /* With ENABLE_CRTBEGINTS we don't need to check for -static */ ++ #ifdef ENABLE_CRTBEGINTS ++ #define ESP_OPTIONS_PIE_CHECK_SPEC \ ++ "%{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}} \ ++ %{pie:%{pg|p|profile:%e-pie and -pg|p|profile are incompatible}}" ++ #else ++ #define ESP_OPTIONS_PIE_CHECK_SPEC \ ++ "%{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}} \ ++ %{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible}}" ++ #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_OPTIONS_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", ESP_CC1_STRICT_SPEC }, \ ++ { "esp_link", ESP_LINK_SPEC }, \ ++ { "esp_link_now", ESP_LINK_NOW_SPEC }, \ ++ { "esp_link_pie", ESP_LINK_PIE_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_pie_check", ESP_OPTIONS_PIE_CHECK_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.5.0-vanilla/gcc/gcc.c gcc-4.5.0/gcc/gcc.c +--- gcc-4.5.0-vanilla/gcc/gcc.c 2010-02-11 13:23:08.000000000 +0100 ++++ gcc-4.5.0/gcc/gcc.c 2010-04-21 15:21:16.589812777 +0200 +@@ -84,6 +84,7 @@ + #include "gcc.h" + #include "flags.h" + #include "opts.h" ++#include "esp.h" /* for --enable-esp support */ + + #ifdef HAVE_MMAP_FILE + # include <sys/mman.h> +@@ -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; +@@ -885,7 +888,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. */ +@@ -893,6 +896,9 @@ + + /* NB: This is shared amongst all front-ends, except for Ada. */ + static const char *cc1_options = ++#ifdef ENABLE_ESP ++"%(esp_options_pie_check)" ++#endif + "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %1 %{!Q:-quiet} %{!dumpbase:-dumpbase %B} %{d*} %{m*} %{a*}\ + %{fcompare-debug-second:%:compare-debug-auxbase-opt(%b)} \ +@@ -1075,15 +1081,15 @@ + %{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)}} \ + %{combine:\ + %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \ + %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i}}\ + %{!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, 1, 1}, + {"-", + "%{!E:%e-E or -x required when input is from standard input}\ +@@ -1106,7 +1112,7 @@ + %W{o*:--output-pch=%*}%V}}}}}}", 0, 0, 0}, + {".i", "@cpp-output", 0, 1, 0}, + {"@cpp-output", +- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0}, ++ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(esp_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0}, + {".s", "@assembler", 0, 1, 0}, + {"@assembler", + "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 1, 0}, +@@ -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--) + { +@@ -7111,6 +7120,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.5.0-vanilla/gcc/Makefile.in gcc-4.5.0/gcc/Makefile.in +--- gcc-4.5.0-vanilla/gcc/Makefile.in 2010-04-02 09:49:06.000000000 +0200 ++++ gcc-4.5.0/gcc/Makefile.in 2010-04-21 15:21:10.033812913 +0200 +@@ -636,13 +636,24 @@ + INHIBIT_LIBC_CFLAGS = -Dinhibit_libc + endif + ++# We don't want __stack_chk_fail in crt* and libgcc2.a. ++# We don't want to compile crtbegin, crtend and crtbeginT with -fPIE. ++enable_esp = @enable_esp@ ++ifeq ($(enable_esp),yes) ++ESP_NOPIE_CFLAGS = -fno-PIE ++ESP_NOSSP_CFLAGS = -fno-stack-protector ++else ++ESP_NOPIE_CFLAGS= ++ESP_NOSSP_CFLAGS= ++endif ++ + # Options to use when compiling libgcc2.a. + # + LIBGCC2_DEBUG_CFLAGS = -g + LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \ + $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \ + -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ +- $(INHIBIT_LIBC_CFLAGS) ++ $(INHIBIT_LIBC_CFLAGS) $(ESP_NOSSP_CFLAGS) + + # Additional options to use when compiling libgcc2.a. + # Some targets override this to -isystem include +@@ -655,7 +666,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 \ +- $(INHIBIT_LIBC_CFLAGS) ++ $(INHIBIT_LIBC_CFLAGS) $(ESP_NOSSP_CFLAGS) + + # Additional sources to handle exceptions; overridden by targets as needed. + LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ +@@ -685,6 +696,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@ +@@ -1863,9 +1880,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 + +@@ -1899,12 +1917,14 @@ + $(T)crtbegin.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 \ + -o $(T)crtbegin$(objext) + + $(T)crtend.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_END \ + -o $(T)crtend$(objext) + +@@ -1925,9 +1945,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 +diff -Nur gcc-4.5.0-vanilla/gcc/objc/lang-specs.h gcc-4.5.0/gcc/objc/lang-specs.h +--- gcc-4.5.0-vanilla/gcc/objc/lang-specs.h 2007-08-02 12:37:36.000000000 +0200 ++++ gcc-4.5.0/gcc/objc/lang-specs.h 2010-04-21 15:21:16.702913793 +0200 +@@ -30,13 +30,13 @@ + %{traditional|ftraditional|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}, + {".mi", "@objc-cpp-output", 0, 0, 0}, + {"@objc-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}, + {"@objective-c-header", + "%{E|M|MM:cc1obj -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}\ +@@ -45,10 +45,10 @@ + %{traditional|ftraditional|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}, +diff -Nur gcc-4.5.0-vanilla/gcc/objcp/lang-specs.h gcc-4.5.0/gcc/objcp/lang-specs.h +--- gcc-4.5.0-vanilla/gcc/objcp/lang-specs.h 2007-08-02 12:38:44.000000000 +0200 ++++ gcc-4.5.0/gcc/objcp/lang-specs.h 2010-04-21 15:21:16.708817730 +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 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {"@objective-c++", +@@ -46,15 +46,15 @@ + %(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 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + %{!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 %{+e*}\ ++ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, + {"@objc++-cpp-output", + "%{!M:%{!MM:%{!E:\ +- cc1objplus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ ++ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, +diff -Nur gcc-4.5.0-vanilla/gcc/varasm.c gcc-4.5.0/gcc/varasm.c +--- gcc-4.5.0-vanilla/gcc/varasm.c 2010-03-27 12:56:30.000000000 +0100 ++++ gcc-4.5.0/gcc/varasm.c 2010-04-21 15:21:16.606812404 +0200 +@@ -5961,7 +5961,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.5.0-vanilla/libgcc/Makefile.in gcc-4.5.0/libgcc/Makefile.in +--- gcc-4.5.0-vanilla/libgcc/Makefile.in 2010-03-30 15:08:52.000000000 +0200 ++++ gcc-4.5.0/libgcc/Makefile.in 2010-04-21 15:21:10.824811514 +0200 +@@ -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 -Nur gcc-4.5.0-vanilla/libmudflap/configure gcc-4.5.0/libmudflap/configure +--- gcc-4.5.0-vanilla/libmudflap/configure 2009-12-05 18:18:53.000000000 +0100 ++++ gcc-4.5.0/libmudflap/configure 2010-04-21 15:21:09.843811773 +0200 +@@ -652,6 +652,7 @@ + MAINTAINER_MODE_FALSE + MAINTAINER_MODE_TRUE + am__untar ++enable_esp + am__tar + AMTAR + am__leading_dot +diff -Nur gcc-4.5.0-vanilla/libmudflap/Makefile.in gcc-4.5.0/libmudflap/Makefile.in +--- gcc-4.5.0-vanilla/libmudflap/Makefile.in 2010-04-02 20:18:06.000000000 +0200 ++++ gcc-4.5.0/libmudflap/Makefile.in 2010-04-21 15:21:10.844815108 +0200 +@@ -304,10 +304,18 @@ + MAINT_CHARSET = latin1 + SUBDIRS = testsuite + ++# Some stuff don't compile with PIE or SSP ++enable_esp = @enable_esp@ ++ifeq ($(enable_esp),yes) ++NO_ESP_CFLAGS = -fno-stack-protector -U_FORTIFY_SOURCE ++else ++NO_ESP_CFLAGS = ++endif ++ + # May be used by various substitution variables. + gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) +-AM_CFLAGS = -Wall $(SECTION_FLAGS) +-@LIBMUDFLAPTH_FALSE@libmudflapth = ++AM_CFLAGS = -Wall $(SECTION_FLAGS) $(NO_ESP_CFLAGS) ++@LIBMUDFLAPTH_FALSE@libmudflapth = + @LIBMUDFLAPTH_TRUE@libmudflapth = libmudflapth.la + toolexeclib_LTLIBRARIES = libmudflap.la $(libmudflapth) + libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include +diff -Nur gcc-4.5.0-vanilla/Makefile.in gcc-4.5.0/Makefile.in +--- gcc-4.5.0-vanilla/Makefile.in 2010-02-17 12:01:44.000000000 +0100 ++++ gcc-4.5.0/Makefile.in 2010-04-21 15:21:10.022812548 +0200 +@@ -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 + +@@ -397,9 +405,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) + + TFLAGS = + diff --git a/pkgs/toolchain/patch/patches/patch-2.5.4-sigsegv.patch b/pkgs/toolchain/patch/patches/patch-2.5.4-sigsegv.patch new file mode 100644 index 0000000..c018153 --- /dev/null +++ b/pkgs/toolchain/patch/patches/patch-2.5.4-sigsegv.patch @@ -0,0 +1,42 @@ +diff -up patch-2.6/src/inp.c.sigsegv patch-2.6/src/inp.c +--- patch-2.6/src/inp.c.sigsegv 2009-11-02 19:09:57.000000000 +0000 ++++ patch-2.6/src/inp.c 2009-11-16 09:31:52.305022200 +0000 +@@ -77,6 +77,14 @@ re_input (void) + } + } + ++void ++reset_scan_input_vars() ++{ ++ using_plan_a = 1; ++ i_buffer = NULL; ++ i_ptr = NULL; ++} ++ + /* Construct the line index, somehow or other. */ + + void +diff -up patch-2.6/src/inp.h.sigsegv patch-2.6/src/inp.h +--- patch-2.6/src/inp.h.sigsegv 2009-11-02 19:09:57.000000000 +0000 ++++ patch-2.6/src/inp.h 2009-11-16 09:32:24.440021838 +0000 +@@ -24,4 +24,5 @@ XTERN LINENUM input_lines; /* how long + char const *ifetch (LINENUM, bool, size_t *); + void get_input_file (char const *, char const *); + void re_input (void); ++void reset_scan_input_vars (void); + void scan_input (char *); +diff -up patch-2.6/src/patch.c.sigsegv patch-2.6/src/patch.c +--- patch-2.6/src/patch.c.sigsegv 2009-11-02 19:09:57.000000000 +0000 ++++ patch-2.6/src/patch.c 2009-11-16 09:31:52.306021801 +0000 +@@ -210,7 +210,10 @@ main (int argc, char **argv) + + /* find out where all the lines are */ + if (!skip_rest_of_patch) +- scan_input (inname); ++ scan_input (inname); ++ else ++ reset_scan_input_vars (); ++ + + /* from here on, open no standard i/o files, because malloc */ + /* might misfire and we can't catch it easily */ diff --git a/pkgs/toolchain/perl/patches/perl-5.10.1-USE_MM_LD_RUN_PATH.patch b/pkgs/toolchain/perl/patches/perl-5.10.1-USE_MM_LD_RUN_PATH.patch deleted file mode 100644 index adedbb1..0000000 --- a/pkgs/toolchain/perl/patches/perl-5.10.1-USE_MM_LD_RUN_PATH.patch +++ /dev/null @@ -1,109 +0,0 @@ -diff -up perl-5.10.1/lib/ExtUtils/MM_Unix.pm.runpath perl-5.10.1/lib/ExtUtils/MM_Unix.pm ---- perl-5.10.1/lib/ExtUtils/MM_Unix.pm.runpath 2009-11-18 16:08:45.000000000 +0100 -+++ perl-5.10.1/lib/ExtUtils/MM_Unix.pm 2009-11-18 16:09:32.000000000 +0100 -@@ -944,7 +944,7 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $ - } - - my $ld_run_path_shell = ""; -- if ($self->{LD_RUN_PATH} ne "") { -+ if (($self->{LD_RUN_PATH} ne "") && ($self->{USE_MM_LD_RUN_PATH})) { - $ld_run_path_shell = 'LD_RUN_PATH="$(LD_RUN_PATH)" '; - } - -diff -up perl-5.10.1/lib/ExtUtils/Liblist.pm.runpath perl-5.10.1/lib/ExtUtils/Liblist.pm ---- perl-5.10.1/lib/ExtUtils/Liblist.pm.runpath 2009-11-18 16:08:45.000000000 +0100 -+++ perl-5.10.1/lib/ExtUtils/Liblist.pm 2009-11-18 16:09:32.000000000 +0100 -@@ -88,6 +88,11 @@ libraries. LD_RUN_PATH is a colon separ - in LDLOADLIBS. It is passed as an environment variable to the process - that links the shared library. - -+Fedora extension: This generation of LD_RUN_PATH is disabled by default. -+To use the generated LD_RUN_PATH for all links, set the USE_MM_LD_RUN_PATH -+MakeMaker object attribute / argument, (or set the $USE_MM_LD_RUN_PATH -+environment variable). -+ - =head2 BSLOADLIBS - - List of those libraries that are needed but can be linked in -diff -up perl-5.10.1/lib/ExtUtils/MakeMaker.pm.runpath perl-5.10.1/lib/ExtUtils/MakeMaker.pm ---- perl-5.10.1/lib/ExtUtils/MakeMaker.pm.runpath 2009-11-18 16:08:45.000000000 +0100 -+++ perl-5.10.1/lib/ExtUtils/MakeMaker.pm 2009-11-18 16:32:50.000000000 +0100 -@@ -262,7 +262,7 @@ sub full_setup { - PERL_SRC PERM_DIR PERM_RW PERM_RWX - PL_FILES PM PM_FILTER PMLIBDIRS PMLIBPARENTDIRS POLLUTE PPM_INSTALL_EXEC - PPM_INSTALL_SCRIPT PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ -- SIGN SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG -+ SIGN SKIP TYPEMAPS USE_MM_LD_RUN_PATH VERSION VERSION_FROM XS XSOPT XSPROTOARG - XS_VERSION clean depend dist dynamic_lib linkext macro realclean - tool_autosplit - -@@ -406,7 +406,27 @@ sub new { - # PRINT_PREREQ is RedHatism. - if ("@ARGV" =~ /\bPRINT_PREREQ\b/) { - $self->_PRINT_PREREQ; -- } -+ } -+ -+ # USE_MM_LD_RUN_PATH - another RedHatism to disable automatic RPATH generation -+ if ( ( ! $self->{USE_MM_LD_RUN_PATH} ) -+ &&( ("@ARGV" =~ /\bUSE_MM_LD_RUN_PATH(=([01]))?\b/) -+ ||( exists( $ENV{USE_MM_LD_RUN_PATH} ) -+ &&( $ENV{USE_MM_LD_RUN_PATH} =~ /([01])?$/ ) -+ ) -+ ) -+ ) -+ { -+ my $v = $1; -+ if( $v ) -+ { -+ $v = ($v=~/=([01])$/)[0]; -+ }else -+ { -+ $v = 1; -+ }; -+ $self->{USE_MM_LD_RUN_PATH}=$v; -+ }; - - print STDOUT "MakeMaker (v$VERSION)\n" if $Verbose; - if (-f "MANIFEST" && ! -f "Makefile"){ -@@ -2319,6 +2339,40 @@ precedence. A typemap in the current di - precedence, even if it isn't listed in TYPEMAPS. The default system - typemap has lowest precedence. - -+=item USE_MM_LD_RUN_PATH -+ -+boolean -+The Fedora perl MakeMaker distribution differs from the standard -+upstream release in that it disables use of the MakeMaker generated -+LD_RUN_PATH by default, UNLESS this attribute is specified , or the -+USE_MM_LD_RUN_PATH environment variable is set during the MakeMaker run. -+ -+The upstream MakeMaker will set the ld(1) environment variable LD_RUN_PATH -+to the concatenation of every -L ld(1) option directory in which a -l ld(1) -+option library is found, which is used as the ld(1) -rpath option if none -+is specified. This means that, if your application builds shared libraries -+and your MakeMaker application links to them, that the absolute paths of the -+libraries in the build tree will be inserted into the RPATH header of all -+MakeMaker generated binaries, and that such binaries will be unable to link -+to these libraries if they do not still reside in the build tree directories -+(unlikely) or in the system library directories (/lib or /usr/lib), regardless -+of any LD_LIBRARY_PATH setting. So if you specified -L../mylib -lmylib , and -+ your 'libmylib.so' gets installed into /some_directory_other_than_usr_lib, -+ your MakeMaker application will be unable to link to it, even if LD_LIBRARY_PATH -+is set to include /some_directory_other_than_usr_lib, because RPATH overrides -+LD_LIBRARY_PATH. -+ -+So for Fedora MakeMaker builds LD_RUN_PATH is NOT generated by default for -+every link. You can still use explicit -rpath ld options or the LD_RUN_PATH -+environment variable during the build to generate an RPATH for the binaries. -+ -+You can set the USE_MM_LD_RUN_PATH attribute to 1 on the MakeMaker command -+line or in the WriteMakefile arguments to enable generation of LD_RUN_PATH -+for every link command. -+ -+USE_MM_LD_RUN_PATH will default to 1 (LD_RUN_PATH will be used) IF the -+$USE_MM_LD_RUN_PATH environment variable is set during a MakeMaker run. -+ - =item VENDORPREFIX - - Like PERLPREFIX, but only for the vendor install locations. diff --git a/pkgs/toolchain/perl/patches/perl-5.10.1-utf8-1.patch b/pkgs/toolchain/perl/patches/perl-5.10.1-utf8-1.patch deleted file mode 100644 index bc9580f..0000000 --- a/pkgs/toolchain/perl/patches/perl-5.10.1-utf8-1.patch +++ /dev/null @@ -1,167 +0,0 @@ -Submitted By: Robert Connolly <robert at linuxfromscratch dot org> (ashes) -Date: 2010-02-24 -Initial Package Version: 5.10.1 -Upstream Status: From upstream -Origin: Git -http://perl5.git.perl.org/perl.git/patch/0abd0d78a73da1c4d13b1c700526b7e5d03... -Description: Bug fix for invalid utf-8 characters causing Perl to crash. - -http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3626 - -From 0abd0d78a73da1c4d13b1c700526b7e5d03b32d4 Mon Sep 17 00:00:00 2001 -From: Yves Orton demerphq@gmail.com -Date: Sun, 25 Oct 2009 20:37:08 +0100 -Subject: [PATCH] disable non-unicode case insensitive trie matching - -Also revert 8902bb05b18c9858efa90229ca1ee42b17277554 as it merely -masked one symptom of the deeper problems. - -Also fixes RT #69973, which was a segfault which was exposed by -8902bb05, see the ticket for further details. - -http://rt.perl.org/rt3//Public/Bug/Display.html?id=69973 - -At the code of this is the problem that in unicode matching a bunch -of code points have case folding rules beyond just A-Z/a-z. Since -the case folding rules are decided at runtime by the string, we cant -use the same TRIE tables for both unicode/non-unicode matching. - -Until this is reconciled or some other solution is found case insensitive -matching only gets the TRIE optimisation when the pattern is uniocde. - -From CaseFolding.txt: - -00B5; C; 03BC; # MICRO SIGN -00C0; C; 00E0; # LATIN CAPITAL LETTER A WITH GRAVE -00C1; C; 00E1; # LATIN CAPITAL LETTER A WITH ACUTE -00C2; C; 00E2; # LATIN CAPITAL LETTER A WITH CIRCUMFLEX -00C3; C; 00E3; # LATIN CAPITAL LETTER A WITH TILDE -00C4; C; 00E4; # LATIN CAPITAL LETTER A WITH DIAERESIS -00C5; C; 00E5; # LATIN CAPITAL LETTER A WITH RING ABOVE -00C6; C; 00E6; # LATIN CAPITAL LETTER AE -00C7; C; 00E7; # LATIN CAPITAL LETTER C WITH CEDILLA -00C8; C; 00E8; # LATIN CAPITAL LETTER E WITH GRAVE -00C9; C; 00E9; # LATIN CAPITAL LETTER E WITH ACUTE -00CA; C; 00EA; # LATIN CAPITAL LETTER E WITH CIRCUMFLEX -00CB; C; 00EB; # LATIN CAPITAL LETTER E WITH DIAERESIS -00CC; C; 00EC; # LATIN CAPITAL LETTER I WITH GRAVE -00CD; C; 00ED; # LATIN CAPITAL LETTER I WITH ACUTE -00CE; C; 00EE; # LATIN CAPITAL LETTER I WITH CIRCUMFLEX -00CF; C; 00EF; # LATIN CAPITAL LETTER I WITH DIAERESIS -00D0; C; 00F0; # LATIN CAPITAL LETTER ETH -00D1; C; 00F1; # LATIN CAPITAL LETTER N WITH TILDE -00D2; C; 00F2; # LATIN CAPITAL LETTER O WITH GRAVE -00D3; C; 00F3; # LATIN CAPITAL LETTER O WITH ACUTE -00D4; C; 00F4; # LATIN CAPITAL LETTER O WITH CIRCUMFLEX -00D5; C; 00F5; # LATIN CAPITAL LETTER O WITH TILDE -00D6; C; 00F6; # LATIN CAPITAL LETTER O WITH DIAERESIS -00D8; C; 00F8; # LATIN CAPITAL LETTER O WITH STROKE -00D9; C; 00F9; # LATIN CAPITAL LETTER U WITH GRAVE -00DA; C; 00FA; # LATIN CAPITAL LETTER U WITH ACUTE -00DB; C; 00FB; # LATIN CAPITAL LETTER U WITH CIRCUMFLEX -00DC; C; 00FC; # LATIN CAPITAL LETTER U WITH DIAERESIS -00DD; C; 00FD; # LATIN CAPITAL LETTER Y WITH ACUTE -00DE; C; 00FE; # LATIN CAPITAL LETTER THORN -00DF; F; 0073 0073; # LATIN SMALL LETTER SHARP S ---- - ext/re/t/regop.t | 12 ++++++------ - regcomp.c | 17 +++++++++++------ - regexec.c | 9 ++------- - 3 files changed, 19 insertions(+), 19 deletions(-) - -diff --git a/ext/re/t/regop.t b/ext/re/t/regop.t -index 9118bf6..46e6ec0 100644 ---- a/ext/re/t/regop.t -+++ b/ext/re/t/regop.t -@@ -231,12 +231,12 @@ anchored "ABC" at 0 - #Freeing REx: "(\.COM|\.EXE|\.BAT|\.CMD|\.VBS|\.VBE|\.JS|\.JSE|\."...... - %MATCHED% - floating ""$ at 3..4 (checking floating) --1:1[1] 3:2[1] 5:2[64] 45:83[1] 47:84[1] 48:85[0] --stclass EXACTF <.> minlen 3 --Found floating substr ""$ at offset 30... --Does not contradict STCLASS... --Guessed: match at offset 26 --Matching stclass EXACTF <.> against ".exe" -+#1:1[1] 3:2[1] 5:2[64] 45:83[1] 47:84[1] 48:85[0] -+#stclass EXACTF <.> minlen 3 -+#Found floating substr ""$ at offset 30... -+#Does not contradict STCLASS... -+#Guessed: match at offset 26 -+#Matching stclass EXACTF <.> against ".exe" - --- - #Compiling REx "[q]" - #size 12 nodes Got 100 bytes for offset annotations. -diff --git a/regcomp.c b/regcomp.c -index 6e9fa26..eb5f12f 100644 ---- a/regcomp.c -+++ b/regcomp.c -@@ -2833,13 +2833,18 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, - } - } else { - /* -- Currently we assume that the trie can handle unicode and ascii -- matches fold cased matches. If this proves true then the following -- define will prevent tries in this situation. -- -- #define TRIE_TYPE_IS_SAFE (UTF || optype==EXACT) --*/ -+ Currently we do not believe that the trie logic can -+ handle case insensitive matching properly when the -+ pattern is not unicode (thus forcing unicode semantics). -+ -+ If/when this is fixed the following define can be swapped -+ in below to fully enable trie logic. -+ - #define TRIE_TYPE_IS_SAFE 1 -+ -+*/ -+#define TRIE_TYPE_IS_SAFE (UTF || optype==EXACT) -+ - if ( last && TRIE_TYPE_IS_SAFE ) { - make_trie( pRExC_state, - startbranch, first, cur, tail, count, -diff --git a/regexec.c b/regexec.c -index 402ede3..ec09c28 100644 ---- a/regexec.c -+++ b/regexec.c -@@ -1105,16 +1105,15 @@ Perl_re_intuit_start(pTHX_ REGEXP * const rx, SV *sv, char *strpos, - - #define REXEC_TRIE_READ_CHAR(trie_type, trie, widecharmap, uc, uscan, len, \ - uvc, charid, foldlen, foldbuf, uniflags) STMT_START { \ -- UV uvc_unfolded = 0; \ - switch (trie_type) { \ - case trie_utf8_fold: \ - if ( foldlen>0 ) { \ -- uvc_unfolded = uvc = utf8n_to_uvuni( uscan, UTF8_MAXLEN, &len, uniflags ); \ -+ uvc = utf8n_to_uvuni( uscan, UTF8_MAXLEN, &len, uniflags ); \ - foldlen -= len; \ - uscan += len; \ - len=0; \ - } else { \ -- uvc_unfolded = uvc = utf8n_to_uvuni( (U8*)uc, UTF8_MAXLEN, &len, uniflags ); \ -+ uvc = utf8n_to_uvuni( (U8*)uc, UTF8_MAXLEN, &len, uniflags ); \ - uvc = to_uni_fold( uvc, foldbuf, &foldlen ); \ - foldlen -= UNISKIP( uvc ); \ - uscan = foldbuf + UNISKIP( uvc ); \ -@@ -1140,7 +1139,6 @@ uvc, charid, foldlen, foldbuf, uniflags) STMT_START { \ - uvc = (UV)*uc; \ - len = 1; \ - } \ -- \ - if (uvc < 256) { \ - charid = trie->charmap[ uvc ]; \ - } \ -@@ -1153,9 +1151,6 @@ uvc, charid, foldlen, foldbuf, uniflags) STMT_START { \ - charid = (U16)SvIV(*svpp); \ - } \ - } \ -- if (!charid && trie_type == trie_utf8_fold && !UTF) { \ -- charid = trie->charmap[uvc_unfolded]; \ -- } \ - } STMT_END - - #define REXEC_FBC_EXACTISH_CHECK(CoNd) \ --- -1.6.5.2.74.g610f9.dirty - diff --git a/pkgs/toolchain/perl/perl.nm b/pkgs/toolchain/perl/perl.nm index d7060a0..29b6531 100644 --- a/pkgs/toolchain/perl/perl.nm +++ b/pkgs/toolchain/perl/perl.nm @@ -13,7 +13,6 @@ define STAGE_BUILD cd $(DIR_APP) && \ $(DIR_APP)/Configure \ -Dprefix=$(TOOLS_DIR) \ - -Dstatic_ext="Data/Dumper Fcntl IO POSIX" \ -d -e -s
cd $(DIR_APP) && make perl utilities ext/Errno/pm_to_blib #$(PARALLELISMFLAGS)
hooks/post-receive -- IPFire 3.x development tree