From 513f8ca4a081e2a0c3c577b6277d78a231af18bd Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 27 Sep 2014 12:33:42 +0200 Subject: [PATCH] gcc: Update to version 4.9.1 --- gcc/gcc.nm | 168 ++-- gcc/patches/01_all_gcc49_configure.patch | 156 ++++ gcc/patches/02_all_gcc48_config.in.patch0 | 32 + gcc/patches/03_all_gcc49_Makefile.in.patch | 96 ++ gcc/patches/04_all_gcc49_default_ssp.patch | 261 ++++++ gcc/patches/05_all_gcc48_gcc.c.patch0 | 25 + .../10_all_gcc49_default-fortify-source.patch | 29 + ...l_gcc49_default-warn-format-security.patch | 43 + ...2_all_gcc49_default-warn-trampolines.patch | 25 + gcc/patches/16_all_gcc47_nopie_option.patch | 16 + .../20_all_gcc49_config_crtbeginp.patch0 | 40 + gcc/patches/24_all_gcc49_invoke.texi.patch0 | 44 + gcc/patches/34_all_gcc48_config_i386.patch | 56 ++ gcc/patches/35_all_gcc48_config_arm.patch | 35 + gcc/patches/40_all_gcc49_config_esp.patch0 | 135 +++ .../53_all_libitm-no-fortify-source.patch | 27 + gcc/patches/gcc-4.8.1-piepatch-20130628.patch | 874 ------------------ .../gcc49-aarch64-async-unw-tables.patch0 | 35 + gcc/patches/gcc49-aarch64-unwind-opt.patch0 | 338 +++++++ gcc/patches/gcc49-cloog-dl.patch0 | 476 ++++++++++ gcc/patches/gcc49-cloog-dl2.patch0 | 74 ++ gcc/patches/gcc49-color-auto.patch0 | 46 + ...bgomp.patch0 => gcc49-i386-libgomp.patch0} | 0 ...ocs.patch0 => gcc49-libstdc++-docs.patch0} | 4 +- ...h.patch0 => gcc49-libtool-no-rpath.patch0} | 0 ...eded.patch0 => gcc49-no-add-needed.patch0} | 0 gcc/patches/gcc49-pr38757.patch0 | 106 +++ gcc/patches/gcc49-pr56493.patch0 | 76 ++ 28 files changed, 2283 insertions(+), 934 deletions(-) create mode 100644 gcc/patches/01_all_gcc49_configure.patch create mode 100644 gcc/patches/02_all_gcc48_config.in.patch0 create mode 100644 gcc/patches/03_all_gcc49_Makefile.in.patch create mode 100644 gcc/patches/04_all_gcc49_default_ssp.patch create mode 100644 gcc/patches/05_all_gcc48_gcc.c.patch0 create mode 100644 gcc/patches/10_all_gcc49_default-fortify-source.patch create mode 100644 gcc/patches/11_all_gcc49_default-warn-format-security.patch create mode 100644 gcc/patches/12_all_gcc49_default-warn-trampolines.patch create mode 100644 gcc/patches/16_all_gcc47_nopie_option.patch create mode 100644 gcc/patches/20_all_gcc49_config_crtbeginp.patch0 create mode 100644 gcc/patches/24_all_gcc49_invoke.texi.patch0 create mode 100644 gcc/patches/34_all_gcc48_config_i386.patch create mode 100644 gcc/patches/35_all_gcc48_config_arm.patch create mode 100644 gcc/patches/40_all_gcc49_config_esp.patch0 create mode 100644 gcc/patches/53_all_libitm-no-fortify-source.patch delete mode 100644 gcc/patches/gcc-4.8.1-piepatch-20130628.patch create mode 100644 gcc/patches/gcc49-aarch64-async-unw-tables.patch0 create mode 100644 gcc/patches/gcc49-aarch64-unwind-opt.patch0 create mode 100644 gcc/patches/gcc49-cloog-dl.patch0 create mode 100644 gcc/patches/gcc49-cloog-dl2.patch0 create mode 100644 gcc/patches/gcc49-color-auto.patch0 rename gcc/patches/{gcc48-i386-libgomp.patch0 => gcc49-i386-libgomp.patch0} (100%) rename gcc/patches/{gcc48-libstdc++-docs.patch0 => gcc49-libstdc++-docs.patch0} (96%) rename gcc/patches/{gcc48-libtool-no-rpath.patch0 => gcc49-libtool-no-rpath.patch0} (100%) rename gcc/patches/{gcc48-no-add-needed.patch0 => gcc49-no-add-needed.patch0} (100%) create mode 100644 gcc/patches/gcc49-pr38757.patch0 create mode 100644 gcc/patches/gcc49-pr56493.patch0 diff --git a/gcc/gcc.nm b/gcc/gcc.nm index 75b6970be..919dccc4c 100644 --- a/gcc/gcc.nm +++ b/gcc/gcc.nm @@ -3,11 +3,11 @@ # Copyright (C) - IPFire Development Team # ############################################################################### -# Configure build to compile with cloog and ppl. -build_cloog_ppl = 1 +# Configure build to compile with cloog. +build_cloog = 1 name = gcc -version = 4.8.1 +version = 4.9.1 release = 1 maintainer = Michael Tremer @@ -22,15 +22,17 @@ description end # This is the at least required version of binutils. -required_binutils_version = 2.21.51.0.8-1 +binutils_version = 2.24 +cloog_version = 0.18.1 source_dl = http://ftp.gnu.org/gnu/gcc/%{thisapp}/ +source_dl += ftp://gcc.gnu.org/pub/gcc/infrastructure/ sources = %{thisapp}.tar.gz build requires autogen - binutils >= %{required_binutils_version} + binutils >= %{binutils_version} dejagnu elfutils-devel expect @@ -47,17 +49,23 @@ build end # If cloog support is enabled, we require the devel packages for build. - if "%{build_cloog_ppl}" == "1" - requires += cloog-ppl-devel >= 0.15.11-2 - requires += ppl-devel >= 1.0 + if "%{build_cloog}" == "1" + requires += cloog-devel >= %{cloog_version} + requires += isl-devel end # Build libquadmath (only on x86). build_libquadmath = 0 + # Build liblsan (only on x86_64). + build_liblsan = 0 + # Build libtasn (only on x86_64). build_libtsan = 0 + # Build libcilkrts (only x86) + build_libcilkrts = 0 + # A couple of configure arguments depending on the architecture and # configuration. configure_options = @@ -68,13 +76,16 @@ build configure_options = --disable-multilib build_libquadmath = 1 + build_liblsan = 1 build_libtsan = 1 + build_libcilkrts = 1 end if "%{DISTRO_ARCH}" == "i686" configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic build_libquadmath = 1 + build_libcilkrts = 1 end if "%{DISTRO_ARCH}" == "armv5tel" @@ -98,9 +109,11 @@ build --with-abi=aapcs-linux end - if "%{build_cloog_ppl}" == "1" - configure_options += --with-cloog --with-ppl \ - --disable-ppl-version-check + if "%{build_cloog}" == "1" + configure_options += \ + --with-cloog=%{prefix} \ + --with-isl=%{prefix} \ + --enable-cloog-backend=isl end # CFLAGS for hardening. @@ -163,10 +176,20 @@ build CFLAGS="%{CFLAGS}" CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g') CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g') + CFLAGS=$(echo ${CFLAGS} | sed -e 's/-mfpmath=sse/-mfpmath=sse -msse2/g') CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g') CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g') CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g') CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g') + CXXFLAGS=$(echo ${CXXFLAGS} | sed -e 's/ -fexceptions / /g') + CXXFLAGS=$(echo ${CXXFLAGS} | sed -e 's/ -Werror=format-security / -Wformat -Werror=format-security /g') + + case "${CFLAGS}" in + *-fasynchronous-unwind-tables*) + sed -i -e "s/-fno-exceptions /-fno-exceptions -fno-asynchronous-unwind-tables/" \ + ../%{thisapp}/Makefile.in + ;; + esac CFLAGS="${CFLAGS}" \ CXXFLAGS="${CXXFLAGS}" \ @@ -188,7 +211,6 @@ build --enable-checking=release \ --disable-werror \ --disable-libssp \ - --disable-static \ --with-system-zlib \ --with-bugurl=http://bugtracker.ipfire.org \ --disable-libunwind-exceptions \ @@ -197,8 +219,12 @@ build --with-linker-hash-style=gnu \ --enable-plugin \ --enable-initfini-array \ + --disable-libgcj \ %{configure_options} + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58012 + # XXX disabled flags: --disable-static + # GCC does not support a parallel build. make %{make_bootstrap} BOOT_CFLAGS="${CFLAGS}" @@ -212,7 +238,7 @@ build end #test - # cd %{DIR_SRC}/gcc-build && make check + # cd %{DIR_SRC}/gcc-build && make -k check || true # cd %{DIR_APP} && ./contrib/test_summary #end @@ -265,12 +291,7 @@ build chmod 755 %{BUILDROOT}%{libdir}/libgomp.so.1.* # libstdc++ - ln -svf ../../../libstdc++.so.6.0.18 ${FULLPATH}/libstdc++.so - - # libmudflap - ln -svf ../../../libmudflap.so.0.0.0 ${FULLPATH}/libmudflap.so - ln -svf ../../../libmudflapth.so.0.0.0 ${FULLPATH}/libmudflapth.so - chmod 755 %{BUILDROOT}%{libdir}/libmudflap{,th}.so.0.* + ln -svf ../../../libstdc++.so.6.0.20 ${FULLPATH}/libstdc++.so # libquadmath if [ "%{build_libquadmath}" = "1" ]; then @@ -282,6 +303,28 @@ build mv -vf %{BUILDROOT}%{libdir}/libitm.spec ${FULLPATH}/ ln -svf ../../../libitm.so.1.0.0 ${FULLPATH}/libitm.so chmod 755 %{BUILDROOT}%{libdir}/libitm.so.1.* + + # liblsan + if [ "%{build_liblsan}" = "1" ]; then + ln -svf ../../../liblsan.so.0.0.0 ${FULLPATH}/liblsan.so + chmod 755 %{BUILDROOT}%{libdir}/liblsan.so.* + fi + + # libtsan + if [ "%{build_libtsan}" = "1" ]; then + ln -svf ../../../libtsan.so.0.0.0 ${FULLPATH}/libtsan.so + chmod 755 %{BUILDROOT}%{libdir}/libtsan.so.* + fi + + # libubsan + ln -svf ../../../libubsan.so.0.0.0 ${FULLPATH}/libubsan.so + chmod 755 %{BUILDROOT}%{libdir}/libubsan.so.* + + # libcilkrts + if [ "%{build_libcilkrts}" = "1" ]; then + ln -svf ../../../libcilkrts.so.5.0.0 ${FULLPATH}/libcilkrts.so + chmod 755 %{BUILDROOT}%{libdir}/libcilkrts.so.5.* + fi end keep_libraries @@ -295,7 +338,7 @@ packages groups += Build requires - binutils >= %{required_binutils_version} + binutils >= %{binutils_version} filesystem >= 002 glibc >= 2.16 glibc-devel @@ -309,8 +352,8 @@ packages provides += libgcc-devel = %{thisver} obsoletes += libgcc-devel < %{thisver} - if "%{build_cloog_ppl}" == "1" - requires += cloog-ppl >= 0.15 + if "%{build_cloog}" == "1" + requires += cloog >= %{cloog_version} end end @@ -382,6 +425,11 @@ packages files %{libdir}/libgcc*.so.* end + + obsoletes + libmudflap + libmudflap-devel + end end package libstdc++ @@ -426,41 +474,6 @@ packages end end - package libmudflap - summary = GCC mudflap shared support library. - description - This package contains GCC shared support library which is needed - for mudflap support. - end - - files - %{libdir}/libmudflap*.so.* - end - end - - package libmudflap-devel - summary = Development files for GCC mudflap support. - description - This package contains headers for building mudflap-instrumented programs. - - To instrument a non-threaded program, add -fmudflap - option to GCC and when linking add -lmudflap, for threaded programs - also add -fmudflapth and -lmudflapth. - end - - requires - libmudflap = %{thisver} - end - - files - %{libdir}/libmudflap.so - %{libdir}/libmudflapth.so - %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/mf-runtime.h - %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libmudflap.so - %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libmudflapth.so - end - end - if "%{build_libquadmath}" == "1" package libquadmath summary = GCC __float128 shared support library. @@ -548,7 +561,7 @@ packages end files - %{libdir}/libasan.so.0* + %{libdir}/libasan.so.1* end end @@ -566,6 +579,45 @@ packages end end + package libubsan + summary = The Undefined Behavior Sanitizer runtime library + description + This package contains the Undefined Behavior Sanitizer library + which is used for -fsanitize=undefined instrumented programs. + end + + files + %{libdir}/libubsan.so.0* + end + end + + if "%{build_liblsan}" == "1" + package liblsan + summary = The Leak Sanitizer runtime library + description + This package contains the Leak Sanitizer library + which is used for -fsanitize=leak instrumented programs. + end + + files + %{libdir}/liblsan.so.0* + end + end + end + + if "%{build_libcilkrts}" == "1" + package libcilkrts + summary = The Cilk+ runtime library + description + This package contains the Cilk+ runtime library. + end + + files + %{libdir}/libcilkrts.so.5* + end + end + end + package gcc-plugin-devel summary = Support for compiling GCC plugins. description diff --git a/gcc/patches/01_all_gcc49_configure.patch b/gcc/patches/01_all_gcc49_configure.patch new file mode 100644 index 000000000..ab9aae047 --- /dev/null +++ b/gcc/patches/01_all_gcc49_configure.patch @@ -0,0 +1,156 @@ +2013-12-30 Magnus Granberg + + * gcc/configure.ac Add --enable-esp and define ENABLE_ESP. + Check if we support crtbeginP and define ENABLE_CRTBEGINP. + * gcc/configure Regenerated + + +--- a/gcc/configure.ac 2011-11-18 11:52:32.000000000 +0100 ++++ b/gcc/configure.ac 2012-10-02 17:39:15.649526241 +0200 +@@ -5130,6 +5237,55 @@ if test x"${LINKER_HASH_STYLE}" != x; th + [The linker hash style]) + fi + ++# -------------- ++# Esp checks ++# -------------- ++ ++# Check whether --enable-esp was given and target have the support. ++AC_ARG_ENABLE([esp], ++[AS_HELP_STRING([--enable-esp], ++ [Enable Stack protector and Position independent executable as ++ default if we have suppot for it when compiling ++ and link with -z now as default. ++ Linux targets supported i*86, x86_64, x32, ++ powerpc, powerpc64, ia64, arm and mips.])], ++ enable_esp=$enableval, ++ enable_esp=no) ++if test $enable_esp = yes ; then ++ AC_MSG_CHECKING(if $target support esp) ++ case "$target" in ++ i?86*-*-linux* | x86_64-*-linux* | powerpc*-*-linux* | mips-*-linux* | arm*-*-linux* | ia64-*-linux*) ++ enable_esp=yes ++ AC_DEFINE(ENABLE_ESP, 1, ++ [Define if your target support esp and you have enable it.]) ++ ;; ++ *) ++ enable_esp=no ++ ;; ++ esac ++AC_MSG_RESULT($enable_esp) ++fi ++AC_SUBST([enable_esp]) ++if test $enable_esp = yes ; then ++ AC_MSG_CHECKING(checking for crtbeginP.o support) ++ if test x$enable_esp = xyes ; then ++ case "$target" in ++ ia64*-*-linux*) ++ enable_crtbeginP=no ;; ++ *-*-linux*) ++ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then ++ enable_crtbeginP=yes ++ AC_DEFINE(ENABLE_CRTBEGINP, 1, ++ [Define if your compiler will support crtbeginP.]) ++ fi ++ ;; ++ *) enable_crtbeginP=no ;; ++ esac ++ fi ++ AC_MSG_RESULT($enable_crtbeginP) ++fi ++AC_SUBST([enable_crtbeginP]) ++ + # Configure the subdirectories + # AC_CONFIG_SUBDIRS($subdirs) + +--- a/gcc/configure 2013-02-01 21:26:24.000000000 +0100 ++++ b/gcc/configure 2013-02-12 01:59:20.000000000 +0100 +@@ -600,6 +600,8 @@ + ac_subst_vars='LTLIBOBJS + LIBOBJS + PICFLAG ++enable_crtbeginP ++enable_esp + enable_host_shared + enable_plugin + pluginlibs +@@ -920,6 +922,7 @@ + enable_plugin + enable_libquadmath_support + with_linker_hash_style ++enable_esp + ' + ac_precious_vars='build_alias + host_alias +@@ -1633,6 +1636,11 @@ + --enable-plugin enable plugin support + --disable-libquadmath-support + disable libquadmath support for Fortran ++ --enable-esp Enable Stack protector and Position independent ++ executable as default if we have suppot for it when ++ compiling and link with -z now as default. ++ Linux targets supported i*86, x86_64, x32, ++ powerpc, powerpc64, ia64, arm and mips. + + Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] +@@ -27419,6 +27427,59 @@ + + fi + ++# -------------- ++# Esp checks ++# -------------- ++ ++# Check whether --enable-esp was given and target have the support. ++# Check whether --enable-esp was given. ++if test "${enable_esp+set}" = set; then : ++ enableval=$enable_esp; enable_esp=$enableval ++else ++ enable_esp=no ++fi ++ ++if test $enable_esp = yes ; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $target support esp" >&5 ++$as_echo_n "checking if $target support esp... " >&6; } ++ case "$target" in ++ i?86*-*-linux* | x86_64-*-linux* | powerpc*-*-linux* | mips*-*-linux* | arm*-*-linux* | ia64-*-linux*) ++ enable_esp=yes ++ ++$as_echo "#define ENABLE_ESP 1" >>confdefs.h ++ ++ ;; ++ *) ++ enable_esp=no ++ ;; ++ esac ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_esp" >&5 ++$as_echo "$enable_esp" >&6; } ++fi ++ ++if test $enable_esp = yes ; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking checking for crtbeginP.o support" >&5 ++$as_echo_n "checking checking for crtbeginP.o support... " >&6; } ++ if test x$enable_esp = xyes ; then ++ case "$target" in ++ ia64*-*-linux*) ++ enable_crtbeginP=no ;; ++ *-*-linux*) ++ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then ++ enable_crtbeginP=yes ++ ++$as_echo "#define ENABLE_CRTBEGINP 1" >>confdefs.h ++ ++ fi ++ ;; ++ *) enable_crtbeginP=no ;; ++ esac ++ fi ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_crtbeginP" >&5 ++$as_echo "$enable_crtbeginP" >&6; } ++fi ++ ++ + # Configure the subdirectories + # AC_CONFIG_SUBDIRS($subdirs) + diff --git a/gcc/patches/02_all_gcc48_config.in.patch0 b/gcc/patches/02_all_gcc48_config.in.patch0 new file mode 100644 index 000000000..3b4747b6b --- /dev/null +++ b/gcc/patches/02_all_gcc48_config.in.patch0 @@ -0,0 +1,32 @@ +2013-02-13 Magnus Granberg + + * gcc/config.in Add ENABLE_CRTBEGINP, ENABLE_ESP + +--- gcc/config.in 2009-04-21 11:08:08.000000000 +0200 ++++ gcc/config.in 2009-05-12 00:10:08.000000000 +0200 +@@ -46,6 +46,12 @@ + #endif + + ++/* Define to 1 to enable crtbeginP.o. */ ++#ifndef USED_FOR_TARGET ++#undef ENABLE_CRTBEGINP ++#endif ++ ++ + /* Define to 1 to specify that we are using the BID decimal floating point + format instead of DPD */ + #ifndef USED_FOR_TARGET +@@ -65,6 +65,12 @@ + #endif + + ++/* Define to 1 to enable esp. */ ++#ifndef USED_FOR_TARGET ++#undef ENABLE_ESP ++#endif ++ ++ + /* Define to 1 to enable fixed-point arithmetic extension to C. */ + #ifndef USED_FOR_TARGET + #undef ENABLE_FIXED_POINT diff --git a/gcc/patches/03_all_gcc49_Makefile.in.patch b/gcc/patches/03_all_gcc49_Makefile.in.patch new file mode 100644 index 000000000..bf53d3ca0 --- /dev/null +++ b/gcc/patches/03_all_gcc49_Makefile.in.patch @@ -0,0 +1,96 @@ +2012-01-17 Magnus Granberg + + * gcc/Makefile.in Add -fno-PIE. to ALL_CFLAGS and + ALL_CXXFLAGS if enable_esp yes. + Echo enable_esp and enable_crtbeginP to tmp-libgcc.mvars. + * libgcc/Makefile.in Add crtbeginP.o to EXTRA_PARTS if enable_crtbeginP yes + We add new file crtbeginP.o if enable_crtbeginP yes + Add -fno-PIE. to CRTSTUFF_CFLAGS. + +--- a/gcc/Makefile.in 2011-11-09 02:20:14.000000000 +0100 ++++ b/gcc/Makefile.in 2011-12-24 22:28:08.864804375 +0100 +@@ -247,6 +247,14 @@ LINKER_FLAGS = $(CFLAGS) + endif + endif + ++# We don't want to compile the compiler with -fPIE, it make PCH fail. ++enable_esp = @enable_esp@ ++ifeq ($(enable_esp),yes) ++ESP_NOPIE_CFLAGS = -fno-PIE ++else ++ESP_NOPIE_CFLAGS= ++endif ++ + # ------------------------------------------- + # Programs which operate on the build machine + # ------------------------------------------- +@@ -974,12 +982,13 @@ INTERNAL_CFLAGS = -DIN_GCC @CROSS@ + + # This is the variable actually used when we compile. If you change this, + # you probably want to update BUILD_CFLAGS in configure.ac +-ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \ ++ALL_CFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) \ + $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@ + + # The C++ version. +-ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \ +- $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) $(WARN_CXXFLAGS) @DEFS@ ++ALL_CXXFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) \ ++ $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) \ ++ $(WARN_CXXFLAGS) @DEFS@ + + # Likewise. Put INCLUDES at the beginning: this way, if some autoconf macro + # puts -I options in CPPFLAGS, our include files in the srcdir will always +@@ -1814,6 +1823,8 @@ libgcc.mvars: config.status Makefile spe + echo GCC_CFLAGS = '$(GCC_CFLAGS)' >> tmp-libgcc.mvars + echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars + echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars ++ echo enable_esp = '$(enable_esp)' >> tmp-libgcc.mvars ++ echo enable_crtbeginP = '@enable_crtbeginP@' >> tmp-libgcc.mvars + + mv tmp-libgcc.mvars libgcc.mvars + +--- a/libgcc/Makefile.in 2011-11-22 04:01:02.000000000 +0100 ++++ b/libgcc/Makefile.in 2011-12-25 15:18:22.449610631 +0100 +@@ -219,6 +219,17 @@ else + DECNUMINC = + endif + ++ifeq ($(enable_esp),yes) ++ESP_NOPIE_CFLAGS = -fno-PIE ++else ++ESP_NOPIE_CFLAGS= ++endif ++ ++# We add crtbeginP.o to the EXTRA_PARTS list if enable_crtbeginP = yes ++ifeq ($(enable_crtbeginP),yes) ++EXTRA_PARTS += crtbeginP.o ++endif ++ + # Options to use when compiling libgcc2.a. + # + LIBGCC2_DEBUG_CFLAGS = -g +@@ -279,7 +290,7 @@ INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CF + CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ + -finhibit-size-directive -fno-inline -fno-exceptions \ + -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \ +- -fno-stack-protector \ ++ -fno-stack-protector $(ESP_NOPIE_CFLAGS) \ + $(INHIBIT_LIBC_CFLAGS) + + # Extra flags to use when compiling crt{begin,end}.o. +@@ -966,6 +977,13 @@ crtendS$(objext): $(srcdir)/crtstuff.c + # This is a version of crtbegin for -static links. + crtbeginT$(objext): $(srcdir)/crtstuff.c + $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O ++ ++# This is a version of crtbegin for -static -fPIE links. ++ifeq ($(enable_crtbeginP),yes) ++crtbeginP$(objext): $(srcdir)/crtstuff.c ++ $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \ ++ -c $< -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O ++endif + + ifeq ($(enable_vtable_verify),yes) + # These are used in vtable verification; see comments in source files for + \ No newline at end of file diff --git a/gcc/patches/04_all_gcc49_default_ssp.patch b/gcc/patches/04_all_gcc49_default_ssp.patch new file mode 100644 index 000000000..50e2645d8 --- /dev/null +++ b/gcc/patches/04_all_gcc49_default_ssp.patch @@ -0,0 +1,261 @@ +2014-04-27 Magnus Granberg + + Patch orig: Debian/Ubuntu + # 484714 + We Add -fstack-protector-strong as default and change + ssp-buffer-size + +--- a/configure.ac ++++ b/configure.ac +@@ -3238,6 +3238,9 @@ case $build in + esac ;; + esac + ++# Needed when we build with -fstack-protector as default. ++stage1_cflags="$stage1_cflags -fno-stack-protector" ++ + AC_SUBST(stage1_cflags) + + # Enable --enable-checking in stage1 of the compiler. +--- a/configure ++++ b/configure +@@ -14453,7 +14453,8 @@ case $build in + esac ;; + esac + +- ++# Needed when we build with -fstack-protector as default. ++stage1_cflags="$stage1_cflags -fno-stack-protector" + + # Enable --enable-checking in stage1 of the compiler. + # Check whether --enable-stage1-checking was given. +--- a/Makefile.in ++++ b/Makefile.in +@@ -362,7 +362,7 @@ BUILD_PREFIX_1 = @BUILD_PREFIX_1@ + + # 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 -fno-stack-protector + BOOT_LDFLAGS= + BOOT_ADAFLAGS= -gnatpg + +@@ -408,9 +408,9 @@ GNATMAKE = @GNATMAKE@ + + CFLAGS = @CFLAGS@ + LDFLAGS = @LDFLAGS@ +-LIBCFLAGS = $(CFLAGS) ++LIBCFLAGS = $(CFLAGS) -fno-stack-protector + CXXFLAGS = @CXXFLAGS@ +-LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates ++LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates -fno-stack-protector + GOCFLAGS = $(CFLAGS) + + TFLAGS = +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -9239,6 +9251,11 @@ Like @option{-fstack-protector} but incl + be protected --- those that have local array definitions, or have + references to local frame addresses. + ++NOTE: In Gentoo GCC 4.9.0 and later versions this option is enabled by default ++for C, C++, ObjC, ObjC++, if neither @option{-fno-stack-protector}, ++@option{-nostdlib}, @option{-ffreestanding}, @option{-fstack-protector}, ++@option{-fstack-protector-strong}or @option{-fstack-protector-all}are found. ++ + @item -fsection-anchors + @opindex fsection-anchors + Try to reduce the number of symbolic address calculations by using +@@ -9461,6 +9465,9 @@ + The minimum size of buffers (i.e.@: arrays) that receive stack smashing + protection when @option{-fstack-protection} is used. + ++NOTE: In Gentoo this is change from "8" to "4", to increase ++the number of functions protected by the stack protector. ++ + @item max-jump-thread-duplication-stmts + Maximum number of statements allowed in a block that needs to be + duplicated when threading jumps. +--- a/gcc/cp/lang-specs.h ++++ b/gcc/cp/lang-specs.h +@@ -46,7 +46,7 @@ along with GCC; see the file COPYING3. If not see + %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\ + cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\ + %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\ +- %(cc1_options) %2\ ++ %(cc1_options) %(ssp_default) %2\ + %{!fsyntax-only:%{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\ + %W{o*:--output-pch=%*}}%V}}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, +@@ -57,11 +57,11 @@ along with GCC; see the file COPYING3. If not see + %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\ + cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\ + %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\ +- %(cc1_options) %2\ ++ %(cc1_options) %(ssp_default) %2\ + %{!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\ ++ cc1plus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, +--- a/gcc/gcc.c ++++ b/gcc/gcc.c +@@ -651,6 +651,19 @@ proper position among the other output files. */ + #define LINK_GCC_C_SEQUENCE_SPEC "%G %L %G" + #endif + ++#ifndef SSP_DEFAULT_SPEC ++#if defined ( TARGET_LIBC_PROVIDES_SSP ) && defined ( EFAULT_SSP ) ++#define SSP_DEFAULT_SPEC "%{fno-stack-protector|fstack-protector| \ ++ fstack-protector-strong|fstack-protector-all| \ ++ ffreestanding|nostdlib:;:-fstack-protector-strong}" ++/* Add -fno-stack-protector for the use of gcc-specs-ssp. */ ++#define CC1_SSP_DEFAULT_SPEC "%{!fno-stack-protector:}" ++#else ++#define SSP_DEFAULT_SPEC "" ++#define CC1_SSP_DEFAULT_SPEC "" ++#endif ++#endif ++ + #ifndef LINK_SSP_SPEC + #ifdef TARGET_LIBC_PROVIDES_SSP + #define LINK_SSP_SPEC "%{fstack-protector:}" +@@ -771,7 +781,7 @@ proper position among the other output f + + static const char *asm_debug = ASM_DEBUG_SPEC; + static const char *cpp_spec = CPP_SPEC; +-static const char *cc1_spec = CC1_SPEC; ++static const char *cc1_spec = CC1_SPEC CC1_SSP_DEFAULT_SPEC; + 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; +@@ -777,6 +785,8 @@ static const char *cc1_spec = CC1_SPEC; + 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; ++static const char *ssp_default_spec = SSP_DEFAULT_SPEC; ++static const char *cc1_ssp_default_spec = CC1_SSP_DEFAULT_SPEC; + static const char *asm_spec = ASM_SPEC; + static const char *asm_final_spec = ASM_FINAL_SPEC; + static const char *link_spec = LINK_SPEC; +@@ -835,7 +844,7 @@ static const char *cpp_unique_options = + 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} %(ssp_default)"; + + /* This contains cpp options which are not passed when the preprocessor + output will be used by another program. */ +@@ -1015,9 +1024,9 @@ static const struct compiler default_compilers[] = + %{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) %(ssp_default)}\ + %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\ +- cc1 %(cpp_unique_options) %(cc1_options)}}}\ ++ cc1 %(cpp_unique_options) %(cc1_options) %(ssp_default)}}}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 1}, + {"-", + "%{!E:%e-E or -x required when input is from standard input}\ +@@ -1040,7 +1049,7 @@ static const struct compiler default_compilers[] = + %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0}, + {".i", "@cpp-output", 0, 0, 0}, + {"@cpp-output", +- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, ++ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(ssp_default) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, + {".s", "@assembler", 0, 0, 0}, + {"@assembler", + "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0}, +@@ -1267,6 +1276,8 @@ static struct spec_list static_specs[] = + INIT_STATIC_SPEC ("cc1plus", &cc1plus_spec), + INIT_STATIC_SPEC ("link_gcc_c_sequence", &link_gcc_c_sequence_spec), + INIT_STATIC_SPEC ("link_ssp", &link_ssp_spec), ++ INIT_STATIC_SPEC ("ssp_default", &ssp_default_spec), ++ INIT_STATIC_SPEC ("cc1_ssp_default", &cc1_ssp_default_spec), + INIT_STATIC_SPEC ("endfile", &endfile_spec), + INIT_STATIC_SPEC ("link", &link_spec), + INIT_STATIC_SPEC ("lib", &lib_spec), +--- a/gcc/objc/lang-specs.h ++++ b/gcc/objc/lang-specs.h +@@ -29,9 +29,9 @@ along with GCC; see the file COPYING3. If not see + %{traditional|traditional-cpp:\ + %eGNU Objective C no longer supports traditional compilation}\ + %{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\ +- cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}\ ++ cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %(ssp_default) %{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) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}}}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, + {"@objective-c-header", + "%{E|M|MM:cc1obj -E %{traditional|traditional-cpp:-traditional-cpp}\ +@@ -40,18 +40,18 @@ along with GCC; see the file COPYING3. If not see + %{traditional|traditional-cpp:\ + %eGNU Objective C no longer supports traditional compilation}\ + %{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\ +- cc1obj -fpreprocessed %b.mi %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\ ++ cc1obj -fpreprocessed %b.mi %(cc1_options) %(ssp_default) %{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) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\ + -o %g.s %{!o*:--output-pch=%i.gch}\ + %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0}, + {".mi", "@objective-c-cpp-output", 0, 0, 0}, + {"@objective-c-cpp-output", +- "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\ ++ "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, + {"@objc-cpp-output", + "%nobjc-cpp-output is deprecated; please use objective-c-cpp-output instead\n\ +- %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\ ++ %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, +--- a/gcc/objcp/lang-specs.h ++++ b/gcc/objcp/lang-specs.h +@@ -36,7 +36,7 @@ along with GCC; see the file COPYING3. If not see + %(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\ + cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\ + %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\ +- %(cc1_options) %2\ ++ %(cc1_options) %(ssp_default) %2\ + -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {"@objective-c++", +@@ -46,16 +46,16 @@ along with GCC; see the file COPYING3. If not see + %(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\ + cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\ + %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\ +- %(cc1_options) %2\ ++ %(cc1_options) %(ssp_default) %2\ + %{!fsyntax-only:%(invoke_as)}}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {".mii", "@objective-c++-cpp-output", 0, 0, 0}, + {"@objective-c++-cpp-output", + "%{!M:%{!MM:%{!E:\ +- cc1objplus -fpreprocessed %i %(cc1_options) %2\ ++ cc1objplus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, + {"@objc++-cpp-output", + "%nobjc++-cpp-output is deprecated; please use objective-c++-cpp-output instead\n\ + %{!M:%{!MM:%{!E:\ +- cc1objplus -fpreprocessed %i %(cc1_options) %2\ ++ cc1objplus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, +--- a/gcc/params.def ++++ b/gcc/params.def +@@ -662,7 +662,7 @@ DEFPARAM (PARAM_INTEGER_SHARE_LIMIT, + DEFPARAM (PARAM_SSP_BUFFER_SIZE, + "ssp-buffer-size", + "The lower bound for a buffer to be considered for stack smashing protection", +- 8, 1, 0) ++ 4, 1, 0) + + /* When we thread through a block we have to make copies of the + statements within the block. Clearly for large blocks the code diff --git a/gcc/patches/05_all_gcc48_gcc.c.patch0 b/gcc/patches/05_all_gcc48_gcc.c.patch0 new file mode 100644 index 000000000..ddfcafd6e --- /dev/null +++ b/gcc/patches/05_all_gcc48_gcc.c.patch0 @@ -0,0 +1,25 @@ +2014-01-01 Magnus Granberg + + * gcc/gcc.c include esp.h + static const char *cc1_spec We set that in esp.h if ENABLE_ESP. + +--- gcc/gcc.c 2010-01-21 10:29:30.000000000 -0500 ++++ gcc/gcc.c 2010-01-29 23:29:16.000000000 -0500 +@@ -44,6 +44,7 @@ + #include "opts.h" + #include "params.h" + #include "vec.h" ++#include "config/esp.h" /* for --enable-esp support */ + #include "filenames.h" + + /* By default there is no special suffix for target executables. */ +@@ -822,7 +823,9 @@ + + static const char *asm_debug; + static const char *cpp_spec = CPP_SPEC; ++#ifndef ENABLE_ESP + static const char *cc1_spec = CC1_SPEC CC1_SSP_DEFAULT_SPEC; ++#endif + static const char *cc1plus_spec = CC1PLUS_SPEC; + static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC; + static const char *link_ssp_spec = LINK_SSP_SPEC; diff --git a/gcc/patches/10_all_gcc49_default-fortify-source.patch b/gcc/patches/10_all_gcc49_default-fortify-source.patch new file mode 100644 index 000000000..ad2f2b1c2 --- /dev/null +++ b/gcc/patches/10_all_gcc49_default-fortify-source.patch @@ -0,0 +1,29 @@ +Enable -D_FORTIFY_SOURCE=2 by default. + + +--- a/gcc/c-family/c-cppbuiltin.c ++++ b/gcc/c-family/c-cppbuiltin.c +@@ -951,6 +951,9 @@ c_cpp_builtins (cpp_reader *pfile) + builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); + builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); + ++ /* Fortify Source enabled by default w/optimization. */ ++ cpp_define (pfile, "_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0)"); ++ + /* Misc. */ + if (flag_gnu89_inline) + cpp_define (pfile, "__GNUC_GNU_INLINE__"); +--- a/gcc/doc/gcc.info ++++ b/gcc/doc/gcc.info +@@ -6255,6 +6255,11 @@ find out the exact set of optimizations that are enabled at each level. + Please note the warning under '-fgcse' about invoking '-O2' on + programs that use computed gotos. + ++ NOTE: In Gentoo, `-D_FORTIFY_SOURCE=2' is set by default, and is ++ activated when `-O' is set to 2 or higher. This enables additional ++ compile-time and run-time checks for several libc functions. To disable, ++ specify either `-U_FORTIFY_SOURCE' or `-D_FORTIFY_SOURCE=0'. ++ + '-O3' + Optimize yet more. '-O3' turns on all optimizations specified by + '-O2' and also turns on the '-finline-functions', diff --git a/gcc/patches/11_all_gcc49_default-warn-format-security.patch b/gcc/patches/11_all_gcc49_default-warn-format-security.patch new file mode 100644 index 000000000..ee6c7c439 --- /dev/null +++ b/gcc/patches/11_all_gcc49_default-warn-format-security.patch @@ -0,0 +1,43 @@ +Enable -Wformat and -Wformat-security by default. + + +--- a/gcc/c-family/c.opt ++++ b/gcc/c-family/c.opt +@@ -412,7 +412,7 @@ C ObjC C++ ObjC++ Var(warn_format_nonliteral) Warning LangEnabledBy(C ObjC C++ O + Warn about format strings that are not literals + + Wformat-security +-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) ++C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) + Warn about possible security problems with format functions + + Wformat-y2k +@@ -424,7 +424,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++ + Warn about zero-length formats + + Wformat= +-C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) ++C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) + Warn about printf/scanf/strftime/strfmon format string anomalies + + Wignored-qualifiers +--- a/gcc/doc/gcc.info ++++ b/gcc/doc/gcc.info +@@ -3451,6 +3451,8 @@ compiler warns that an unrecognized option is present. + '-Wno-format-contains-nul', '-Wno-format-extra-args', and + '-Wno-format-zero-length'. '-Wformat' is enabled by '-Wall'. + ++ This option is enabled by default in Gentoo. ++ + '-Wno-format-contains-nul' + If '-Wformat' is specified, do not warn about format strings + that contain NUL bytes. +@@ -3496,6 +3498,8 @@ compiler warns that an unrecognized option is present. + future warnings may be added to '-Wformat-security' that are + not included in '-Wformat-nonliteral'.) + ++ This option is enabled by default in Gentoo. ++ + '-Wformat-y2k' + If '-Wformat' is specified, also warn about 'strftime' formats + that may yield only a two-digit year. diff --git a/gcc/patches/12_all_gcc49_default-warn-trampolines.patch b/gcc/patches/12_all_gcc49_default-warn-trampolines.patch new file mode 100644 index 000000000..9ab4378d4 --- /dev/null +++ b/gcc/patches/12_all_gcc49_default-warn-trampolines.patch @@ -0,0 +1,25 @@ +Enable -Wtrampolines by default. + + +--- a/gcc/common.opt ++++ b/gcc/common.opt +@@ -648,7 +648,7 @@ Common Var(warn_system_headers) Warning + Do not suppress warnings from system headers + + Wtrampolines +-Common Var(warn_trampolines) Warning ++Common Var(warn_trampolines) Init(1) Warning + Warn whenever a trampoline is generated + + Wtype-limits +--- a/gcc/doc/gcc.info ++++ b/gcc/doc/gcc.info +@@ -4021,6 +4021,8 @@ compiler warns that an unrecognized option is present. + and thus requires the stack to be made executable in order for the + program to work properly. + ++ This warning is enabled by default in Gentoo. ++ + '-Wfloat-equal' + Warn if floating-point values are used in equality comparisons. + diff --git a/gcc/patches/16_all_gcc47_nopie_option.patch b/gcc/patches/16_all_gcc47_nopie_option.patch new file mode 100644 index 000000000..ed9a961d7 --- /dev/null +++ b/gcc/patches/16_all_gcc47_nopie_option.patch @@ -0,0 +1,16 @@ +2012-01-24 Magnus Granberg + + * gcc/common.opt Add -nopie + +--- a/gcc/common.opt 2011-11-23 19:51:17.000000000 +0100 ++++ b//gcc/common.opt 2012-01-24 16:56:24.302224357 +0100 +@@ -2280,6 +2280,9 @@ Driver + nodefaultlibs + Driver + ++nopie ++Driver ++ + nostartfiles + Driver + diff --git a/gcc/patches/20_all_gcc49_config_crtbeginp.patch0 b/gcc/patches/20_all_gcc49_config_crtbeginp.patch0 new file mode 100644 index 000000000..4bd5c1818 --- /dev/null +++ b/gcc/patches/20_all_gcc49_config_crtbeginp.patch0 @@ -0,0 +1,40 @@ +2014-04-23 Magnus Granberg + + * gcc/config/gnu-user.h If ENABLE_CRTBEGINP, -static and -pie use crtbegineP.o. + * gcc/config/rs6000/sysv4.h If ENABLE_CRTBEGINP, -static and -pie use crtbegineP.o. + +--- gcc/config/gnu-user.h 2014-01-02 23:23:26.000000000 +0100 ++++ gcc/config/gnu-user.h 2014-04-23 00:55:06.390265454 +0200 +@@ -40,7 +40,15 @@ see the files COPYING3 and COPYING.RUNTI + provides part of the support for getting C++ file-scope static + object constructed before entering `main'. */ + +-#if defined HAVE_LD_PIE ++#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINP) ++#define GNU_USER_TARGET_STARTFILE_SPEC \ ++ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ ++ crti.o%s %{static:%{pie:crtbeginP.o%s;:crtbeginT.o%s}; \ ++ shared|pie:crtbeginS.o%s;:crtbegin.o%s} \ ++ %{fvtable-verify=none:%s; \ ++ fvtable-verify=preinit:vtv_start_preinit.o%s; \ ++ fvtable-verify=std:vtv_start.o%s}" ++#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINP) + #define GNU_USER_TARGET_STARTFILE_SPEC \ + "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ + crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \ +--- gcc/config/rs6000/sysv4.h 2009-04-10 01:23:07.000000000 +0200 ++++ gcc/config/rs6000/sysv4.h 2009-09-08 04:41:50.000000000 +0200 +@@ -883,7 +883,12 @@ + %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \ + %{!shared: %{profile:-lc_p} %{!profile:-lc}}}" + +-#ifdef HAVE_LD_PIE ++#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINP) ++#define STARTFILE_LINUX_SPEC "\ ++%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ ++%{mnewlib:ecrti.o%s;:crti.o%s} \ ++%{static:%{pie:crtbeginP.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}" ++#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINP) + #define STARTFILE_LINUX_SPEC "\ + %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ + %{mnewlib:ecrti.o%s;:crti.o%s} \ diff --git a/gcc/patches/24_all_gcc49_invoke.texi.patch0 b/gcc/patches/24_all_gcc49_invoke.texi.patch0 new file mode 100644 index 000000000..856a4e5d1 --- /dev/null +++ b/gcc/patches/24_all_gcc49_invoke.texi.patch0 @@ -0,0 +1,44 @@ +2014-04-24 Magnus Granberg + + * gcc/doc/invoke.texi Add NOTES about -fstack-protector-all, -pie and + -fPIE/-fpie when --enable-esp is enable, this options is on by default. + +--- gcc/doc/invoke.texi 2009-04-01 09:18:47.000000000 +0200 ++++ gcc/doc/invoke.texi 2009-06-18 14:08:38.000000000 +0200 +@@ -9233,6 +9245,11 @@ If a guard check fails, an error message + @opindex fstack-protector-all + Like @option{-fstack-protector} except that all functions are protected. + ++NOTE: NOTE: When --enable-esp this option is enabled by default ++for C, C++, ObjC, ObjC++, if neither @option{-fno-stack-protector}, ++@option{-nostdlib}, @option{-ffreestanding}, @option{-fstack-protector}, ++@option{-fstack-protector-strong}or @option{-fstack-protector-all}are found. ++ + @item -fstack-protector-strong + @opindex fstack-protector-strong + Like @option{-fstack-protector} but includes additional functions to +@@ -7960,6 +7965,12 @@ + that were used to generate code (@option{-fpie}, @option{-fPIE}, + or model suboptions) when you specify this option. + ++NOTE: When --enable-esp this option is enabled by default ++for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE} ++or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or ++@option{-nostartfiles} or @option{-shared} or @option{-pg} or @option{-p} ++are found. ++ + @item -rdynamic + @opindex rdynamic + Pass the flag @option{-export-dynamic} to the ELF linker, on targets +@@ -15889,6 +15910,11 @@ + @code{__pie__} and @code{__PIE__}. The macros have the value 1 + for @option{-fpie} and 2 for @option{-fPIE}. + ++NOTE: When --enable-esp this option is enabled by default ++for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE} ++or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or ++@option{-nostartfiles} or @option{-shared} are found. ++ + @item -fno-jump-tables + @opindex fno-jump-tables + Do not use jump tables for switch statements even where it would be diff --git a/gcc/patches/34_all_gcc48_config_i386.patch b/gcc/patches/34_all_gcc48_config_i386.patch new file mode 100644 index 000000000..9f0f7a3d4 --- /dev/null +++ b/gcc/patches/34_all_gcc48_config_i386.patch @@ -0,0 +1,56 @@ +2013-03-24 Magnus Granberg + + * gcc/config/i386/gnu-user-common.h (DRIVER_SELF_SPECS): Add ESP_DRIVER_SELF_SPEC. + * gcc/config/i386/gnu-user.h (SUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS. + * gcc/config/i386/i386.h (SUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS. + +--- a/gcc/config/i386/gnu-user-common.h 2013-01-10 21:38:27.000000000 +0100 ++++ b/gcc/config/i386/gnu-user-common.h 2013-02-14 00:51:44.689637605 +0100 +@@ -70,3 +70,7 @@ along with GCC; see the file COPYING3. + + /* Static stack checking is supported by means of probes. */ + #define STACK_CHECK_STATIC_BUILTIN 1 ++ ++#ifdef ENABLE_ESP ++#define DRIVER_SELF_SPECS ESP_DRIVER_SELF_SPEC ++#endif +--- a/gcc/config/i386/gnu-user.h 2011-05-05 14:32:50.000000000 +0200 ++++ b/gcc/config/i386/gnu-user.h 2012-07-09 14:28:38.726289455 +0200 +@@ -93,9 +93,16 @@ along with GCC; see the file COPYING3. + "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" + + #undef SUBTARGET_EXTRA_SPECS ++#ifdef ENABLE_ESP + #define SUBTARGET_EXTRA_SPECS \ + { "link_emulation", GNU_USER_LINK_EMULATION },\ +- { "dynamic_linker", GNU_USER_DYNAMIC_LINKER } ++ { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }, \ ++ ESP_EXTRA_SPECS ++#else ++#define SUBTARGET_EXTRA_SPECS \ ++ { "link_emulation", GNU_USER_LINK_EMULATION },\ ++ { "dynamic_linker", GNU_USER_DYNAMIC_LINKER } ++#endif + + #undef LINK_SPEC + #define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \ +--- a/gcc/config/i386/i386.h 2011-11-24 23:11:12.000000000 +0100 ++++ b/gcc/config/i386/i386.h 2012-07-09 14:21:24.575276517 +0200 +@@ -617,13 +617,16 @@ enum target_cpu_default + Do not define this macro if it does not need to do anything. */ + + #ifndef SUBTARGET_EXTRA_SPECS ++#ifdef ENABLE_ESP ++#define SUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS ++#else + #define SUBTARGET_EXTRA_SPECS + #endif ++#endif + + #define EXTRA_SPECS \ + { "cc1_cpu", CC1_CPU_SPEC }, \ + SUBTARGET_EXTRA_SPECS +- + + /* Set the value of FLT_EVAL_METHOD in float.h. When using only the + FPU, assume that the fpcw is set to extended precision; when using diff --git a/gcc/patches/35_all_gcc48_config_arm.patch b/gcc/patches/35_all_gcc48_config_arm.patch new file mode 100644 index 000000000..5aecc6ba3 --- /dev/null +++ b/gcc/patches/35_all_gcc48_config_arm.patch @@ -0,0 +1,35 @@ +2013-06-03 Magnus Granberg + + * gcc/config/arm/arm.h (DRIVER_SELF_SPECS): Add ESP_DRIVER_SELF_SPEC. + * gcc/config/arm/elf.h (SUBSUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS. + +--- a/gcc/config/arm/arm.h 2013-01-15 17:17:28.000000000 +0100 ++++ b/gcc/config/arm/arm.h 2013-02-18 22:45:18.327284928 +0100 +@@ -2326,6 +2326,11 @@ extern const char *host_detect_local_cpu + # define MCPU_MTUNE_NATIVE_SPECS "" + #endif + +-#define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS +- ++#ifdef ENABLE_ESP ++# define DRIVER_SELF_SPECS \ ++ MCPU_MTUNE_NATIVE_SPECS, \ ++ ESP_DRIVER_SELF_SPEC ++#else ++# define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS ++#endif + #endif /* ! GCC_ARM_H */ +--- a/gcc/config/arm/elf.h 2013-01-10 21:38:27.000000000 +0100 ++++ b/gcc/config/arm/elf.h 2013-05-19 02:15:49.595855825 +0200 +@@ -49,7 +49,11 @@ + #endif + + #undef SUBSUBTARGET_EXTRA_SPECS ++#ifdef ENABLE_ESP ++#define SUBSUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS ++#else + #define SUBSUBTARGET_EXTRA_SPECS ++#endif + + #ifndef ASM_SPEC + #define ASM_SPEC "\ diff --git a/gcc/patches/40_all_gcc49_config_esp.patch0 b/gcc/patches/40_all_gcc49_config_esp.patch0 new file mode 100644 index 000000000..ec3482eab --- /dev/null +++ b/gcc/patches/40_all_gcc49_config_esp.patch0 @@ -0,0 +1,135 @@ +2014-05-12 Magnus Granberg + + * gcc/esp.h New file to support --enable-esp + Version 20140512.1 + +--- gcc/config/esp.h 2010-04-09 16:14:00.000000000 +0200 ++++ gcc/config/esp.h 2012-06-23 01:00:31.248348491 +0200 +@@ -0,0 +1,127 @@ ++/* License terms see GNU GENERAL PUBLIC LICENSE Version 3. ++ * Version 20140512.1 ++ * Magnus Granberg (Zorry) */ ++#ifndef GCC_ESP_H ++#define GCC_ESP_H ++ ++/* This file will add -fstack-protector-all, -fstack-check, -fPIE, -pie and -z now ++ as default if the defines and the spec allow it. ++ Added a hack for gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass ++ to support older hardened GCC patches and we don't need to change the code on gcc-specs-* and _filter-hardened. ++ This will add some unsupported upstream commands options as -nopie and -nonow. ++ -D__KERNEL__ is added so we don't have -fPIE, -pie and -fstack-protector-all and -fstack-check when building kernels. ++ ESP_CC1_SPEC is added to CC1_SPEC. ++ ESP_CC1_STRICT_OVERFLOW_SPEC is added so we don't disable the strict-overflow check. ++ ESP_LINK_PIE_CHECK_SPEC check for -pie, -p, -pg, -profile and -static. ++ ENABLE_CRTBEGINP add support for crtbeginP.o, build -static with -fPIE or -fpie. ++*/ ++#ifdef ENABLE_ESP ++ ++ /* Hack to support gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass */ ++ #define ESP_CC1_SPEC " %(esp_cc1_ssp) %(esp_cc1_pie) %(esp_cc1_strict_overflow)" ++ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) ++ #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: %{!fno-stack-check: }}}" ++ #else ++ #define ESP_CC1_SSP_SPEC "" ++ #endif ++ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP ) ++ #define ESP_CC1_PIE_SPEC "%{!nopie: }" ++ #else ++ #define ESP_CC1_PIE_SPEC "" ++ #endif ++ #define ESP_CC1_STRICT_OVERFLOW_SPEC "%{!fstrict-overflow:%{!fno-strict-overflow: -fno-strict-overflow}}" ++ ++ /* ESP_LINK_SPEC is added to LINK_PIE_SPEC if esp is enable ++ -z now will be added if we don't have -vanilla spec. We do a -pie incompatible check ++ Don't remove the specs in the end */ ++ #define ESP_LINK_SPEC "%(esp_link_now) %(esp_link_pie_check) " ++ #define ESP_LINK_NOW_SPEC "%{!nonow:-z now}" ++ ++ /* We use ESP_DRIVER_SELF_SPEC to add pie and ssp command-line options. */ ++ #define ESP_DRIVER_SELF_SPEC "%{D__KERNEL__:;:%{!nopie:%(esp_options_pie) \ ++ %(esp_link_pie)} %(esp_options_ssp) }" ++ ++ /* This will add -fstack-protector-all if we don't have -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector ++ -fstack-protector-all and we have EFAULT_SSP or EFAULT_PIE_SSP defined. */ ++ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) ++ #define ESP_OPTIONS_SSP_SPEC \ ++ "%{nostdlib|ffreestanding|fno-stack-protector|fstack-protector| \ ++ fstack-protector-all|fstack-protector-strong:;:-fstack-protector-all} \ ++ %{fstack-check|fstack-check=*:;: -fstack-check}" ++ #else ++ #define ESP_OPTIONS_SSP_SPEC "" ++ #endif ++ ++ /* If EFAULT_PIE or EFAULT_PIE_SSP is defined we will add -fPIE -pie */ ++ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP ) ++ ++ /* This will add -fPIE if we don't have -pie -fpic -fPIC -fpie -fPIE -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static ++ -nostdlib -nostartfiles. */ ++ /* With ENABLE_CRTBEGINP we don't need to check for -static */ ++ #ifdef ENABLE_CRTBEGINP ++ #define ESP_OPTIONS_PIE_SPEC \ ++ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \ ++ %{!shared: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }" ++ #else ++ #define ESP_OPTIONS_PIE_SPEC \ ++ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \ ++ %{!shared: %{!static: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }}" ++ #endif ++ ++ /* This will add -pie if we don't have -pie -A -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static -r -nostdlib ++ -nostartfiles */ ++ /* With ENABLE_CRTBEGINP we don't need to check for -static ++ and we add -pie only to get the start and endfiles. -pie will not go to the linker. */ ++ #ifdef ENABLE_CRTBEGINP ++ #define ESP_LINK_PIE_SPEC \ ++ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!r: \ ++ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}" ++ #else ++ #define ESP_LINK_PIE_SPEC \ ++ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r: \ ++ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}}" ++ #endif ++ ++ /* This will check if -pie is set when (-static) -pg -p -profile. If set it will make gcc print out ++ "-pie and (static)|pg|p|profile are incompatible when linking" */ ++ /* With ENABLE_CRTBEGINP we don't need to check for -static */ ++ #ifdef ENABLE_CRTBEGINP ++ #define ESP_LINK_PIE_CHECK_SPEC \ ++ "%{pie:%{pg|p|profile:%e-pie and -pg|p|profile are incompatible when linking}}" ++ #else ++ #define ESP_LINK_PIE_CHECK_SPEC \ ++ "%{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible when linking}}" ++ #endif ++ ++ /* We don't pass -pie to the linker when -static. */ ++ #ifdef ENABLE_CRTBEGINP ++ #define LINK_PIE_SPEC "%{!static:%{pie:-pie}} %(esp_link)" ++ #else ++ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)" ++ #endif ++ ++ #else ++ #define ESP_OPTIONS_PIE_SPEC "" ++ #define ESP_LINK_PIE_CHECK_SPEC "" ++ #define ESP_LINK_PIE_SPEC "" ++ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)" ++ #endif ++ ++ /* We add extra spec name's to the EXTRA_SPECS list */ ++ #define ESP_EXTRA_SPECS \ ++ { "esp_cc1", ESP_CC1_SPEC }, \ ++ { "esp_cc1_pie", ESP_CC1_PIE_SPEC }, \ ++ { "esp_cc1_ssp", ESP_CC1_SSP_SPEC }, \ ++ { "esp_cc1_strict_overflow", ESP_CC1_STRICT_OVERFLOW_SPEC }, \ ++ { "esp_link", ESP_LINK_SPEC }, \ ++ { "esp_link_now", ESP_LINK_NOW_SPEC }, \ ++ { "esp_link_pie", ESP_LINK_PIE_SPEC }, \ ++ { "esp_link_pie_check", ESP_LINK_PIE_CHECK_SPEC }, \ ++ { "esp_driver_self", ESP_DRIVER_SELF_SPEC }, \ ++ { "esp_options_pie", ESP_OPTIONS_PIE_SPEC }, \ ++ { "esp_options_ssp", ESP_OPTIONS_SSP_SPEC } ++ ++ static const char *cc1_spec = CC1_SPEC ESP_CC1_SPEC; ++ ++#endif ++#endif /* End GCC_ESP_H */ diff --git a/gcc/patches/53_all_libitm-no-fortify-source.patch b/gcc/patches/53_all_libitm-no-fortify-source.patch new file mode 100644 index 000000000..5ab15afc3 --- /dev/null +++ b/gcc/patches/53_all_libitm-no-fortify-source.patch @@ -0,0 +1,27 @@ +https://bugs.gentoo.org/508852 +https://gcc.gnu.org/PR61164 + +2014-04-27 Magnus Granberg + + #508852 + * libitm/configure.tgt: Disable FORTIFY + +--- a/libitm/configure.tgt ++++ b/libitm/configure.tgt +@@ -43,6 +43,16 @@ if test "$gcc_cv_have_tls" = yes ; then + esac + fi + ++# FIXME: error: inlining failed in call to always_inline ++# ‘int vfprintf(FILE*, const char*, __va_list_tag*)’ ++# : function body can be overwritten at link time ++# Disable Fortify in libitm for now. #508852 ++case "${target}" in ++ *-*-linux*) ++ XCFLAGS="${XCFLAGS} -U_FORTIFY_SOURCE" ++ ;; ++esac ++ + # Map the target cpu to an ARCH sub-directory. At the same time, + # work out any special compilation flags as necessary. + case "${target_cpu}" in diff --git a/gcc/patches/gcc-4.8.1-piepatch-20130628.patch b/gcc/patches/gcc-4.8.1-piepatch-20130628.patch deleted file mode 100644 index 839e3032f..000000000 --- a/gcc/patches/gcc-4.8.1-piepatch-20130628.patch +++ /dev/null @@ -1,874 +0,0 @@ -diff -Nur gcc-4.8.1-vanilla/configure gcc-4.8.1/configure ---- gcc-4.8.1-vanilla/configure 2013-02-15 18:45:54.000000000 +0100 -+++ gcc-4.8.1/configure 2013-06-27 23:57:54.004095553 +0200 -@@ -670,6 +670,7 @@ - CFLAGS - CC - EXTRA_CONFIGARGS_LIBJAVA -+enable_esp - target_subdir - host_subdir - build_subdir -@@ -748,6 +749,7 @@ - enable_libquadmath - enable_libquadmath_support - enable_libada -+enable_esp - enable_libssp - enable_libstdcxx - enable_static_libjava -@@ -1464,6 +1466,11 @@ - --disable-libquadmath-support - disable libquadmath support for Fortran - --enable-libada build libada directory -+ --enable-esp Enable Stack protector and Position independent -+ executable as default if we have suppot for it when -+ compiling and link with and -z now as default. -+ Linux targets supported i*86, x86_64, x32, -+ powerpc, powerpc64, ia64, arm and mips. - --enable-libssp build libssp directory - --disable-libstdcxx do not build libstdc++-v3 directory - --enable-static-libjava[=ARG] -@@ -3068,6 +3075,24 @@ - noconfigdirs="$noconfigdirs gnattools" - fi - -+# Check whether --enable-esp was given and target have the support. -+# Check whether --enable-esp was given. -+if test "${enable_esp+set}" = set; then : -+ enableval=$enable_esp; -+ case $target in -+ i?86*-*-linux* | x86_64-*-linux* | powerpc*-*-linux* | mips*-*-linux* | arm*-*-linux* | ia64-*-linux*) -+ enable_esp=yes -+ ;; -+ *) -+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** --enable-esp is not supported on this $target target." >&5 -+$as_echo "$as_me: WARNING: *** --enable-esp is not supported on this $target target." >&2;} -+ ;; -+ esac -+ -+fi -+ -+ -+ - # Check whether --enable-libssp was given. - if test "${enable_libssp+set}" = set; then : - enableval=$enable_libssp; ENABLE_LIBSSP=$enableval -@@ -14456,6 +14481,11 @@ - esac ;; - esac - -+# Disable -fstack-protector on stage1 -+if test x$enable_esp = xyes; then -+ stage1_cflags="$stage1_cflags -fno-stack-protector" -+fi -+ - - - # Enable --enable-checking in stage1 of the compiler. -diff -Nur gcc-4.8.1-vanilla/configure.ac gcc-4.8.1/configure.ac ---- gcc-4.8.1-vanilla/configure.ac 2013-02-15 18:45:54.000000000 +0100 -+++ gcc-4.8.1/configure.ac 2013-06-27 23:57:53.999095429 +0200 -@@ -423,6 +423,26 @@ - noconfigdirs="$noconfigdirs gnattools" - fi - -+# Check whether --enable-esp was given and target have the support. -+AC_ARG_ENABLE([esp], -+[AS_HELP_STRING([--enable-esp], -+ [Enable Stack protector and Position independent executable as -+ default if we have suppot for it when compiling -+ and link with -z relro and -z now as default. -+ Linux targets supported i*86, x86_64, x32, -+ powerpc, powerpc64, ia64, arm and mips.])], -+[ -+ case $target in -+ i?86*-*-linux* | x86_64-*-linux* | powerpc*-*-linux* | mips-*-linux* | arm*-*-linux* | ia64-*-linux*) -+ enable_esp=yes -+ ;; -+ *) -+ AC_MSG_WARN([*** --enable-esp is not supported on this $target target.]) -+ ;; -+ esac -+]) -+AC_SUBST([enable_esp]) -+ - AC_ARG_ENABLE(libssp, - [AS_HELP_STRING([--enable-libssp], [build libssp directory])], - ENABLE_LIBSSP=$enableval, -@@ -3241,6 +3261,11 @@ - esac ;; - esac - -+# Disable -fstack-protector on stage1 -+if test x$enable_esp = xyes; then -+ stage1_cflags="$stage1_cflags -fno-stack-protector" -+fi -+ - AC_SUBST(stage1_cflags) - - # Enable --enable-checking in stage1 of the compiler. -diff -Nur gcc-4.8.1-vanilla/gcc/common.opt gcc-4.8.1/gcc/common.opt ---- gcc-4.8.1-vanilla/gcc/common.opt 2013-03-14 10:13:36.000000000 +0100 -+++ gcc-4.8.1/gcc/common.opt 2013-06-27 23:57:54.024096050 +0200 -@@ -2393,6 +2393,9 @@ - nodefaultlibs - Driver - -+nopie -+Driver -+ - nostartfiles - Driver - -diff -Nur gcc-4.8.1-vanilla/gcc/config/arm/arm.h gcc-4.8.1/gcc/config/arm/arm.h ---- gcc-4.8.1-vanilla/gcc/config/arm/arm.h 2013-03-17 17:28:55.000000000 +0100 -+++ gcc-4.8.1/gcc/config/arm/arm.h 2013-06-27 23:57:54.031096224 +0200 -@@ -2328,6 +2328,11 @@ - # define MCPU_MTUNE_NATIVE_SPECS "" - #endif - --#define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS -- -+#ifdef ENABLE_ESP -+# define DRIVER_SELF_SPECS \ -+ MCPU_MTUNE_NATIVE_SPECS, \ -+ ESP_DRIVER_SELF_SPEC -+#else -+# define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS -+#endif - #endif /* ! GCC_ARM_H */ -diff -Nur gcc-4.8.1-vanilla/gcc/config/arm/elf.h gcc-4.8.1/gcc/config/arm/elf.h ---- gcc-4.8.1-vanilla/gcc/config/arm/elf.h 2013-01-10 21:38:27.000000000 +0100 -+++ gcc-4.8.1/gcc/config/arm/elf.h 2013-06-27 23:57:54.031096224 +0200 -@@ -49,7 +49,11 @@ - #endif - - #undef SUBSUBTARGET_EXTRA_SPECS -+#ifdef ENABLE_ESP -+#define SUBSUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS -+#else - #define SUBSUBTARGET_EXTRA_SPECS -+#endif - - #ifndef ASM_SPEC - #define ASM_SPEC "\ -diff -Nur gcc-4.8.1-vanilla/gcc/config/esp.h gcc-4.8.1/gcc/config/esp.h ---- gcc-4.8.1-vanilla/gcc/config/esp.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.8.1/gcc/config/esp.h 2013-06-27 23:57:54.033096274 +0200 -@@ -0,0 +1,127 @@ -+/* License terms see GNU GENERAL PUBLIC LICENSE Version 3. -+ * Version 20130214.1 -+ * Magnus Granberg (Zorry) */ -+#ifndef GCC_ESP_H -+#define GCC_ESP_H -+ -+/* This file will add -fstack-protector-all, -fPIE, -pie and -z now -+ as default if the defines and the spec allow it. -+ Added a hack for gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass -+ to support older hardened GCC patches and we don't need to change the code on gcc-specs-* and _filter-hardened. -+ This will add some unsupported upstream commands options as -nopie and -nonow. -+ -D__KERNEL__ is added so we don't have -fPIE, -pie and -fstack-protector-all when building kernels. -+ ESP_CC1_SPEC is added to CC1_SPEC. -+ ESP_CC1_STRICT_OVERFLOW_SPEC is added so we don't disable the strict-overflow check. -+ ESP_LINK_PIE_CHECK_SPEC check for -pie, -p, -pg, -profile and -static. -+ ENABLE_CRTBEGINP add support for crtbeginP.o, build -static with -fPIE or -fpie. -+*/ -+#ifdef ENABLE_ESP -+ -+ /* Hack to support gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass */ -+ #define ESP_CC1_SPEC " %(esp_cc1_ssp) %(esp_cc1_pie) %(esp_cc1_strict_overflow)" -+ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) -+ #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: }}" -+ #else -+ #define ESP_CC1_SSP_SPEC "" -+ #endif -+ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP ) -+ #define ESP_CC1_PIE_SPEC "%{!nopie: }" -+ #else -+ #define ESP_CC1_PIE_SPEC "" -+ #endif -+ #define ESP_CC1_STRICT_OVERFLOW_SPEC "%{!fstrict-overflow:%{!fno-strict-overflow: -fno-strict-overflow}}" -+ -+ /* ESP_LINK_SPEC is added to LINK_PIE_SPEC if esp is enable -+ -z now will be added if we don't have -vanilla spec. We do a -pie incompatible check -+ Don't remove the specs in the end */ -+ #define ESP_LINK_SPEC "%(esp_link_now) %(esp_link_pie_check) " -+ #define ESP_LINK_NOW_SPEC "%{!nonow:-z now}" -+ -+ /* We use ESP_ESP_DRIVER_SELF_SPEC to add pie and ssp command-line options. */ -+ #define ESP_DRIVER_SELF_SPEC "%{D__KERNEL__:;:%{!nopie:%(esp_options_pie) \ -+ %(esp_link_pie)} %(esp_options_ssp) }" -+ -+ /* This will add -fstack-protector-all if we don't have -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector -+ -fstack-protector-all and we have EFAULT_SSP or EFAULT_PIE_SSP defined. */ -+ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) -+ #define ESP_OPTIONS_SSP_SPEC \ -+ "%{nostdlib|nodefaultlibs|fno-stack-protector| \ -+ fstack-protector|fstack-protector-all:;:-fstack-protector-all}" -+ #else -+ #define ESP_OPTIONS_SSP_SPEC "" -+ #endif -+ -+ /* If EFAULT_PIE or EFAULT_PIE_SSP is defined we will add -fPIE -pie */ -+ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP ) -+ -+ /* This will add -fPIE if we don't have -pie -fpic -fPIC -fpie -fPIE -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static -+ -nostdlib -nostartfiles. */ -+ /* With ENABLE_CRTBEGINP we don't need to check for -static */ -+ #ifdef ENABLE_CRTBEGINP -+ #define ESP_OPTIONS_PIE_SPEC \ -+ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \ -+ %{!shared: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }" -+ #else -+ #define ESP_OPTIONS_PIE_SPEC \ -+ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \ -+ %{!shared: %{!static: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }}" -+ #endif -+ -+ /* This will add -pie if we don't have -pie -A -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static -r -nostdlib -+ -nostartfiles */ -+ /* With ENABLE_CRTBEGINP we don't need to check for -static -+ and we add -pie only to get the start and endfiles. -pie will not go to the linker. */ -+ #ifdef ENABLE_CRTBEGINP -+ #define ESP_LINK_PIE_SPEC \ -+ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!r: \ -+ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}" -+ #else -+ #define ESP_LINK_PIE_SPEC \ -+ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r: \ -+ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}}" -+ #endif -+ -+ /* This will check if -pie is set when (-static) -pg -p -profile. If set it will make gcc print out -+ "-pie and (static)|pg|p|profile are incompatible when linking" */ -+ /* With ENABLE_CRTBEGINP we don't need to check for -static */ -+ #ifdef ENABLE_CRTBEGINP -+ #define ESP_LINK_PIE_CHECK_SPEC \ -+ "%{pie:%{pg|p|profile:%e-pie and -pg|p|profile are incompatible when linking}}" -+ #else -+ #define ESP_LINK_PIE_CHECK_SPEC \ -+ "%{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible when linking}}" -+ #endif -+ -+ /* We don't pass -pie to the linker when -static. */ -+ #ifdef ENABLE_CRTBEGINP -+ #define LINK_PIE_SPEC "%{!static:%{pie:-pie}} %(esp_link)" -+ #else -+ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)" -+ #endif -+ -+ #else -+ #define ESP_OPTIONS_PIE_SPEC "" -+ #define ESP_LINK_PIE_CHECK_SPEC "" -+ #define ESP_LINK_PIE_SPEC "" -+ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)" -+ #endif -+ -+ /* We add extra spec name's to the EXTRA_SPECS list */ -+ #define ESP_EXTRA_SPECS \ -+ { "esp_cc1", ESP_CC1_SPEC }, \ -+ { "esp_cc1_pie", ESP_CC1_PIE_SPEC }, \ -+ { "esp_cc1_ssp", ESP_CC1_SSP_SPEC }, \ -+ { "esp_cc1_strict_overflow", ESP_CC1_STRICT_OVERFLOW_SPEC }, \ -+ { "esp_link", ESP_LINK_SPEC }, \ -+ { "esp_link_now", ESP_LINK_NOW_SPEC }, \ -+ { "esp_link_pie", ESP_LINK_PIE_SPEC }, \ -+ { "esp_link_pie_check", ESP_LINK_PIE_CHECK_SPEC }, \ -+ { "esp_driver_self", ESP_DRIVER_SELF_SPEC }, \ -+ { "esp_options_pie", ESP_OPTIONS_PIE_SPEC }, \ -+ { "esp_options_ssp", ESP_OPTIONS_SSP_SPEC } -+ -+ static const char *esp_driver_self_spec = ESP_DRIVER_SELF_SPEC; -+ static const char *cc1_spec = CC1_SPEC ESP_CC1_SPEC; -+ -+#endif -+#endif /* End GCC_ESP_H */ -diff -Nur gcc-4.8.1-vanilla/gcc/config/gnu-user.h gcc-4.8.1/gcc/config/gnu-user.h ---- gcc-4.8.1-vanilla/gcc/config/gnu-user.h 2013-03-08 18:16:45.000000000 +0100 -+++ gcc-4.8.1/gcc/config/gnu-user.h 2013-06-27 23:57:54.024096050 +0200 -@@ -40,7 +40,11 @@ - provides part of the support for getting C++ file-scope static - object constructed before entering `main'. */ - --#if defined HAVE_LD_PIE -+#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINP) -+#define GNU_USER_TARGET_STARTFILE_SPEC \ -+ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} crti.o%s \ -+ %{static:%{pie:crtbeginP.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}" -+#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINP) - #define GNU_USER_TARGET_STARTFILE_SPEC \ - "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ - crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" -diff -Nur gcc-4.8.1-vanilla/gcc/config/i386/gnu-user-common.h gcc-4.8.1/gcc/config/i386/gnu-user-common.h ---- gcc-4.8.1-vanilla/gcc/config/i386/gnu-user-common.h 2013-01-10 21:38:27.000000000 +0100 -+++ gcc-4.8.1/gcc/config/i386/gnu-user-common.h 2013-06-27 23:57:54.030096199 +0200 -@@ -70,3 +70,7 @@ - - /* Static stack checking is supported by means of probes. */ - #define STACK_CHECK_STATIC_BUILTIN 1 -+ -+#ifdef ENABLE_ESP -+#define DRIVER_SELF_SPECS ESP_DRIVER_SELF_SPEC -+#endif -diff -Nur gcc-4.8.1-vanilla/gcc/config/i386/gnu-user.h gcc-4.8.1/gcc/config/i386/gnu-user.h ---- gcc-4.8.1-vanilla/gcc/config/i386/gnu-user.h 2013-02-08 19:08:12.000000000 +0100 -+++ gcc-4.8.1/gcc/config/i386/gnu-user.h 2013-06-27 23:57:54.030096199 +0200 -@@ -70,9 +70,16 @@ - "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" - - #undef SUBTARGET_EXTRA_SPECS -+#ifdef ENABLE_ESP -+#define SUBTARGET_EXTRA_SPECS \ -+ { "link_emulation", GNU_USER_LINK_EMULATION },\ -+ { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }, \ -+ ESP_EXTRA_SPECS -+#else - #define SUBTARGET_EXTRA_SPECS \ - { "link_emulation", GNU_USER_LINK_EMULATION },\ - { "dynamic_linker", GNU_USER_DYNAMIC_LINKER } -+#endif - - #define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \ - %{!shared: \ -diff -Nur gcc-4.8.1-vanilla/gcc/config/i386/i386.h gcc-4.8.1/gcc/config/i386/i386.h ---- gcc-4.8.1-vanilla/gcc/config/i386/i386.h 2013-01-28 21:42:55.000000000 +0100 -+++ gcc-4.8.1/gcc/config/i386/i386.h 2013-06-27 23:57:54.031096224 +0200 -@@ -643,13 +643,16 @@ - Do not define this macro if it does not need to do anything. */ - - #ifndef SUBTARGET_EXTRA_SPECS -+#ifdef ENABLE_ESP -+#define SUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS -+#else - #define SUBTARGET_EXTRA_SPECS - #endif -+#endif - - #define EXTRA_SPECS \ - { "cc1_cpu", CC1_CPU_SPEC }, \ - SUBTARGET_EXTRA_SPECS -- - - /* Set the value of FLT_EVAL_METHOD in float.h. When using only the - FPU, assume that the fpcw is set to extended precision; when using -diff -Nur gcc-4.8.1-vanilla/gcc/config/ia64/ia64.h gcc-4.8.1/gcc/config/ia64/ia64.h ---- gcc-4.8.1-vanilla/gcc/config/ia64/ia64.h 2013-01-10 21:38:27.000000000 +0100 -+++ gcc-4.8.1/gcc/config/ia64/ia64.h 2013-06-27 23:57:54.033096274 +0200 -@@ -41,8 +41,12 @@ - } while (0) - - #ifndef SUBTARGET_EXTRA_SPECS -+#ifdef ENABLE_ESP -+#define SUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS -+#else - #define SUBTARGET_EXTRA_SPECS - #endif -+#endif - - #define EXTRA_SPECS \ - { "asm_extra", ASM_EXTRA_SPEC }, \ -diff -Nur gcc-4.8.1-vanilla/gcc/config/ia64/linux.h gcc-4.8.1/gcc/config/ia64/linux.h ---- gcc-4.8.1-vanilla/gcc/config/ia64/linux.h 2013-01-10 21:38:27.000000000 +0100 -+++ gcc-4.8.1/gcc/config/ia64/linux.h 2013-06-27 23:57:54.032096249 +0200 -@@ -88,3 +88,7 @@ - - /* Define this to be nonzero if static stack checking is supported. */ - #define STACK_CHECK_STATIC_BUILTIN 1 -+ -+#ifdef ENABLE_ESP -+#define DRIVER_SELF_SPECS ESP_DRIVER_SELF_SPEC -+#endif -diff -Nur gcc-4.8.1-vanilla/gcc/config/mips/gnu-user64.h gcc-4.8.1/gcc/config/mips/gnu-user64.h ---- gcc-4.8.1-vanilla/gcc/config/mips/gnu-user64.h 2013-01-10 21:38:27.000000000 +0100 -+++ gcc-4.8.1/gcc/config/mips/gnu-user64.h 2013-06-27 23:57:54.032096249 +0200 -@@ -26,9 +26,16 @@ - " %{!mabi=*: -" MULTILIB_ABI_DEFAULT "}" - - #undef DRIVER_SELF_SPECS -+#ifdef ENABLE_ESP - #define DRIVER_SELF_SPECS \ - BASE_DRIVER_SELF_SPECS, \ -+ ESP_DRIVER_SELF_SPEC, \ - LINUX64_DRIVER_SELF_SPECS -+# else -+#define DRIVER_SELF_SPECS \ -+ BASE_DRIVER_SELF_SPECS, \ -+ LINUX64_DRIVER_SELF_SPECS -+#endif - - #undef GNU_USER_TARGET_LINK_SPEC - #define GNU_USER_TARGET_LINK_SPEC "\ -diff -Nur gcc-4.8.1-vanilla/gcc/config/mips/gnu-user.h gcc-4.8.1/gcc/config/mips/gnu-user.h ---- gcc-4.8.1-vanilla/gcc/config/mips/gnu-user.h 2013-01-10 21:38:27.000000000 +0100 -+++ gcc-4.8.1/gcc/config/mips/gnu-user.h 2013-06-27 23:57:54.032096249 +0200 -@@ -125,9 +125,16 @@ - "%{mabi=64:%{!msym32:%> tmp-libgcc.mvars - echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars - echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars -+ echo enable_esp = '$(enable_esp)' >> tmp-libgcc.mvars -+ echo enable_crtbeginP = '@enable_crtbeginP@' >> tmp-libgcc.mvars - - mv tmp-libgcc.mvars libgcc.mvars - -diff -Nur gcc-4.8.1-vanilla/gcc/varasm.c gcc-4.8.1/gcc/varasm.c ---- gcc-4.8.1-vanilla/gcc/varasm.c 2013-05-10 03:54:06.000000000 +0200 -+++ gcc-4.8.1/gcc/varasm.c 2013-06-27 23:57:54.023096025 +0200 -@@ -5939,7 +5939,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.8.1-vanilla/libgcc/Makefile.in gcc-4.8.1/libgcc/Makefile.in ---- gcc-4.8.1-vanilla/libgcc/Makefile.in 2013-02-04 20:06:20.000000000 +0100 -+++ gcc-4.8.1/libgcc/Makefile.in 2013-06-27 23:57:54.019095926 +0200 -@@ -220,6 +220,17 @@ - DECNUMINC = - endif - -+ifeq ($(enable_esp),yes) -+ESP_NOPIE_CFLAGS = -fno-PIE -+else -+ESP_NOPIE_CFLAGS= -+endif -+ -+# We add crtbeginP.o to the EXTRA_PARTS list if enable_crtbeginP = yes -+ifeq ($(enable_crtbeginP),yes) -+EXTRA_PARTS += crtbeginP.o -+endif -+ - # Options to use when compiling libgcc2.a. - # - LIBGCC2_DEBUG_CFLAGS = -g -@@ -280,7 +291,7 @@ - CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ - -finhibit-size-directive -fno-inline -fno-exceptions \ - -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \ -- -fno-stack-protector \ -+ -fno-stack-protector $(ESP_NOPIE_CFLAGS) \ - $(INHIBIT_LIBC_CFLAGS) - - # Extra flags to use when compiling crt{begin,end}.o. -@@ -969,6 +980,13 @@ - # This is a version of crtbegin for -static links. - crtbeginT$(objext): $(srcdir)/crtstuff.c - $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O -+ -+# This is a version of crtbegin for -static -fPIE links. -+ifeq ($(enable_crtbeginP),yes) -+crtbeginP$(objext): $(srcdir)/crtstuff.c -+ $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \ -+ -c $< -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O -+endif - endif - - ifeq ($(CUSTOM_CRTIN),) -diff -Nur gcc-4.8.1-vanilla/Makefile.in gcc-4.8.1/Makefile.in ---- gcc-4.8.1-vanilla/Makefile.in 2013-03-30 12:25:03.000000000 +0100 -+++ gcc-4.8.1/Makefile.in 2013-06-27 23:57:54.017095876 +0200 -@@ -360,9 +360,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 - -@@ -408,9 +416,9 @@ - - CFLAGS = @CFLAGS@ - LDFLAGS = @LDFLAGS@ --LIBCFLAGS = $(CFLAGS) -+LIBCFLAGS = $(CFLAGS) $(ESP_NOSSP_CFLAGS) - CXXFLAGS = @CXXFLAGS@ --LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates -+LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates $(ESP_NOSSP_CFLAGS) - GOCFLAGS = $(CFLAGS) - - TFLAGS = diff --git a/gcc/patches/gcc49-aarch64-async-unw-tables.patch0 b/gcc/patches/gcc49-aarch64-async-unw-tables.patch0 new file mode 100644 index 000000000..feec149f3 --- /dev/null +++ b/gcc/patches/gcc49-aarch64-async-unw-tables.patch0 @@ -0,0 +1,35 @@ +2014-04-07 Richard Henderson + + * common/config/aarch64/aarch64-common.c (TARGET_OPTION_INIT_STRUCT): + Define. + (aarch64_option_init_struct): New function. + +--- gcc/common/config/aarch64/aarch64-common.c ++++ gcc/common/config/aarch64/aarch64-common.c +@@ -39,6 +39,9 @@ + #undef TARGET_OPTION_OPTIMIZATION_TABLE + #define TARGET_OPTION_OPTIMIZATION_TABLE aarch_option_optimization_table + ++#undef TARGET_OPTION_INIT_STRUCT ++#define TARGET_OPTION_INIT_STRUCT aarch64_option_init_struct ++ + /* Set default optimization options. */ + static const struct default_options aarch_option_optimization_table[] = + { +@@ -47,6 +50,16 @@ static const struct default_options aarch_option_optimization_table[] = + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + ++/* Implement TARGET_OPTION_INIT_STRUCT. */ ++ ++static void ++aarch64_option_init_struct (struct gcc_options *opts) ++{ ++ /* By default, always emit DWARF-2 unwind info. This allows debugging ++ without maintaining a stack frame back-chain. */ ++ opts->x_flag_asynchronous_unwind_tables = 1; ++} ++ + /* Implement TARGET_HANDLE_OPTION. + This function handles the target specific options for CPU/target selection. + diff --git a/gcc/patches/gcc49-aarch64-unwind-opt.patch0 b/gcc/patches/gcc49-aarch64-unwind-opt.patch0 new file mode 100644 index 000000000..3ad55ab2a --- /dev/null +++ b/gcc/patches/gcc49-aarch64-unwind-opt.patch0 @@ -0,0 +1,338 @@ +2014-08-08 Richard Henderson + + * config/aarch64/aarch64.c (aarch64_save_or_restore_fprs): Add + cfi_ops argument, for restore put REG_CFA_RESTORE notes into + *cfi_ops rather than on individual insns. Cleanup. + (aarch64_save_or_restore_callee_save_registers): Likewise. + (aarch64_expand_prologue): Adjust caller. + (aarch64_expand_epilogue): Likewise. Cleanup. Emit queued cfi_ops + on the stack restore insn. + +--- gcc/config/aarch64/aarch64.c.jj 2014-07-08 17:38:17.398231989 +0200 ++++ gcc/config/aarch64/aarch64.c 2014-08-13 10:02:45.599757706 +0200 +@@ -1810,8 +1810,7 @@ aarch64_register_saved_on_entry (int reg + + static void + aarch64_save_or_restore_fprs (int start_offset, int increment, +- bool restore, rtx base_rtx) +- ++ bool restore, rtx base_rtx, rtx *cfi_ops) + { + unsigned regno; + unsigned regno2; +@@ -1819,16 +1818,16 @@ aarch64_save_or_restore_fprs (int start_ + rtx (*gen_mem_ref)(enum machine_mode, rtx) + = (frame_pointer_needed)? gen_frame_mem : gen_rtx_MEM; + +- + for (regno = V0_REGNUM; regno <= V31_REGNUM; regno++) + { + if (aarch64_register_saved_on_entry (regno)) + { +- rtx mem; ++ rtx mem, reg1; + mem = gen_mem_ref (DFmode, + plus_constant (Pmode, + base_rtx, + start_offset)); ++ reg1 = gen_rtx_REG (DFmode, regno); + + for (regno2 = regno + 1; + regno2 <= V31_REGNUM +@@ -1840,56 +1839,51 @@ aarch64_save_or_restore_fprs (int start_ + if (regno2 <= V31_REGNUM && + aarch64_register_saved_on_entry (regno2)) + { +- rtx mem2; ++ rtx mem2, reg2; + /* Next highest register to be saved. */ + mem2 = gen_mem_ref (DFmode, + plus_constant + (Pmode, + base_rtx, + start_offset + increment)); ++ reg2 = gen_rtx_REG (DFmode, regno2); ++ + if (restore == false) + { +- insn = emit_insn +- ( gen_store_pairdf (mem, gen_rtx_REG (DFmode, regno), +- mem2, gen_rtx_REG (DFmode, regno2))); +- ++ insn = emit_insn (gen_store_pairdf (mem, reg1, mem2, reg2)); ++ /* The first part of a frame-related parallel insn ++ is always assumed to be relevant to the frame ++ calculations; subsequent parts, are only ++ frame-related if explicitly marked. */ ++ RTX_FRAME_RELATED_P (XVECEXP (PATTERN (insn), 0, 1)) = 1; ++ RTX_FRAME_RELATED_P (insn) = 1; + } + else + { +- insn = emit_insn +- ( gen_load_pairdf (gen_rtx_REG (DFmode, regno), mem, +- gen_rtx_REG (DFmode, regno2), mem2)); +- +- add_reg_note (insn, REG_CFA_RESTORE, +- gen_rtx_REG (DFmode, regno)); +- add_reg_note (insn, REG_CFA_RESTORE, +- gen_rtx_REG (DFmode, regno2)); ++ emit_insn (gen_load_pairdf (reg1, mem, reg2, mem2)); ++ *cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg1, *cfi_ops); ++ *cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg2, *cfi_ops); + } + +- /* The first part of a frame-related parallel insn +- is always assumed to be relevant to the frame +- calculations; subsequent parts, are only +- frame-related if explicitly marked. */ +- RTX_FRAME_RELATED_P (XVECEXP (PATTERN (insn), 0, 1)) = 1; + regno = regno2; + start_offset += increment * 2; + } + else + { + if (restore == false) +- insn = emit_move_insn (mem, gen_rtx_REG (DFmode, regno)); ++ { ++ insn = emit_move_insn (mem, reg1); ++ RTX_FRAME_RELATED_P (insn) = 1; ++ } + else + { +- insn = emit_move_insn (gen_rtx_REG (DFmode, regno), mem); +- add_reg_note (insn, REG_CFA_RESTORE, +- gen_rtx_REG (DImode, regno)); ++ emit_move_insn (reg1, mem); ++ *cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg1, *cfi_ops); + } + start_offset += increment; + } +- RTX_FRAME_RELATED_P (insn) = 1; + } + } +- + } + + +@@ -1897,13 +1891,14 @@ aarch64_save_or_restore_fprs (int start_ + restore's have to happen. */ + static void + aarch64_save_or_restore_callee_save_registers (HOST_WIDE_INT offset, +- bool restore) ++ bool restore, rtx *cfi_ops) + { + rtx insn; + rtx base_rtx = stack_pointer_rtx; + HOST_WIDE_INT start_offset = offset; + HOST_WIDE_INT increment = UNITS_PER_WORD; +- rtx (*gen_mem_ref)(enum machine_mode, rtx) = (frame_pointer_needed)? gen_frame_mem : gen_rtx_MEM; ++ rtx (*gen_mem_ref)(enum machine_mode, rtx) ++ = (frame_pointer_needed)? gen_frame_mem : gen_rtx_MEM; + unsigned limit = (frame_pointer_needed)? R28_REGNUM: R30_REGNUM; + unsigned regno; + unsigned regno2; +@@ -1912,11 +1907,13 @@ aarch64_save_or_restore_callee_save_regi + { + if (aarch64_register_saved_on_entry (regno)) + { +- rtx mem; ++ rtx mem, reg1; ++ + mem = gen_mem_ref (Pmode, + plus_constant (Pmode, + base_rtx, + start_offset)); ++ reg1 = gen_rtx_REG (DImode, regno); + + for (regno2 = regno + 1; + regno2 <= limit +@@ -1928,56 +1925,54 @@ aarch64_save_or_restore_callee_save_regi + if (regno2 <= limit && + aarch64_register_saved_on_entry (regno2)) + { +- rtx mem2; ++ rtx mem2, reg2; + /* Next highest register to be saved. */ + mem2 = gen_mem_ref (Pmode, + plus_constant + (Pmode, + base_rtx, + start_offset + increment)); ++ reg2 = gen_rtx_REG (DImode, regno2); ++ + if (restore == false) + { +- insn = emit_insn +- ( gen_store_pairdi (mem, gen_rtx_REG (DImode, regno), +- mem2, gen_rtx_REG (DImode, regno2))); +- ++ insn = emit_insn (gen_store_pairdi (mem, reg1, mem2, reg2)); ++ /* The first part of a frame-related parallel insn ++ is always assumed to be relevant to the frame ++ calculations; subsequent parts, are only ++ frame-related if explicitly marked. */ ++ RTX_FRAME_RELATED_P (XVECEXP (PATTERN (insn), 0, 1)) = 1; ++ RTX_FRAME_RELATED_P (insn) = 1; + } + else + { +- insn = emit_insn +- ( gen_load_pairdi (gen_rtx_REG (DImode, regno), mem, +- gen_rtx_REG (DImode, regno2), mem2)); +- +- add_reg_note (insn, REG_CFA_RESTORE, gen_rtx_REG (DImode, regno)); +- add_reg_note (insn, REG_CFA_RESTORE, gen_rtx_REG (DImode, regno2)); ++ emit_insn (gen_load_pairdi (reg1, mem, reg2, mem2)); ++ *cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg1, *cfi_ops); ++ *cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg2, *cfi_ops); + } + +- /* The first part of a frame-related parallel insn +- is always assumed to be relevant to the frame +- calculations; subsequent parts, are only +- frame-related if explicitly marked. */ +- RTX_FRAME_RELATED_P (XVECEXP (PATTERN (insn), 0, +- 1)) = 1; + regno = regno2; + start_offset += increment * 2; + } + else + { + if (restore == false) +- insn = emit_move_insn (mem, gen_rtx_REG (DImode, regno)); ++ { ++ insn = emit_move_insn (mem, reg1); ++ RTX_FRAME_RELATED_P (insn) = 1; ++ } + else + { +- insn = emit_move_insn (gen_rtx_REG (DImode, regno), mem); +- add_reg_note (insn, REG_CFA_RESTORE, gen_rtx_REG (DImode, regno)); ++ emit_move_insn (reg1, mem); ++ *cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg1, *cfi_ops); + } + start_offset += increment; + } +- RTX_FRAME_RELATED_P (insn) = 1; + } + } + +- aarch64_save_or_restore_fprs (start_offset, increment, restore, base_rtx); +- ++ aarch64_save_or_restore_fprs (start_offset, increment, restore, ++ base_rtx, cfi_ops); + } + + /* AArch64 stack frames generated by this compiler look like: +@@ -2179,7 +2174,7 @@ aarch64_expand_prologue (void) + } + + aarch64_save_or_restore_callee_save_registers +- (fp_offset + cfun->machine->frame.hardfp_offset, 0); ++ (fp_offset + cfun->machine->frame.hardfp_offset, 0, NULL); + } + + /* when offset >= 512, +@@ -2248,15 +2243,18 @@ aarch64_expand_epilogue (bool for_sibcal + insn = emit_insn (gen_add3_insn (stack_pointer_rtx, + hard_frame_pointer_rtx, + GEN_INT (- fp_offset))); ++ /* CFA should be calculated from the value of SP from now on. */ ++ add_reg_note (insn, REG_CFA_ADJUST_CFA, ++ gen_rtx_SET (VOIDmode, stack_pointer_rtx, ++ plus_constant (Pmode, hard_frame_pointer_rtx, ++ -fp_offset))); + RTX_FRAME_RELATED_P (insn) = 1; +- /* As SP is set to (FP - fp_offset), according to the rules in +- dwarf2cfi.c:dwarf2out_frame_debug_expr, CFA should be calculated +- from the value of SP from now on. */ + cfa_reg = stack_pointer_rtx; + } + ++ rtx cfi_ops = NULL; + aarch64_save_or_restore_callee_save_registers +- (fp_offset + cfun->machine->frame.hardfp_offset, 1); ++ (fp_offset + cfun->machine->frame.hardfp_offset, 1, &cfi_ops); + + /* Restore the frame pointer and lr if the frame pointer is needed. */ + if (offset > 0) +@@ -2264,6 +2262,8 @@ aarch64_expand_epilogue (bool for_sibcal + if (frame_pointer_needed) + { + rtx mem_fp, mem_lr; ++ rtx reg_fp = hard_frame_pointer_rtx; ++ rtx reg_lr = gen_rtx_REG (DImode, LR_REGNUM); + + if (fp_offset) + { +@@ -2276,52 +2276,36 @@ aarch64_expand_epilogue (bool for_sibcal + stack_pointer_rtx, + fp_offset + + UNITS_PER_WORD)); +- insn = emit_insn (gen_load_pairdi (hard_frame_pointer_rtx, +- mem_fp, +- gen_rtx_REG (DImode, +- LR_REGNUM), +- mem_lr)); ++ emit_insn (gen_load_pairdi (reg_fp, mem_fp, reg_lr, mem_lr)); ++ ++ insn = emit_insn (gen_add2_insn (stack_pointer_rtx, ++ GEN_INT (offset))); + } + else + { + insn = emit_insn (gen_loadwb_pairdi_di +- (stack_pointer_rtx, +- stack_pointer_rtx, +- hard_frame_pointer_rtx, +- gen_rtx_REG (DImode, LR_REGNUM), +- GEN_INT (offset), ++ (stack_pointer_rtx, stack_pointer_rtx, ++ reg_fp, reg_lr, GEN_INT (offset), + GEN_INT (GET_MODE_SIZE (DImode) + offset))); +- RTX_FRAME_RELATED_P (XVECEXP (PATTERN (insn), 0, 2)) = 1; +- add_reg_note (insn, REG_CFA_ADJUST_CFA, +- (gen_rtx_SET (Pmode, stack_pointer_rtx, +- plus_constant (Pmode, cfa_reg, +- offset)))); +- } +- +- /* The first part of a frame-related parallel insn +- is always assumed to be relevant to the frame +- calculations; subsequent parts, are only +- frame-related if explicitly marked. */ +- RTX_FRAME_RELATED_P (XVECEXP (PATTERN (insn), 0, 1)) = 1; +- RTX_FRAME_RELATED_P (insn) = 1; +- add_reg_note (insn, REG_CFA_RESTORE, hard_frame_pointer_rtx); +- add_reg_note (insn, REG_CFA_RESTORE, +- gen_rtx_REG (DImode, LR_REGNUM)); +- +- if (fp_offset) +- { +- insn = emit_insn (gen_add2_insn (stack_pointer_rtx, +- GEN_INT (offset))); +- RTX_FRAME_RELATED_P (insn) = 1; + } ++ cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg_fp, cfi_ops); ++ cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg_lr, cfi_ops); + } + else + { + insn = emit_insn (gen_add2_insn (stack_pointer_rtx, + GEN_INT (offset))); +- RTX_FRAME_RELATED_P (insn) = 1; + } ++ cfi_ops = alloc_reg_note (REG_CFA_ADJUST_CFA, ++ gen_rtx_SET (VOIDmode, stack_pointer_rtx, ++ plus_constant (Pmode, cfa_reg, ++ offset)), ++ cfi_ops); ++ REG_NOTES (insn) = cfi_ops; ++ RTX_FRAME_RELATED_P (insn) = 1; + } ++ else ++ gcc_assert (cfi_ops == NULL); + + /* Stack adjustment for exception handler. */ + if (crtl->calls_eh_return) diff --git a/gcc/patches/gcc49-cloog-dl.patch0 b/gcc/patches/gcc49-cloog-dl.patch0 new file mode 100644 index 000000000..8a7250926 --- /dev/null +++ b/gcc/patches/gcc49-cloog-dl.patch0 @@ -0,0 +1,476 @@ +--- gcc/Makefile.in.jj 2012-12-13 17:09:20.000000000 +0100 ++++ gcc/Makefile.in 2012-12-14 11:45:22.585670055 +0100 +@@ -1006,7 +1006,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY) + # and the system's installed libraries. + LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \ + $(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS) +-BACKENDLIBS = $(CLOOGLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \ ++BACKENDLIBS = $(if $(CLOOGLIBS),-ldl) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \ + $(ZLIB) + # Any system libraries needed just for GNAT. + SYSLIBS = @GNAT_LIBEXC@ +@@ -2011,6 +2011,15 @@ $(out_object_file): $(out_file) + $(common_out_object_file): $(common_out_file) + $(COMPILE) $< + $(POSTCOMPILE) ++ ++graphite%.o : \ ++ ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS)) ++graphite.o : \ ++ ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS)) ++graphite%.o : \ ++ ALL_CXXFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CXXFLAGS)) ++graphite.o : \ ++ ALL_CXXFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CXXFLAGS)) + # + # Generate header and source files from the machine description, + # and compile them. +--- gcc/graphite-poly.h.jj 2012-12-13 11:31:27.000000000 +0100 ++++ gcc/graphite-poly.h 2012-12-14 13:41:41.970800726 +0100 +@@ -22,6 +22,371 @@ along with GCC; see the file COPYING3. + #ifndef GCC_GRAPHITE_POLY_H + #define GCC_GRAPHITE_POLY_H + ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#define DYNSYMS \ ++ DYNSYM (clast_pprint); \ ++ DYNSYM (cloog_clast_create_from_input); \ ++ DYNSYM (cloog_clast_free); \ ++ DYNSYM (cloog_domain_from_isl_set); \ ++ DYNSYM (cloog_input_alloc); \ ++ DYNSYM (cloog_isl_state_malloc); \ ++ DYNSYM (cloog_options_free); \ ++ DYNSYM (cloog_options_malloc); \ ++ DYNSYM (cloog_scattering_from_isl_map); \ ++ DYNSYM (cloog_state_free); \ ++ DYNSYM (cloog_union_domain_add_domain); \ ++ DYNSYM (cloog_union_domain_alloc); \ ++ DYNSYM (cloog_union_domain_set_name); \ ++ DYNSYM (isl_aff_add_coefficient_si); \ ++ DYNSYM (isl_aff_add_constant); \ ++ DYNSYM (isl_aff_free); \ ++ DYNSYM (isl_aff_get_coefficient); \ ++ DYNSYM (isl_aff_get_space); \ ++ DYNSYM (isl_aff_mod); \ ++ DYNSYM (isl_aff_set_coefficient_si); \ ++ DYNSYM (isl_aff_set_constant_si); \ ++ DYNSYM (isl_aff_zero_on_domain); \ ++ DYNSYM (isl_band_free); \ ++ DYNSYM (isl_band_get_children); \ ++ DYNSYM (isl_band_get_partial_schedule); \ ++ DYNSYM (isl_band_has_children); \ ++ DYNSYM (isl_band_list_free); \ ++ DYNSYM (isl_band_list_get_band); \ ++ DYNSYM (isl_band_list_get_ctx); \ ++ DYNSYM (isl_band_list_n_band); \ ++ DYNSYM (isl_band_member_is_zero_distance); \ ++ DYNSYM (isl_band_n_member); \ ++ DYNSYM (isl_basic_map_add_constraint); \ ++ DYNSYM (isl_basic_map_project_out); \ ++ DYNSYM (isl_basic_map_universe); \ ++ DYNSYM (isl_constraint_set_coefficient); \ ++ DYNSYM (isl_constraint_set_coefficient_si); \ ++ DYNSYM (isl_constraint_set_constant); \ ++ DYNSYM (isl_constraint_set_constant_si); \ ++ DYNSYM (isl_ctx_alloc); \ ++ DYNSYM (isl_ctx_free); \ ++ DYNSYM (isl_equality_alloc); \ ++ DYNSYM (isl_id_alloc); \ ++ DYNSYM (isl_id_copy); \ ++ DYNSYM (isl_id_free); \ ++ DYNSYM (isl_inequality_alloc); \ ++ DYNSYM (isl_local_space_copy); \ ++ DYNSYM (isl_local_space_free); \ ++ DYNSYM (isl_local_space_from_space); \ ++ DYNSYM (isl_local_space_range); \ ++ DYNSYM (isl_map_add_constraint); \ ++ DYNSYM (isl_map_add_dims); \ ++ DYNSYM (isl_map_align_params); \ ++ DYNSYM (isl_map_apply_range); \ ++ DYNSYM (isl_map_copy); \ ++ DYNSYM (isl_map_dim); \ ++ DYNSYM (isl_map_dump); \ ++ DYNSYM (isl_map_equate); \ ++ DYNSYM (isl_map_fix_si); \ ++ DYNSYM (isl_map_flat_product); \ ++ DYNSYM (isl_map_flat_range_product); \ ++ DYNSYM (isl_map_free); \ ++ DYNSYM (isl_map_from_basic_map); \ ++ DYNSYM (isl_map_from_pw_aff); \ ++ DYNSYM (isl_map_from_union_map); \ ++ DYNSYM (isl_map_get_ctx); \ ++ DYNSYM (isl_map_get_space); \ ++ DYNSYM (isl_map_get_tuple_id); \ ++ DYNSYM (isl_map_insert_dims); \ ++ DYNSYM (isl_map_intersect); \ ++ DYNSYM (isl_map_intersect_domain); \ ++ DYNSYM (isl_map_intersect_range); \ ++ DYNSYM (isl_map_is_empty); \ ++ DYNSYM (isl_map_lex_ge); \ ++ DYNSYM (isl_map_lex_le); \ ++ DYNSYM (isl_map_n_out); \ ++ DYNSYM (isl_map_range); \ ++ DYNSYM (isl_map_set_tuple_id); \ ++ DYNSYM (isl_map_universe); \ ++ DYNSYM (isl_options_set_on_error); \ ++ DYNSYM (isl_options_set_schedule_fuse); \ ++ DYNSYM (isl_options_set_schedule_max_constant_term); \ ++ DYNSYM (isl_options_set_schedule_maximize_band_depth); \ ++ DYNSYM (isl_printer_free); \ ++ DYNSYM (isl_printer_print_aff); \ ++ DYNSYM (isl_printer_print_constraint); \ ++ DYNSYM (isl_printer_print_map); \ ++ DYNSYM (isl_printer_print_set); \ ++ DYNSYM (isl_printer_to_file); \ ++ DYNSYM (isl_pw_aff_add); \ ++ DYNSYM (isl_pw_aff_alloc); \ ++ DYNSYM (isl_pw_aff_copy); \ ++ DYNSYM (isl_pw_aff_eq_set); \ ++ DYNSYM (isl_pw_aff_free); \ ++ DYNSYM (isl_pw_aff_from_aff); \ ++ DYNSYM (isl_pw_aff_ge_set); \ ++ DYNSYM (isl_pw_aff_gt_set); \ ++ DYNSYM (isl_pw_aff_is_cst); \ ++ DYNSYM (isl_pw_aff_le_set); \ ++ DYNSYM (isl_pw_aff_lt_set); \ ++ DYNSYM (isl_pw_aff_mod); \ ++ DYNSYM (isl_pw_aff_mul); \ ++ DYNSYM (isl_pw_aff_ne_set); \ ++ DYNSYM (isl_pw_aff_nonneg_set); \ ++ DYNSYM (isl_pw_aff_set_tuple_id); \ ++ DYNSYM (isl_pw_aff_sub); \ ++ DYNSYM (isl_pw_aff_zero_set); \ ++ DYNSYM (isl_schedule_free); \ ++ DYNSYM (isl_schedule_get_band_forest); \ ++ DYNSYM (isl_set_add_constraint); \ ++ DYNSYM (isl_set_add_dims); \ ++ DYNSYM (isl_set_apply); \ ++ DYNSYM (isl_set_coalesce); \ ++ DYNSYM (isl_set_copy); \ ++ DYNSYM (isl_set_dim); \ ++ DYNSYM (isl_set_fix_si); \ ++ DYNSYM (isl_set_free); \ ++ DYNSYM (isl_set_from_cloog_domain); \ ++ DYNSYM (isl_set_get_space); \ ++ DYNSYM (isl_set_get_tuple_id); \ ++ DYNSYM (isl_set_intersect); \ ++ DYNSYM (isl_set_is_empty); \ ++ DYNSYM (isl_set_max); \ ++ DYNSYM (isl_set_min); \ ++ DYNSYM (isl_set_n_dim); \ ++ DYNSYM (isl_set_nat_universe); \ ++ DYNSYM (isl_set_project_out); \ ++ DYNSYM (isl_set_set_tuple_id); \ ++ DYNSYM (isl_set_universe); \ ++ DYNSYM (isl_space_add_dims); \ ++ DYNSYM (isl_space_alloc); \ ++ DYNSYM (isl_space_copy); \ ++ DYNSYM (isl_space_dim); \ ++ DYNSYM (isl_space_domain); \ ++ DYNSYM (isl_space_find_dim_by_id); \ ++ DYNSYM (isl_space_free); \ ++ DYNSYM (isl_space_from_domain); \ ++ DYNSYM (isl_space_get_tuple_id); \ ++ DYNSYM (isl_space_params_alloc); \ ++ DYNSYM (isl_space_range); \ ++ DYNSYM (isl_space_set_alloc); \ ++ DYNSYM (isl_space_set_dim_id); \ ++ DYNSYM (isl_space_set_tuple_id); \ ++ DYNSYM (isl_union_map_add_map); \ ++ DYNSYM (isl_union_map_align_params); \ ++ DYNSYM (isl_union_map_apply_domain); \ ++ DYNSYM (isl_union_map_apply_range); \ ++ DYNSYM (isl_union_map_compute_flow); \ ++ DYNSYM (isl_union_map_copy); \ ++ DYNSYM (isl_union_map_empty); \ ++ DYNSYM (isl_union_map_flat_range_product); \ ++ DYNSYM (isl_union_map_foreach_map); \ ++ DYNSYM (isl_union_map_free); \ ++ DYNSYM (isl_union_map_from_map); \ ++ DYNSYM (isl_union_map_get_ctx); \ ++ DYNSYM (isl_union_map_get_space); \ ++ DYNSYM (isl_union_map_gist_domain); \ ++ DYNSYM (isl_union_map_gist_range); \ ++ DYNSYM (isl_union_map_intersect_domain); \ ++ DYNSYM (isl_union_map_is_empty); \ ++ DYNSYM (isl_union_map_subtract); \ ++ DYNSYM (isl_union_map_union); \ ++ DYNSYM (isl_union_set_add_set); \ ++ DYNSYM (isl_union_set_compute_schedule); \ ++ DYNSYM (isl_union_set_copy); \ ++ DYNSYM (isl_union_set_empty); \ ++ DYNSYM (isl_union_set_from_set); \ ++ DYNSYM (stmt_ass); \ ++ DYNSYM (stmt_block); \ ++ DYNSYM (stmt_for); \ ++ DYNSYM (stmt_guard); \ ++ DYNSYM (stmt_root); \ ++ DYNSYM (stmt_user); ++extern struct cloog_pointers_s__ ++{ ++ bool inited; ++ void *h; ++#define DYNSYM(x) __typeof (x) *p_##x ++ DYNSYMS ++#undef DYNSYM ++} cloog_pointers__; ++ ++#define cloog_block_alloc (*cloog_pointers__.p_cloog_block_alloc) ++#define clast_pprint (*cloog_pointers__.p_clast_pprint) ++#define cloog_clast_create_from_input (*cloog_pointers__.p_cloog_clast_create_from_input) ++#define cloog_clast_free (*cloog_pointers__.p_cloog_clast_free) ++#define cloog_domain_from_isl_set (*cloog_pointers__.p_cloog_domain_from_isl_set) ++#define cloog_input_alloc (*cloog_pointers__.p_cloog_input_alloc) ++#define cloog_isl_state_malloc (*cloog_pointers__.p_cloog_isl_state_malloc) ++#define cloog_options_free (*cloog_pointers__.p_cloog_options_free) ++#define cloog_options_malloc (*cloog_pointers__.p_cloog_options_malloc) ++#define cloog_scattering_from_isl_map (*cloog_pointers__.p_cloog_scattering_from_isl_map) ++#define cloog_state_free (*cloog_pointers__.p_cloog_state_free) ++#define cloog_union_domain_add_domain (*cloog_pointers__.p_cloog_union_domain_add_domain) ++#define cloog_union_domain_alloc (*cloog_pointers__.p_cloog_union_domain_alloc) ++#define cloog_union_domain_set_name (*cloog_pointers__.p_cloog_union_domain_set_name) ++#define isl_aff_add_coefficient_si (*cloog_pointers__.p_isl_aff_add_coefficient_si) ++#define isl_aff_add_constant (*cloog_pointers__.p_isl_aff_add_constant) ++#define isl_aff_free (*cloog_pointers__.p_isl_aff_free) ++#define isl_aff_get_coefficient (*cloog_pointers__.p_isl_aff_get_coefficient) ++#define isl_aff_get_space (*cloog_pointers__.p_isl_aff_get_space) ++#define isl_aff_mod (*cloog_pointers__.p_isl_aff_mod) ++#define isl_aff_set_coefficient_si (*cloog_pointers__.p_isl_aff_set_coefficient_si) ++#define isl_aff_set_constant_si (*cloog_pointers__.p_isl_aff_set_constant_si) ++#define isl_aff_zero_on_domain (*cloog_pointers__.p_isl_aff_zero_on_domain) ++#define isl_band_free (*cloog_pointers__.p_isl_band_free) ++#define isl_band_get_children (*cloog_pointers__.p_isl_band_get_children) ++#define isl_band_get_partial_schedule (*cloog_pointers__.p_isl_band_get_partial_schedule) ++#define isl_band_has_children (*cloog_pointers__.p_isl_band_has_children) ++#define isl_band_list_free (*cloog_pointers__.p_isl_band_list_free) ++#define isl_band_list_get_band (*cloog_pointers__.p_isl_band_list_get_band) ++#define isl_band_list_get_ctx (*cloog_pointers__.p_isl_band_list_get_ctx) ++#define isl_band_list_n_band (*cloog_pointers__.p_isl_band_list_n_band) ++#define isl_band_member_is_zero_distance (*cloog_pointers__.p_isl_band_member_is_zero_distance) ++#define isl_band_n_member (*cloog_pointers__.p_isl_band_n_member) ++#define isl_basic_map_add_constraint (*cloog_pointers__.p_isl_basic_map_add_constraint) ++#define isl_basic_map_project_out (*cloog_pointers__.p_isl_basic_map_project_out) ++#define isl_basic_map_universe (*cloog_pointers__.p_isl_basic_map_universe) ++#define isl_constraint_set_coefficient (*cloog_pointers__.p_isl_constraint_set_coefficient) ++#define isl_constraint_set_coefficient_si (*cloog_pointers__.p_isl_constraint_set_coefficient_si) ++#define isl_constraint_set_constant (*cloog_pointers__.p_isl_constraint_set_constant) ++#define isl_constraint_set_constant_si (*cloog_pointers__.p_isl_constraint_set_constant_si) ++#define isl_ctx_alloc (*cloog_pointers__.p_isl_ctx_alloc) ++#define isl_ctx_free (*cloog_pointers__.p_isl_ctx_free) ++#define isl_equality_alloc (*cloog_pointers__.p_isl_equality_alloc) ++#define isl_id_alloc (*cloog_pointers__.p_isl_id_alloc) ++#define isl_id_copy (*cloog_pointers__.p_isl_id_copy) ++#define isl_id_free (*cloog_pointers__.p_isl_id_free) ++#define isl_inequality_alloc (*cloog_pointers__.p_isl_inequality_alloc) ++#define isl_local_space_copy (*cloog_pointers__.p_isl_local_space_copy) ++#define isl_local_space_free (*cloog_pointers__.p_isl_local_space_free) ++#define isl_local_space_from_space (*cloog_pointers__.p_isl_local_space_from_space) ++#define isl_local_space_range (*cloog_pointers__.p_isl_local_space_range) ++#define isl_map_add_constraint (*cloog_pointers__.p_isl_map_add_constraint) ++#define isl_map_add_dims (*cloog_pointers__.p_isl_map_add_dims) ++#define isl_map_align_params (*cloog_pointers__.p_isl_map_align_params) ++#define isl_map_apply_range (*cloog_pointers__.p_isl_map_apply_range) ++#define isl_map_copy (*cloog_pointers__.p_isl_map_copy) ++#define isl_map_dim (*cloog_pointers__.p_isl_map_dim) ++#define isl_map_dump (*cloog_pointers__.p_isl_map_dump) ++#define isl_map_equate (*cloog_pointers__.p_isl_map_equate) ++#define isl_map_fix_si (*cloog_pointers__.p_isl_map_fix_si) ++#define isl_map_flat_product (*cloog_pointers__.p_isl_map_flat_product) ++#define isl_map_flat_range_product (*cloog_pointers__.p_isl_map_flat_range_product) ++#define isl_map_free (*cloog_pointers__.p_isl_map_free) ++#define isl_map_from_basic_map (*cloog_pointers__.p_isl_map_from_basic_map) ++#define isl_map_from_pw_aff (*cloog_pointers__.p_isl_map_from_pw_aff) ++#define isl_map_from_union_map (*cloog_pointers__.p_isl_map_from_union_map) ++#define isl_map_get_ctx (*cloog_pointers__.p_isl_map_get_ctx) ++#define isl_map_get_space (*cloog_pointers__.p_isl_map_get_space) ++#define isl_map_get_tuple_id (*cloog_pointers__.p_isl_map_get_tuple_id) ++#define isl_map_insert_dims (*cloog_pointers__.p_isl_map_insert_dims) ++#define isl_map_intersect (*cloog_pointers__.p_isl_map_intersect) ++#define isl_map_intersect_domain (*cloog_pointers__.p_isl_map_intersect_domain) ++#define isl_map_intersect_range (*cloog_pointers__.p_isl_map_intersect_range) ++#define isl_map_is_empty (*cloog_pointers__.p_isl_map_is_empty) ++#define isl_map_lex_ge (*cloog_pointers__.p_isl_map_lex_ge) ++#define isl_map_lex_le (*cloog_pointers__.p_isl_map_lex_le) ++#define isl_map_n_out (*cloog_pointers__.p_isl_map_n_out) ++#define isl_map_range (*cloog_pointers__.p_isl_map_range) ++#define isl_map_set_tuple_id (*cloog_pointers__.p_isl_map_set_tuple_id) ++#define isl_map_universe (*cloog_pointers__.p_isl_map_universe) ++#define isl_options_set_on_error (*cloog_pointers__.p_isl_options_set_on_error) ++#define isl_options_set_schedule_fuse (*cloog_pointers__.p_isl_options_set_schedule_fuse) ++#define isl_options_set_schedule_max_constant_term (*cloog_pointers__.p_isl_options_set_schedule_max_constant_term) ++#define isl_options_set_schedule_maximize_band_depth (*cloog_pointers__.p_isl_options_set_schedule_maximize_band_depth) ++#define isl_printer_free (*cloog_pointers__.p_isl_printer_free) ++#define isl_printer_print_aff (*cloog_pointers__.p_isl_printer_print_aff) ++#define isl_printer_print_constraint (*cloog_pointers__.p_isl_printer_print_constraint) ++#define isl_printer_print_map (*cloog_pointers__.p_isl_printer_print_map) ++#define isl_printer_print_set (*cloog_pointers__.p_isl_printer_print_set) ++#define isl_printer_to_file (*cloog_pointers__.p_isl_printer_to_file) ++#define isl_pw_aff_add (*cloog_pointers__.p_isl_pw_aff_add) ++#define isl_pw_aff_alloc (*cloog_pointers__.p_isl_pw_aff_alloc) ++#define isl_pw_aff_copy (*cloog_pointers__.p_isl_pw_aff_copy) ++#define isl_pw_aff_eq_set (*cloog_pointers__.p_isl_pw_aff_eq_set) ++#define isl_pw_aff_free (*cloog_pointers__.p_isl_pw_aff_free) ++#define isl_pw_aff_from_aff (*cloog_pointers__.p_isl_pw_aff_from_aff) ++#define isl_pw_aff_ge_set (*cloog_pointers__.p_isl_pw_aff_ge_set) ++#define isl_pw_aff_gt_set (*cloog_pointers__.p_isl_pw_aff_gt_set) ++#define isl_pw_aff_is_cst (*cloog_pointers__.p_isl_pw_aff_is_cst) ++#define isl_pw_aff_le_set (*cloog_pointers__.p_isl_pw_aff_le_set) ++#define isl_pw_aff_lt_set (*cloog_pointers__.p_isl_pw_aff_lt_set) ++#define isl_pw_aff_mod (*cloog_pointers__.p_isl_pw_aff_mod) ++#define isl_pw_aff_mul (*cloog_pointers__.p_isl_pw_aff_mul) ++#define isl_pw_aff_ne_set (*cloog_pointers__.p_isl_pw_aff_ne_set) ++#define isl_pw_aff_nonneg_set (*cloog_pointers__.p_isl_pw_aff_nonneg_set) ++#define isl_pw_aff_set_tuple_id (*cloog_pointers__.p_isl_pw_aff_set_tuple_id) ++#define isl_pw_aff_sub (*cloog_pointers__.p_isl_pw_aff_sub) ++#define isl_pw_aff_zero_set (*cloog_pointers__.p_isl_pw_aff_zero_set) ++#define isl_schedule_free (*cloog_pointers__.p_isl_schedule_free) ++#define isl_schedule_get_band_forest (*cloog_pointers__.p_isl_schedule_get_band_forest) ++#define isl_set_add_constraint (*cloog_pointers__.p_isl_set_add_constraint) ++#define isl_set_add_dims (*cloog_pointers__.p_isl_set_add_dims) ++#define isl_set_apply (*cloog_pointers__.p_isl_set_apply) ++#define isl_set_coalesce (*cloog_pointers__.p_isl_set_coalesce) ++#define isl_set_copy (*cloog_pointers__.p_isl_set_copy) ++#define isl_set_dim (*cloog_pointers__.p_isl_set_dim) ++#define isl_set_fix_si (*cloog_pointers__.p_isl_set_fix_si) ++#define isl_set_free (*cloog_pointers__.p_isl_set_free) ++#define isl_set_from_cloog_domain (*cloog_pointers__.p_isl_set_from_cloog_domain) ++#define isl_set_get_space (*cloog_pointers__.p_isl_set_get_space) ++#define isl_set_get_tuple_id (*cloog_pointers__.p_isl_set_get_tuple_id) ++#define isl_set_intersect (*cloog_pointers__.p_isl_set_intersect) ++#define isl_set_is_empty (*cloog_pointers__.p_isl_set_is_empty) ++#define isl_set_max (*cloog_pointers__.p_isl_set_max) ++#define isl_set_min (*cloog_pointers__.p_isl_set_min) ++#define isl_set_n_dim (*cloog_pointers__.p_isl_set_n_dim) ++#define isl_set_nat_universe (*cloog_pointers__.p_isl_set_nat_universe) ++#define isl_set_project_out (*cloog_pointers__.p_isl_set_project_out) ++#define isl_set_set_tuple_id (*cloog_pointers__.p_isl_set_set_tuple_id) ++#define isl_set_universe (*cloog_pointers__.p_isl_set_universe) ++#define isl_space_add_dims (*cloog_pointers__.p_isl_space_add_dims) ++#define isl_space_alloc (*cloog_pointers__.p_isl_space_alloc) ++#define isl_space_copy (*cloog_pointers__.p_isl_space_copy) ++#define isl_space_dim (*cloog_pointers__.p_isl_space_dim) ++#define isl_space_domain (*cloog_pointers__.p_isl_space_domain) ++#define isl_space_find_dim_by_id (*cloog_pointers__.p_isl_space_find_dim_by_id) ++#define isl_space_free (*cloog_pointers__.p_isl_space_free) ++#define isl_space_from_domain (*cloog_pointers__.p_isl_space_from_domain) ++#define isl_space_get_tuple_id (*cloog_pointers__.p_isl_space_get_tuple_id) ++#define isl_space_params_alloc (*cloog_pointers__.p_isl_space_params_alloc) ++#define isl_space_range (*cloog_pointers__.p_isl_space_range) ++#define isl_space_set_alloc (*cloog_pointers__.p_isl_space_set_alloc) ++#define isl_space_set_dim_id (*cloog_pointers__.p_isl_space_set_dim_id) ++#define isl_space_set_tuple_id (*cloog_pointers__.p_isl_space_set_tuple_id) ++#define isl_union_map_add_map (*cloog_pointers__.p_isl_union_map_add_map) ++#define isl_union_map_align_params (*cloog_pointers__.p_isl_union_map_align_params) ++#define isl_union_map_apply_domain (*cloog_pointers__.p_isl_union_map_apply_domain) ++#define isl_union_map_apply_range (*cloog_pointers__.p_isl_union_map_apply_range) ++#define isl_union_map_compute_flow (*cloog_pointers__.p_isl_union_map_compute_flow) ++#define isl_union_map_copy (*cloog_pointers__.p_isl_union_map_copy) ++#define isl_union_map_empty (*cloog_pointers__.p_isl_union_map_empty) ++#define isl_union_map_flat_range_product (*cloog_pointers__.p_isl_union_map_flat_range_product) ++#define isl_union_map_foreach_map (*cloog_pointers__.p_isl_union_map_foreach_map) ++#define isl_union_map_free (*cloog_pointers__.p_isl_union_map_free) ++#define isl_union_map_from_map (*cloog_pointers__.p_isl_union_map_from_map) ++#define isl_union_map_get_ctx (*cloog_pointers__.p_isl_union_map_get_ctx) ++#define isl_union_map_get_space (*cloog_pointers__.p_isl_union_map_get_space) ++#define isl_union_map_gist_domain (*cloog_pointers__.p_isl_union_map_gist_domain) ++#define isl_union_map_gist_range (*cloog_pointers__.p_isl_union_map_gist_range) ++#define isl_union_map_intersect_domain (*cloog_pointers__.p_isl_union_map_intersect_domain) ++#define isl_union_map_is_empty (*cloog_pointers__.p_isl_union_map_is_empty) ++#define isl_union_map_subtract (*cloog_pointers__.p_isl_union_map_subtract) ++#define isl_union_map_union (*cloog_pointers__.p_isl_union_map_union) ++#define isl_union_set_add_set (*cloog_pointers__.p_isl_union_set_add_set) ++#define isl_union_set_compute_schedule (*cloog_pointers__.p_isl_union_set_compute_schedule) ++#define isl_union_set_copy (*cloog_pointers__.p_isl_union_set_copy) ++#define isl_union_set_empty (*cloog_pointers__.p_isl_union_set_empty) ++#define isl_union_set_from_set (*cloog_pointers__.p_isl_union_set_from_set) ++#define stmt_ass (*cloog_pointers__.p_stmt_ass) ++#define stmt_block (*cloog_pointers__.p_stmt_block) ++#define stmt_for (*cloog_pointers__.p_stmt_for) ++#define stmt_guard (*cloog_pointers__.p_stmt_guard) ++#define stmt_root (*cloog_pointers__.p_stmt_root) ++#define stmt_user (*cloog_pointers__.p_stmt_user) ++ + typedef struct poly_dr *poly_dr_p; + + typedef struct poly_bb *poly_bb_p; +--- gcc/graphite.c.jj 2012-12-13 11:31:00.000000000 +0100 ++++ gcc/graphite.c 2012-12-14 13:40:44.155136961 +0100 +@@ -78,6 +78,34 @@ along with GCC; see the file COPYING3. + + CloogState *cloog_state; + ++__typeof (cloog_pointers__) cloog_pointers__; ++ ++static bool ++init_cloog_pointers (void) ++{ ++ void *h; ++ ++ if (cloog_pointers__.inited) ++ return cloog_pointers__.h != NULL; ++ h = dlopen ("libcloog-isl.so.4", RTLD_LAZY); ++ cloog_pointers__.h = h; ++ if (h == NULL) ++ return false; ++#define DYNSYM(x) \ ++ do \ ++ { \ ++ union { __typeof (cloog_pointers__.p_##x) p; void *q; } u; \ ++ u.q = dlsym (h, #x); \ ++ if (u.q == NULL) \ ++ return false; \ ++ cloog_pointers__.p_##x = u.p; \ ++ } \ ++ while (0) ++ DYNSYMS ++#undef DYNSYM ++ return true; ++} ++ + /* Print global statistics to FILE. */ + + static void +@@ -277,6 +305,15 @@ graphite_transform_loops (void) + if (parallelized_function_p (cfun->decl)) + return; + ++ if (number_of_loops (cfun) <= 1) ++ return; ++ ++ if (!init_cloog_pointers ()) ++ { ++ sorry ("Graphite loop optimizations cannot be used"); ++ return; ++ } ++ + ctx = isl_ctx_alloc (); + isl_options_set_on_error (ctx, ISL_ON_ERROR_ABORT); + if (!graphite_initialize (ctx)) +--- gcc/graphite-clast-to-gimple.c.jj 2012-12-13 11:31:27.000000000 +0100 ++++ gcc/graphite-clast-to-gimple.c 2012-12-14 13:27:47.196519858 +0100 +@@ -910,7 +910,7 @@ compute_bounds_for_loop (struct clast_fo + from STMT_FOR. */ + + static tree +-type_for_clast_for (struct clast_for *stmt_for, ivs_params_p ip) ++type_for_clast_for (struct clast_for *stmt_fora, ivs_params_p ip) + { + mpz_t bound_one, bound_two; + tree lb_type, ub_type; +@@ -918,8 +918,8 @@ type_for_clast_for (struct clast_for *st + mpz_init (bound_one); + mpz_init (bound_two); + +- lb_type = type_for_clast_expr (stmt_for->LB, ip, bound_one, bound_two); +- ub_type = type_for_clast_expr (stmt_for->UB, ip, bound_one, bound_two); ++ lb_type = type_for_clast_expr (stmt_fora->LB, ip, bound_one, bound_two); ++ ub_type = type_for_clast_expr (stmt_fora->UB, ip, bound_one, bound_two); + + mpz_clear (bound_one); + mpz_clear (bound_two); diff --git a/gcc/patches/gcc49-cloog-dl2.patch0 b/gcc/patches/gcc49-cloog-dl2.patch0 new file mode 100644 index 000000000..2f647a307 --- /dev/null +++ b/gcc/patches/gcc49-cloog-dl2.patch0 @@ -0,0 +1,74 @@ +2011-04-04 Jakub Jelinek + + * toplev.c (toplev_main_argv): New variable. + (toplev_main): Initialize it. + * graphite.c (init_cloog_pointers): Load libcloog-isl.so.4 from gcc's private + directory. + +--- gcc/toplev.c.jj 2008-12-09 23:59:10.000000000 +0100 ++++ gcc/toplev.c 2009-01-27 14:33:52.000000000 +0100 +@@ -107,6 +107,8 @@ static bool no_backend; + /* Length of line when printing switch values. */ + #define MAX_LINE 75 + ++const char **toplev_main_argv; ++ + /* Decoded options, and number of such options. */ + struct cl_decoded_option *save_decoded_options; + unsigned int save_decoded_options_count; +@@ -1909,6 +1911,8 @@ toplev_main (int argc, char **argv) + + expandargv (&argc, &argv); + ++ toplev_main_argv = CONST_CAST2 (const char **, char **, argv); ++ + /* Initialization of GCC's environment, and diagnostics. */ + general_init (argv[0]); + +--- gcc/graphite.c.jj 2010-12-01 10:24:32.000000000 -0500 ++++ gcc/graphite.c 2010-12-01 11:46:07.832118193 -0500 +@@ -72,11 +72,39 @@ __typeof (cloog_pointers__) cloog_pointe + static bool + init_cloog_pointers (void) + { +- void *h; +- +- if (cloog_pointers__.inited) +- return cloog_pointers__.h != NULL; +- h = dlopen ("libcloog-isl.so.4", RTLD_LAZY); ++ void *h = NULL; ++ extern const char **toplev_main_argv; ++ char *buf, *p; ++ size_t len; ++ ++ if (cloog_pointers__.inited) ++ return cloog_pointers__.h != NULL; ++ len = progname - toplev_main_argv[0]; ++ buf = XALLOCAVAR (char, len + sizeof "libcloog-isl.so.4"); ++ memcpy (buf, toplev_main_argv[0], len); ++ strcpy (buf + len, "libcloog-isl.so.4"); ++ len += sizeof "libcloog-isl.so.4"; ++ p = strstr (buf, "/libexec/"); ++ if (p != NULL) ++ { ++ while (1) ++ { ++ char *q = strstr (p + 8, "/libexec/"); ++ if (q == NULL) ++ break; ++ p = q; ++ } ++ memmove (p + 4, p + 8, len - (p + 8 - buf)); ++ h = dlopen (buf, RTLD_LAZY); ++ if (h == NULL) ++ { ++ len = progname - toplev_main_argv[0]; ++ memcpy (buf, toplev_main_argv[0], len); ++ strcpy (buf + len, "libcloog-isl.so.4"); ++ } ++ } ++ if (h == NULL) ++ h = dlopen (buf, RTLD_LAZY); + cloog_pointers__.h = h; + if (h == NULL) + return false; diff --git a/gcc/patches/gcc49-color-auto.patch0 b/gcc/patches/gcc49-color-auto.patch0 new file mode 100644 index 000000000..a8cf938b4 --- /dev/null +++ b/gcc/patches/gcc49-color-auto.patch0 @@ -0,0 +1,46 @@ +2013-09-20 Jakub Jelinek + + * common.opt (-fdiagnostics-color=): Default to auto. + * toplev.c (process_options): Always default to + -fdiagnostics-color=auto if no -f{,no-}diagnostics-color*. + * doc/invoke.texi (-fdiagnostics-color*): Adjust documentation + of the default. + +--- gcc/common.opt.jj 2013-09-18 12:06:53.000000000 +0200 ++++ gcc/common.opt 2013-09-20 10:00:00.935823900 +0200 +@@ -1037,7 +1037,7 @@ Common Alias(fdiagnostics-color=,always, + ; + + fdiagnostics-color= +-Common Joined RejectNegative Var(flag_diagnostics_show_color) Enum(diagnostic_color_rule) Init(DIAGNOSTICS_COLOR_NO) ++Common Joined RejectNegative Var(flag_diagnostics_show_color) Enum(diagnostic_color_rule) Init(DIAGNOSTICS_COLOR_AUTO) + -fdiagnostics-color=[never|always|auto] Colorize diagnostics + + ; Required for these enum values. +--- gcc/toplev.c.jj 2013-09-09 11:32:39.000000000 +0200 ++++ gcc/toplev.c 2013-09-20 10:10:08.198721005 +0200 +@@ -1229,10 +1229,8 @@ process_options (void) + + maximum_field_alignment = initial_max_fld_align * BITS_PER_UNIT; + +- /* Default to -fdiagnostics-color=auto if GCC_COLORS is in the environment, +- otherwise default to -fdiagnostics-color=never. */ +- if (!global_options_set.x_flag_diagnostics_show_color +- && getenv ("GCC_COLORS")) ++ /* Default to -fdiagnostics-color=auto. */ ++ if (!global_options_set.x_flag_diagnostics_show_color) + pp_show_color (global_dc->printer) + = colorize_init (DIAGNOSTICS_COLOR_AUTO); + +--- gcc/doc/invoke.texi.jj 2013-09-18 12:06:50.000000000 +0200 ++++ gcc/doc/invoke.texi 2013-09-20 10:09:29.079904455 +0200 +@@ -3046,8 +3046,7 @@ a message which is too long to fit on a + @cindex highlight, color, colour + @vindex GCC_COLORS @r{environment variable} + Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always}, +-or @samp{auto}. The default is @samp{never} if @env{GCC_COLORS} environment +-variable isn't present in the environment, and @samp{auto} otherwise. ++or @samp{auto}. The default is @samp{auto}. + @samp{auto} means to use color only when the standard error is a terminal. + The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are + aliases for @option{-fdiagnostics-color=always} and diff --git a/gcc/patches/gcc48-i386-libgomp.patch0 b/gcc/patches/gcc49-i386-libgomp.patch0 similarity index 100% rename from gcc/patches/gcc48-i386-libgomp.patch0 rename to gcc/patches/gcc49-i386-libgomp.patch0 diff --git a/gcc/patches/gcc48-libstdc++-docs.patch0 b/gcc/patches/gcc49-libstdc++-docs.patch0 similarity index 96% rename from gcc/patches/gcc48-libstdc++-docs.patch0 rename to gcc/patches/gcc49-libstdc++-docs.patch0 index 019b97467..2c8c2b86c 100644 --- a/gcc/patches/gcc48-libstdc++-docs.patch0 +++ b/gcc/patches/gcc49-libstdc++-docs.patch0 @@ -4,7 +4,7 @@ FSF

-+ Release 4.8.0 ++ Release 4.9.1 +

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation @@ -18,7 +18,7 @@ - The API documentation, rendered into HTML, can be viewed online: + The API documentation, rendered into HTML, can be viewed here: