build_cloog_ppl = 1
name = gcc
-version = 4.7.2
-release = 3
+version = 4.8.1
+release = 1
maintainer = Michael Tremer <michael.tremer@ipfire.org>
groups = Development/Compilers
build
requires
autogen
- binutils>=%{required_binutils_version}
+ binutils >= %{required_binutils_version}
dejagnu
elfutils-devel
expect
# Build libquadmath (only on x86).
build_libquadmath = 0
+ # Build libtasn (only on x86_64).
+ build_libtsan = 0
+
# A couple of configure arguments depending on the architecture and
# configuration.
configure_options =
configure_options = --disable-multilib
build_libquadmath = 1
+ build_libtsan = 1
end
if "%{DISTRO_ARCH}" == "i686"
end
# CFLAGS for hardening.
- HARD_CFLAGS = -DEFAULT_PIE -DEFAULT_SSP -DEFAULT_PIE_SSP -DEFAULT_ESP_SPP \
- -DENABLE_ESP_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW
+ HARD_CFLAGS = -DENABLE_ESP -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW
prepare_cmds
mkdir -v %{DIR_SRC}/gcc-build
# we want to be able to control the pie patch logic via something other
# than ALL_CFLAGS and ALL_CXXFLAGS...
sed -i gcc/Makefile.in \
- -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
+ -e '/^ALL_CFLAGS/iHARD_CFLAGS = %{HARD_CFLAGS}' \
-e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
- -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
+ -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = %{HARD_CFLAGS}' \
-e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |'
- # Enable the GCC hardening by default.
- sed -i gcc/Makefile.in \
- -e "s|^HARD_CFLAGS = |HARD_CFLAGS = %{HARD_CFLAGS} |"
-
- # Compile the compiler with -fPIC as well.
# However, genautomata crashes with a "Bus Error" when compiled
# with PIC.
sed -i gcc/Makefile.in \
- -e "s|^ESP_NOPIE_CFLAGS = .*|ESP_NOPIE_CFLAGS =|" \
-e 's|^build/genautomata$(build_exeext) .*|& -fno-PIC|'
# Default to -gdwarf-4 -fno-debug-types-section rather than -gdwarf-2
-e '/dwarf_record_gcc_switches/s/Init(0)/Init(1)/' \
-e 's/\(may be either 2, 3 or 4; the default version is \)2\./\14./'
- ./contrib/gcc_update --touch
+ #./contrib/gcc_update --touch
end
build
--prefix=/usr \
--libdir=%{libdir} \
--libexecdir=%{libdir} \
- --mandir=/usr/share/man \
+ --mandir=%{mandir} \
--enable-esp \
--enable-shared \
--enable-threads=posix \
--enable-languages=c,c++,lto \
--enable-bootstrap \
--enable-checking=release \
- --disable-build-with-cxx \
- --disable-build-poststage1-with-cxx \
--disable-werror \
--disable-libssp \
--disable-static \
--enable-gnu-unique-object \
--enable-linker-build-id \
--with-linker-hash-style=gnu \
+ --enable-plugin \
+ --enable-initfini-array \
%{configure_options}
# GCC does not support a parallel build.
chmod 755 %{BUILDROOT}%{libdir}/libgomp.so.1.*
# libstdc++
- ln -svf ../../../libstdc++.so.6.0.17 ${FULLPATH}/libstdc++.so
+ ln -svf ../../../libstdc++.so.6.0.18 ${FULLPATH}/libstdc++.so
# libmudflap
ln -svf ../../../libmudflap.so.0.0.0 ${FULLPATH}/libmudflap.so
end
end
+ package libatomic
+ summary = The GNU Atomic library
+ description
+ This package contains the GNU Atomic library which is a
+ GCC support runtime library for atomisc operations not
+ supported by hardware.
+ end
+
+ files
+ %{libdir}/libatomic.so.1*
+ end
+ end
+
+ package libasan
+ summary = The Address Sanitizer runtime library
+ description
+ This package contains the Address Sanitizer library
+ which is used for -fsanitize=address instrumented programs.
+ end
+
+ files
+ %{libdir}/libasan.so.0*
+ end
+ end
+
+ if "%{build_libtsan}" == "1"
+ package libtsan
+ summary = The Thread Sanitizer runtime library
+ description
+ This package contains the Thread Sanitizer library
+ which is used for -fsanitize=thread instrumented programs.
+ end
+
+ files
+ %{libdir}/libtsan.so.0*
+ end
+ end
+ end
+
package gcc-plugin-devel
summary = Support for compiling GCC plugins.
description
+++ /dev/null
-2012-05-01 Richard Earnshaw <rearnsha@arm.com>
-
- * arm/linux-eabi.h (GLIBC_DYNAMIC_LINKER_DEFAULT): Avoid ifdef
- comparing enumeration values. Update comments.
-
-2012-04-26 Michael Hope <michael.hope@linaro.org>
- Richard Earnshaw <rearnsha@arm.com>
-
- * config/arm/linux-eabi.h (GLIBC_DYNAMIC_LINKER_SOFT_FLOAT): Define.
- (GLIBC_DYNAMIC_LINKER_HARD_FLOAT): Define.
- (GLIBC_DYNAMIC_LINKER_DEFAULT): Define.
- (GLIBC_DYNAMIC_LINKER): Redefine to use the hard float path.
-
---- gcc/config/arm/linux-eabi.h (revision 186858)
-+++ gcc/config/arm/linux-eabi.h (revision 187012)
-@@ -32,7 +32,8 @@
- while (false)
-
- /* We default to a soft-float ABI so that binaries can run on all
-- target hardware. */
-+ target hardware. If you override this to use the hard-float ABI then
-+ change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well. */
- #undef TARGET_DEFAULT_FLOAT_ABI
- #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
-
-@@ -59,10 +60,23 @@
- #undef SUBTARGET_EXTRA_LINK_SPEC
- #define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION
-
--/* Use ld-linux.so.3 so that it will be possible to run "classic"
-- GNU/Linux binaries on an EABI system. */
-+/* GNU/Linux on ARM currently supports three dynamic linkers:
-+ - ld-linux.so.2 - for the legacy ABI
-+ - ld-linux.so.3 - for the EABI-derived soft-float ABI
-+ - ld-linux-armhf.so.3 - for the EABI-derived hard-float ABI.
-+ All the dynamic linkers live in /lib.
-+ We default to soft-float, but this can be overridden by changing both
-+ GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
-+
- #undef GLIBC_DYNAMIC_LINKER
--#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
-+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
-+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
-+#define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
-+
-+#define GLIBC_DYNAMIC_LINKER \
-+ "%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
-+ %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
-+ %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
-
- /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
- use the GNU/Linux version, not the generic BPABI version. */
+++ /dev/null
-diff -Nur gcc-4.7.0-vanilla/configure gcc-4.7.0/configure
---- gcc-4.7.0-vanilla/configure 2012-02-02 11:20:32.000000000 +0100
-+++ gcc-4.7.0/configure 2012-05-18 10:53:11.645610347 +0200
-@@ -671,6 +671,7 @@
- CFLAGS
- CC
- EXTRA_CONFIGARGS_LIBJAVA
-+enable_esp
- target_subdir
- host_subdir
- build_subdir
-@@ -749,6 +750,7 @@
- enable_libquadmath
- enable_libquadmath_support
- enable_libada
-+enable_esp
- enable_libssp
- enable_static_libjava
- enable_bootstrap
-@@ -1467,6 +1469,11 @@
- --disable-libquadmath-support
- disable libquadmath support for Fortran
- --enable-libada build libada directory
-+ --enable-esp Enable Stack protector, Position independent
-+ executable as default if we have suppot for it when
-+ compiling and link with -z relro and -z now as
-+ default. Linux targets supported i*86, x86_64,
-+ x86_x32, powerpc, powerpc64, ia64 and arm.
- --enable-libssp build libssp directory
- --enable-static-libjava[=ARG]
- build static libjava [default=no]
-@@ -2985,6 +2992,24 @@
- noconfigdirs="$noconfigdirs gnattools"
- fi
-
-+# Check whether --enable-esp was given and target have the support.
-+# Check whether --enable-esp was given.
-+if test "${enable_esp+set}" = set; then :
-+ enableval=$enable_esp;
-+ case $target in
-+ i?86*-*-linux* | x86_??*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*)
-+ enable_esp=yes
-+ ;;
-+ *)
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** --enable-esp is not supported on this $target target." >&5
-+$as_echo "$as_me: WARNING: *** --enable-esp is not supported on this $target target." >&2;}
-+ ;;
-+ esac
-+
-+fi
-+
-+
-+
- # Check whether --enable-libssp was given.
- if test "${enable_libssp+set}" = set; then :
- enableval=$enable_libssp; ENABLE_LIBSSP=$enableval
-@@ -14422,6 +14447,11 @@
- CFLAGS="$saved_CFLAGS"
- fi
-
-+# Disable -fstack-protector on stage1
-+if test x$enable_esp = xyes; then
-+ stage1_cflags="$stage1_cflags -fno-stack-protector"
-+fi
-+
-
-
- # Enable --enable-checking in stage1 of the compiler.
-diff -Nur gcc-4.7.0-vanilla/gcc/esp.h gcc-4.7.0/gcc/esp.h
---- gcc-4.7.0-vanilla/gcc/esp.h 1970-01-01 01:00:00.000000000 +0100
-+++ gcc-4.7.0/gcc/esp.h 2012-05-18 10:54:28.787077373 +0200
-@@ -0,0 +1,145 @@
-+/* License terms see GNU GENERAL PUBLIC LICENSE Version 3.
-+ * Version 20120403.2
-+ * Magnus Granberg (Zorry) <zorry@gentoo.org> */
-+#ifndef GCC_ESP_H
-+#define GCC_ESP_H
-+
-+/* This file will add -fstack-protector-all, -fPIE, -pie and -z now
-+ as default if the defines and the spec allow it.
-+ Added a hack for gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass
-+ to support older hardened GCC patches and we don't need to change the code on gcc-specs-* and _filter-hardened.
-+ This will add some unsupported upstream commands options as -nopie and -nonow.
-+ -D__KERNEL__ is added so we don't have -fPIE, -pie and -fstack-protector-all when building kernels.
-+ ESP_CC1_SPEC is added to CC1_SPEC.
-+ ESP_CC1_STRICT_OVERFLOW_SPEC is added so we don't disable the strict-overflow check.
-+ ESP_LINK_PIE_CHECK_SPEC check for -pie, -p, -pg, -profile and -static.
-+ ENABLE_CRTBEGINP add support for crtbeginP.o, build -static with -fPIE or -fpie.
-+*/
-+#ifdef ENABLE_ESP
-+
-+ /* Hack to support gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass */
-+ #define ESP_CC1_SPEC " %(esp_cc1_ssp) %(esp_cc1_pie) %(esp_cc1_strict_overflow)"
-+ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP )
-+ #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: }}"
-+ #else
-+ #define ESP_CC1_SSP_SPEC ""
-+ #endif
-+ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP )
-+ #define ESP_CC1_PIE_SPEC "%{!nopie: }"
-+ #else
-+ #define ESP_CC1_PIE_SPEC ""
-+ #endif
-+ #define ESP_CC1_STRICT_OVERFLOW_SPEC "%{!fstrict-overflow:%{!fno-strict-overflow: -fno-strict-overflow}}"
-+
-+ /* ESP_LINK_SPEC is added to LINK_PIE_SPEC if esp is enable
-+ -z now will be added if we don't have -vanilla spec. We do a -pie incompatible check
-+ Don't remove the specs in the end */
-+ #define ESP_LINK_SPEC "%(esp_link_now) %(esp_link_pie_check) "
-+ #define ESP_LINK_NOW_SPEC "%{!nonow:-z now}"
-+
-+ /* We use ESP_COMMAND_OPTIONS_SPEC to add pie command-line options. */
-+ #define ESP_COMMAND_OPTIONS_SPEC "%{!D__KERNEL__:%{!nopie:%(esp_options_pie) %(esp_link_pie)}}"
-+
-+ /* ESP_OPTIONS_SPEC is added to the compiler spec in gcc/gcc.c */
-+ #define ESP_OPTIONS_SPEC "%(esp_options_ssp)"
-+
-+ /* ESP_CPP_OPTIONS_SPEC is added to the cpp_options spec in gcc/gcc.c
-+ For precompiling headers. */
-+ #define ESP_CPP_OPTIONS_SPEC "%(esp_options_ssp)"
-+
-+ /* This will add -fstack-protector-all if we don't have -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector
-+ -fstack-protector-all and we have EFAULT_SSP or EFAULT_PIE_SSP defined. */
-+ #if ( defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) ) && defined ( ENABLE_ESP_SSP )
-+ #define ESP_OPTIONS_SSP_SPEC \
-+ "%{!D__KERNEL__:%{!nostdlib:%{!nodefaultlibs: %{!fno-stack-protector: \
-+ %{!fstack-protector:%{!fstack-protector-all:-fstack-protector-all}}}}}}"
-+ #else
-+ #define ESP_OPTIONS_SSP_SPEC ""
-+ #endif
-+
-+ /* If EFAULT_PIE or EFAULT_PIE_SSP is defined we will add -fPIE -pie */
-+ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP )
-+
-+ /* This will add -fPIE if we don't have -pie -fpic -fPIC -fpie -fPIE -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static
-+ -nostdlib -nostartfiles. */
-+ /* With ENABLE_CRTBEGINP we don't need to check for -static */
-+ #ifdef ENABLE_CRTBEGINP
-+ #define ESP_OPTIONS_PIE_SPEC \
-+ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \
-+ %{!shared: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }"
-+ #else
-+ #define ESP_OPTIONS_PIE_SPEC \
-+ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \
-+ %{!shared: %{!static: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }}"
-+ #endif
-+
-+ /* This will add -pie if we don't have -pie -A -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static -r -nostdlib
-+ -nostartfiles */
-+ /* With ENABLE_CRTBEGINP we don't need to check for -static
-+ and we add -pie only to get the start and endfiles. -pie will not go to the linker. */
-+ #ifdef ENABLE_CRTBEGINP
-+ #define ESP_LINK_PIE_SPEC \
-+ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!r: \
-+ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}"
-+ #else
-+ #define ESP_LINK_PIE_SPEC \
-+ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r: \
-+ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}}"
-+ #endif
-+
-+ /* This will check if -pie is set when (-static) -pg -p -profile. If set it will make gcc print out
-+ "-pie and (static)|pg|p|profile are incompatible when linking" */
-+ /* With ENABLE_CRTBEGINP we don't need to check for -static */
-+ #ifdef ENABLE_CRTBEGINP
-+ #define ESP_LINK_PIE_CHECK_SPEC \
-+ "%{pie:%{pg|p|profile:%e-pie and -pg|p|profile are incompatible when linking}}"
-+ #else
-+ #define ESP_LINK_PIE_CHECK_SPEC \
-+ "%{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible when linking}}"
-+ #endif
-+
-+ /* We don't pass -pie to the linker when -static. */
-+ #ifdef ENABLE_CRTBEGINP
-+ #define LINK_PIE_SPEC "%{!static:%{pie:-pie}} %(esp_link)"
-+ #else
-+ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)"
-+ #endif
-+
-+ #else
-+ #define ESP_OPTIONS_PIE_SPEC ""
-+ #define ESP_LINK_PIE_CHECK_SPEC ""
-+ #define ESP_LINK_PIE_SPEC ""
-+ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)"
-+ #endif
-+
-+ /* We add extra spec name's to the EXTRA_SPECS list */
-+ #define ESP_EXTRA_SPECS \
-+ { "esp_cc1", ESP_CC1_SPEC }, \
-+ { "esp_cc1_pie", ESP_CC1_PIE_SPEC }, \
-+ { "esp_cc1_ssp", ESP_CC1_SSP_SPEC }, \
-+ { "esp_cc1_strict_overflow", ESP_CC1_STRICT_OVERFLOW_SPEC }, \
-+ { "esp_link", ESP_LINK_SPEC }, \
-+ { "esp_link_now", ESP_LINK_NOW_SPEC }, \
-+ { "esp_link_pie", ESP_LINK_PIE_SPEC }, \
-+ { "esp_link_pie_check", ESP_LINK_PIE_CHECK_SPEC }, \
-+ { "esp_command_options", ESP_COMMAND_OPTIONS_SPEC }, \
-+ { "esp_cpp_options", ESP_CPP_OPTIONS_SPEC }, \
-+ { "esp_options", ESP_OPTIONS_SPEC }, \
-+ { "esp_options_pie", ESP_OPTIONS_PIE_SPEC }, \
-+ { "esp_options_ssp", ESP_OPTIONS_SSP_SPEC }
-+
-+ static const char *esp_command_options_spec = ESP_COMMAND_OPTIONS_SPEC;
-+ static const char *cc1_spec = CC1_SPEC ESP_CC1_SPEC;
-+
-+#else /* If not ESP_ENABLE defined do this. */
-+
-+ #define ESP_OPTIONS_SPEC ""
-+ #define ESP_CPP_OPTIONS_SPEC ""
-+
-+ /* We add extra spec name's to the EXTRA_SPECS list */
-+ #define ESP_EXTRA_SPECS \
-+ { "esp_options", ESP_OPTIONS_SPEC }, \
-+ { "esp_cpp_options", ESP_CPP_OPTIONS_SPEC }
-+
-+#endif
-+#endif /* End GCC_ESP_H */
-diff -Nur gcc-4.7.0-vanilla/gcc/common.opt gcc-4.7.0/gcc/common.opt
---- gcc-4.7.0-vanilla/gcc/common.opt 2012-02-01 10:20:32.000000000 +0100
-+++ gcc-4.7.0/gcc/common.opt 2012-05-18 10:56:19.708624714 +0200
-@@ -2268,6 +2268,9 @@
- nodefaultlibs
- Driver
-
-+nopie
-+Driver
-+
- nostartfiles
- Driver
-
-diff -Nur gcc-4.7.0-vanilla/gcc/config/gnu-user.h gcc-4.7.0/gcc/config/gnu-user.h
---- gcc-4.7.0-vanilla/gcc/config/gnu-user.h 2011-04-28 18:49:49.000000000 +0200
-+++ gcc-4.7.0/gcc/config/gnu-user.h 2012-05-18 10:56:49.987593058 +0200
-@@ -41,7 +41,11 @@
- provides part of the support for getting C++ file-scope static
- object constructed before entering `main'. */
-
--#if defined HAVE_LD_PIE
-+#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINP)
-+#define GNU_USER_TARGET_STARTFILE_SPEC \
-+ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} crti.o%s \
-+ %{static:%{pie:crtbeginP.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}"
-+#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINP)
- #define GNU_USER_TARGET_STARTFILE_SPEC \
- "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
-diff -Nur gcc-4.7.0-vanilla/gcc/config/rs6000/linux64.h gcc-4.7.0/gcc/config/rs6000/linux64.h
---- gcc-4.7.0-vanilla/gcc/config/rs6000/linux64.h 2012-03-12 17:16:51.000000000 +0100
-+++ gcc-4.7.0/gcc/config/rs6000/linux64.h 2012-05-18 10:57:30.248880643 +0200
-@@ -180,7 +180,7 @@
- #endif
-
- #define ASM_SPEC32 "-a32 \
--%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
-+%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} \
- %{memb} %{!memb: %{msdata=eabi: -memb}} \
- %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
- %{mcall-freebsd: -mbig} \
-diff -Nur gcc-4.7.0-vanilla/gcc/config/rs6000/sysv4.h gcc-4.7.0/gcc/config/rs6000/sysv4.h
---- gcc-4.7.0-vanilla/gcc/config/rs6000/sysv4.h 2011-04-11 20:46:05.000000000 +0200
-+++ gcc-4.7.0/gcc/config/rs6000/sysv4.h 2012-05-18 10:56:49.988593089 +0200
-@@ -785,7 +785,12 @@
- %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
- %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
-
--#ifdef HAVE_LD_PIE
-+#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINP)
-+#define STARTFILE_LINUX_SPEC "\
-+%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
-+%{mnewlib:ecrti.o%s;:crti.o%s} \
-+%{static:%{pie:crtbeginP.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}"
-+#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINP)
- #define STARTFILE_LINUX_SPEC "\
- %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
- %{mnewlib:ecrti.o%s;:crti.o%s} \
-diff -Nur gcc-4.7.0-vanilla/gcc/config.in gcc-4.7.0/gcc/config.in
---- gcc-4.7.0-vanilla/gcc/config.in 2012-03-22 08:37:39.000000000 +0100
-+++ gcc-4.7.0/gcc/config.in 2012-05-18 10:53:34.954355771 +0200
-@@ -58,6 +58,12 @@
- #endif
-
-
-+/* Define to 1 to enable crtbeginP.o. */
-+#ifndef USED_FOR_TARGET
-+#undef ENABLE_CRTBEGINP
-+#endif
-+
-+
- /* Define to 1 to specify that we are using the BID decimal floating point
- format instead of DPD */
- #ifndef USED_FOR_TARGET
-@@ -77,6 +83,18 @@
- #endif
-
-
-+/* Define to 1 to enable esp. */
-+#ifndef USED_FOR_TARGET
-+#undef ENABLE_ESP
-+#endif
-+
-+
-+/* Define to 1 to enable esp. */
-+#ifndef USED_FOR_TARGET
-+#undef ENABLE_ESP_SSP
-+#endif
-+
-+
- /* Define to 1 to enable fixed-point arithmetic extension to C. */
- #ifndef USED_FOR_TARGET
- #undef ENABLE_FIXED_POINT
-diff -Nur gcc-4.7.0-vanilla/gcc/configure gcc-4.7.0/gcc/configure
---- gcc-4.7.0-vanilla/gcc/configure 2012-03-08 14:54:54.000000000 +0100
-+++ gcc-4.7.0/gcc/configure 2012-05-18 10:53:11.651610539 +0200
-@@ -600,6 +600,8 @@
-
- ac_subst_vars='LTLIBOBJS
- LIBOBJS
-+enable_esp
-+enable_crtbeginP
- enable_plugin
- pluginlibs
- CLOOGINC
-@@ -917,6 +919,7 @@
- enable_plugin
- enable_libquadmath_support
- with_linker_hash_style
-+enable_esp
- '
- ac_precious_vars='build_alias
- host_alias
-@@ -1630,6 +1633,11 @@
- --enable-plugin enable plugin support
- --disable-libquadmath-support
- disable libquadmath support for Fortran
-+ --enable-esp Enable Stack protector, Position independent
-+ executable and Fortify_sources as default if we have
-+ suppot for it when compiling and link -z now as
-+ default. Linux targets supported i*86, x86_64,
-+ x86_x32, powerpc, powerpc64, ia64, mips and arm
-
- Optional Packages:
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
-@@ -27404,6 +27412,113 @@
-
- fi
-
-+# --------------
-+# Esp checks
-+# --------------
-+
-+# Check whether --enable-esp was given and target have the support.
-+# Check whether --enable-esp was given.
-+if test "${enable_esp+set}" = set; then :
-+ enableval=$enable_esp; set_enable_esp=$enableval
-+else
-+ set_enable_esp=no
-+fi
-+
-+if test $set_enable_esp = yes ; then
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $target support esp" >&5
-+$as_echo_n "checking if $target support esp... " >&6; }
-+if test $set_enable_esp = yes ; then
-+ case "$target" in
-+ i?86*-*-linux* | x86_??*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux* | mips*-*-linux*)
-+ enable_esp=yes
-+
-+$as_echo "#define ENABLE_ESP 1" >>confdefs.h
-+
-+ ;;
-+ *)
-+ enable_esp=no
-+ ;;
-+ esac
-+else
-+ enable_esp=no
-+fi
-+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_esp" >&5
-+$as_echo "$enable_esp" >&6; }
-+fi
-+
-+if test $enable_esp = yes ; then
-+
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can default to use -fstack-protector" >&5
-+$as_echo_n "checking if we can default to use -fstack-protector... " >&6; }
-+ ssp_link_test=no
-+ if test x$gcc_cv_libc_provides_ssp = xyes && test x$set_have_as_tls = xyes; then
-+ if $EGREP '^ *#[ ]*define[ ]+__UCLIBC__[ ]+1' \
-+ $target_header_dir/features.h > /dev/null; then
-+ if test -f $target_header_dir/bits/uClibc_config.h && \
-+ $EGREP '^ *#[ ]*define[ ]+__UCLIBC_SUBLEVEL__[ ]+([3-9][2-9]|[4-9][0-9])' \
-+ $target_header_dir/bits/uClibc_config.h > /dev/null && \
-+ $EGREP '^ *#[ ]*define[ ]+__UCLIBC_HAS_TLS__[ ]+1' \
-+ $target_header_dir/bits/uClibc_config.h > /dev/null; then
-+ ssp_link_test=yes
-+ fi
-+ else
-+ ssp_link_test=yes
-+ fi
-+ fi
-+ if test x$ssp_link_test=xyes ; then
-+ saved_CFLAGS="$CFLAGS"
-+ CFLAGS="$CFLAGS -O2 -fstack-protector -Werror"
-+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+
-+int
-+main ()
-+{
-+
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+if ac_fn_c_try_link "$LINENO"; then :
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-+$as_echo "yes" >&6; }; enable_esp_ssp=yes
-+else
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-+$as_echo "no" >&6; }; enable_esp_ssp=no
-+fi
-+rm -f core conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+ CFLAGS="$saved_CFLAGS"
-+ else
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-+$as_echo "no" >&6; }
-+ enable_esp_ssp=no
-+ fi
-+ if test $enable_esp_ssp = yes ; then
-+
-+$as_echo "#define ENABLE_ESP_SSP 1" >>confdefs.h
-+
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking checking for crtbeginP.o support" >&5
-+$as_echo_n "checking checking for crtbeginP.o support... " >&6; }
-+ case "$target" in
-+ ia64*-*-linux*)
-+ enable_crtbeginP=no ;;
-+ *-*-linux*)
-+ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then
-+ enable_crtbeginP=yes
-+
-+$as_echo "#define ENABLE_CRTBEGINP 1" >>confdefs.h
-+
-+ fi
-+ ;;
-+ *) enable_crtbeginP=no ;;
-+ esac
-+ fi
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_crtbeginP" >&5
-+$as_echo "$enable_crtbeginP" >&6; }
-+
-+fi
-+
- # Configure the subdirectories
- # AC_CONFIG_SUBDIRS($subdirs)
-
-diff -Nur gcc-4.7.0-vanilla/gcc/cp/lang-specs.h gcc-4.7.0/gcc/cp/lang-specs.h
---- gcc-4.7.0-vanilla/gcc/cp/lang-specs.h 2011-03-06 17:27:57.000000000 +0100
-+++ gcc-4.7.0/gcc/cp/lang-specs.h 2012-05-18 10:54:40.279444906 +0200
-@@ -47,7 +47,7 @@
- %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
- cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
- %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
-- %(cc1_options) %2\
-+ %(cc1_options) %(esp_options) %2\
- %{!fsyntax-only:%{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}}%V}}}}",
- CPLUSPLUS_CPP_SPEC, 0, 0},
-@@ -58,7 +58,7 @@
- %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
- cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
- %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
-- %(cc1_options) %2\
-+ %(cc1_options) %(esp_options) %2\
- %{!fsyntax-only:%(invoke_as)}}}}",
- CPLUSPLUS_CPP_SPEC, 0, 0},
- {".ii", "@c++-cpp-output", 0, 0, 0},
-diff -Nur gcc-4.7.0-vanilla/gcc/doc/invoke.texi gcc-4.7.0/gcc/doc/invoke.texi
---- gcc-4.7.0-vanilla/gcc/doc/invoke.texi 2012-03-14 00:18:07.000000000 +0100
-+++ gcc-4.7.0/gcc/doc/invoke.texi 2012-05-18 10:56:59.156886298 +0200
-@@ -8479,6 +8479,11 @@
- @opindex fstack-protector-all
- Like @option{-fstack-protector} except that all functions are protected.
-
-+NOTE: When --enable-esp this option is enabled by default
-+for C, C++, ObjC, ObjC++, if neither @option{-fno-stack-protector}
-+or @option{-nostdlib} or @option{-nodefaultlibs} or
-+@option{-fstack-protector} are found.
-+
- @item -fsection-anchors
- @opindex fsection-anchors
- Try to reduce the number of symbolic address calculations by using
-@@ -9457,6 +9462,12 @@
- that were used to generate code (@option{-fpie}, @option{-fPIE},
- or model suboptions) when you specify this option.
-
-+NOTE: When --enable-esp this option is enabled by default
-+for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE}
-+or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or
-+@option{-nostartfiles} or @option{-shared} or @option{-pg} or @option{-p}
-+are found.
-+
- @item -rdynamic
- @opindex rdynamic
- Pass the flag @option{-export-dynamic} to the ELF linker, on targets
-@@ -19125,6 +19136,11 @@
- @code{__pie__} and @code{__PIE__}. The macros have the value 1
- for @option{-fpie} and 2 for @option{-fPIE}.
-
-+NOTE: When --enable-esp this option is enabled by default
-+for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE}
-+or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or
-+@option{-nostartfiles} or @option{-shared} are found.
-+
- @item -fno-jump-tables
- @opindex fno-jump-tables
- Do not use jump tables for switch statements even where it would be
-diff -Nur gcc-4.7.0-vanilla/gcc/gcc.c gcc-4.7.0/gcc/gcc.c
---- gcc-4.7.0-vanilla/gcc/gcc.c 2012-02-28 18:31:38.000000000 +0100
-+++ gcc-4.7.0/gcc/gcc.c 2012-05-18 10:54:40.279444906 +0200
-@@ -45,6 +45,7 @@
- #include "opts.h"
- #include "params.h"
- #include "vec.h"
-+#include "esp.h" /* for --enable-esp support */
- #include "filenames.h"
-
- /* By default there is no special suffix for target executables. */
-@@ -705,7 +706,9 @@
-
- static const char *asm_debug;
- static const char *cpp_spec = CPP_SPEC;
-+#ifndef ENABLE_ESP
- static const char *cc1_spec = CC1_SPEC;
-+#endif
- static const char *cc1plus_spec = CC1PLUS_SPEC;
- static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
- static const char *link_ssp_spec = LINK_SSP_SPEC;
-@@ -767,7 +770,7 @@
- static const char *cpp_options =
- "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
- %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\
-- %{undef} %{save-temps*:-fpch-preprocess}";
-+ %{undef} %{save-temps*:-fpch-preprocess} %(esp_cpp_options)";
-
- /* This contains cpp options which are not passed when the preprocessor
- output will be used by another program. */
-@@ -946,9 +949,9 @@
- %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
- %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\
- cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
-- %(cc1_options)}\
-+ %(cc1_options) %(esp_options)}\
- %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
-- cc1 %(cpp_unique_options) %(cc1_options)}}}\
-+ cc1 %(cpp_unique_options) %(cc1_options) %(esp_options)}}}\
- %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 1},
- {"-",
- "%{!E:%e-E or -x required when input is from standard input}\
-@@ -971,7 +974,7 @@
- %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
- {".i", "@cpp-output", 0, 0, 0},
- {"@cpp-output",
-- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
-+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(esp_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
- {".s", "@assembler", 0, 0, 0},
- {"@assembler",
- "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
-@@ -1225,18 +1228,23 @@
- INIT_STATIC_SPEC ("self_spec", &self_spec),
- };
-
--#ifdef EXTRA_SPECS /* additional specs needed */
-+/* EXTRA_SPECS needs to be defined */
-+#ifndef EXTRA_SPECS
-+#define EXTRA_SPECS
-+#endif
-+
-+/* EXTRA_SPECS and ESP_EXTRA_SPECS add additional specs */
- /* Structure to keep track of just the first two args of a spec_list.
-- That is all that the EXTRA_SPECS macro gives us. */
-+ That is all that the EXTRA_SPECS and ESP_EXTRA_SPECS macro gives us. */
- struct spec_list_1
- {
- const char *const name;
- const char *const ptr;
- };
-
--static const struct spec_list_1 extra_specs_1[] = { EXTRA_SPECS };
-+/* ESP_EXTRA_SPECS before EXTRA_SPECS */
-+static const struct spec_list_1 extra_specs_1[] = { ESP_EXTRA_SPECS, EXTRA_SPECS };
- static struct spec_list *extra_specs = (struct spec_list *) 0;
--#endif
-
- /* List of dynamically allocates specs that have been defined so far. */
-
-@@ -1328,7 +1336,6 @@
- if (verbose_flag)
- fnotice (stderr, "Using built-in specs.\n");
-
--#ifdef EXTRA_SPECS
- extra_specs = XCNEWVEC (struct spec_list, ARRAY_SIZE (extra_specs_1));
-
- for (i = ARRAY_SIZE (extra_specs_1) - 1; i >= 0; i--)
-@@ -1341,7 +1348,6 @@
- sl->ptr_spec = &sl->ptr;
- next = sl;
- }
--#endif
-
- for (i = ARRAY_SIZE (static_specs) - 1; i >= 0; i--)
- {
-@@ -6449,6 +6455,12 @@
- gcc_exec_prefix = concat (gcc_exec_prefix, spec_machine, dir_separator_str,
- spec_version, dir_separator_str, NULL);
-
-+#ifdef ENABLE_ESP
-+ /* Process ESP_COMMAND_OPTIONS_SPEC, adding any new options to the end
-+ of the command line. */
-+ do_self_spec (esp_command_options_spec);
-+#endif
-+
- /* Now we have the specs.
- Set the `valid' bits for switches that match anything in any spec. */
-
-diff -Nur gcc-4.7.0-vanilla/gcc/Makefile.in gcc-4.7.0/gcc/Makefile.in
---- gcc-4.7.0-vanilla/gcc/Makefile.in 2012-03-07 11:59:56.000000000 +0100
-+++ gcc-4.7.0/gcc/Makefile.in 2012-05-18 10:54:00.275165546 +0200
-@@ -247,6 +247,14 @@
- endif
- endif
-
-+# We don't want to compile the compiler with -fPIE, it make PCH fail.
-+enable_esp = @enable_esp@
-+ifeq ($(enable_esp),yes)
-+ESP_NOPIE_CFLAGS = -fno-PIE
-+else
-+ESP_NOPIE_CFLAGS=
-+endif
-+
- # -------------------------------------------
- # Programs which operate on the build machine
- # -------------------------------------------
-@@ -975,12 +983,13 @@
-
- # This is the variable actually used when we compile. If you change this,
- # you probably want to update BUILD_CFLAGS in configure.ac
--ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \
-+ALL_CFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) \
- $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@
-
- # The C++ version.
--ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \
-- $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) $(WARN_CXXFLAGS) @DEFS@
-+ALL_CXXFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) \
-+ $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) \
-+ $(WARN_CXXFLAGS) @DEFS@
-
- # Likewise. Put INCLUDES at the beginning: this way, if some autoconf macro
- # puts -I options in CPPFLAGS, our include files in the srcdir will always
-@@ -1815,6 +1824,8 @@
- echo GCC_CFLAGS = '$(GCC_CFLAGS)' >> tmp-libgcc.mvars
- echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars
- echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars
-+ echo enable_esp = '$(enable_esp)' >> tmp-libgcc.mvars
-+ echo enable_crtbeginP = '@enable_crtbeginP@' >> tmp-libgcc.mvars
-
- mv tmp-libgcc.mvars libgcc.mvars
-
-diff -Nur gcc-4.7.0-vanilla/gcc/objc/lang-specs.h gcc-4.7.0/gcc/objc/lang-specs.h
---- gcc-4.7.0-vanilla/gcc/objc/lang-specs.h 2011-03-06 17:27:57.000000000 +0100
-+++ gcc-4.7.0/gcc/objc/lang-specs.h 2012-05-18 10:54:40.281444970 +0200
-@@ -30,9 +30,9 @@
- %{traditional|traditional-cpp:\
- %eGNU Objective C no longer supports traditional compilation}\
- %{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
-- cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}\
-+ cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}}\
- %{!save-temps*:%{!no-integrated-cpp:\
-- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}}\
-+ cc1obj %(cpp_unique_options) %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}}}\
- %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
- {"@objective-c-header",
- "%{E|M|MM:cc1obj -E %{traditional|traditional-cpp:-traditional-cpp}\
-@@ -41,18 +41,18 @@
- %{traditional|traditional-cpp:\
- %eGNU Objective C no longer supports traditional compilation}\
- %{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
-- cc1obj -fpreprocessed %b.mi %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
-+ cc1obj -fpreprocessed %b.mi %(cc1_options)%(esp_options) %{print-objc-runtime-info} %{gen-decls}\
- -o %g.s %{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}%V}\
- %{!save-temps*:%{!no-integrated-cpp:\
-- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
-+ cc1obj %(cpp_unique_options) %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\
- -o %g.s %{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0},
- {".mi", "@objective-c-cpp-output", 0, 0, 0},
- {"@objective-c-cpp-output",
-- "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
-+ "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\
- %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
- {"@objc-cpp-output",
- "%nobjc-cpp-output is deprecated; please use objective-c-cpp-output instead\n\
-- %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
-+ %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\
- %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
-diff -Nur gcc-4.7.0-vanilla/gcc/objcp/lang-specs.h gcc-4.7.0/gcc/objcp/lang-specs.h
---- gcc-4.7.0-vanilla/gcc/objcp/lang-specs.h 2011-03-06 17:27:57.000000000 +0100
-+++ gcc-4.7.0/gcc/objcp/lang-specs.h 2012-05-18 10:54:40.281444969 +0200
-@@ -36,7 +36,7 @@
- %(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
- cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
- %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
-- %(cc1_options) %2\
-+ %(cc1_options) %(esp_options) %2\
- -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
- CPLUSPLUS_CPP_SPEC, 0, 0},
- {"@objective-c++",
-@@ -46,16 +46,16 @@
- %(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
- cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
- %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
-- %(cc1_options) %2\
-+ %(cc1_options) %(esp_options) %2\
- %{!fsyntax-only:%(invoke_as)}}}}",
- CPLUSPLUS_CPP_SPEC, 0, 0},
- {".mii", "@objective-c++-cpp-output", 0, 0, 0},
- {"@objective-c++-cpp-output",
- "%{!M:%{!MM:%{!E:\
-- cc1objplus -fpreprocessed %i %(cc1_options) %2\
-+ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2\
- %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
- {"@objc++-cpp-output",
- "%nobjc++-cpp-output is deprecated; please use objective-c++-cpp-output instead\n\
- %{!M:%{!MM:%{!E:\
-- cc1objplus -fpreprocessed %i %(cc1_options) %2\
-+ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2\
- %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
-diff -Nur gcc-4.7.0-vanilla/gcc/varasm.c gcc-4.7.0/gcc/varasm.c
---- gcc-4.7.0-vanilla/gcc/varasm.c 2012-02-20 12:47:25.000000000 +0100
-+++ gcc-4.7.0/gcc/varasm.c 2012-05-18 10:55:21.633767441 +0200
-@@ -6186,7 +6186,11 @@
- bool is_local;
-
- is_local = targetm.binds_local_p (decl);
-- if (!flag_shlib)
-+ #ifdef ENABLE_ESP
-+ if (!flag_pic)
-+ #else
-+ if (!flag_shlib)
-+ #endif
- {
- if (is_local)
- kind = TLS_MODEL_LOCAL_EXEC;
-diff -Nur gcc-4.7.0-vanilla/libgcc/Makefile.in gcc-4.7.0/libgcc/Makefile.in
---- gcc-4.7.0-vanilla/libgcc/Makefile.in 2011-11-22 04:01:02.000000000 +0100
-+++ gcc-4.7.0/libgcc/Makefile.in 2012-05-18 10:54:00.276165578 +0200
-@@ -219,6 +219,17 @@
- DECNUMINC =
- endif
-
-+ifeq ($(enable_esp),yes)
-+ESP_NOPIE_CFLAGS = -fno-PIE
-+else
-+ESP_NOPIE_CFLAGS=
-+endif
-+
-+# We add crtbeginP.o to the EXTRA_PARTS list if enable_crtbeginP = yes
-+ifeq ($(enable_crtbeginP),yes)
-+EXTRA_PARTS += crtbeginP.o
-+endif
-+
- # Options to use when compiling libgcc2.a.
- #
- LIBGCC2_DEBUG_CFLAGS = -g
-@@ -279,7 +290,7 @@
- CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
- -finhibit-size-directive -fno-inline -fno-exceptions \
- -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
-- -fno-stack-protector \
-+ -fno-stack-protector $(ESP_NOPIE_CFLAGS) \
- $(INHIBIT_LIBC_CFLAGS)
-
- # Extra flags to use when compiling crt{begin,end}.o.
-@@ -966,6 +977,13 @@
- # This is a version of crtbegin for -static links.
- crtbeginT$(objext): $(srcdir)/crtstuff.c
- $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O
-+
-+# This is a version of crtbegin for -static -fPIE links.
-+ifeq ($(enable_crtbeginP),yes)
-+crtbeginP$(objext): $(srcdir)/crtstuff.c
-+ $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
-+ -c $< -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O
-+endif
- endif
-
- ifeq ($(CUSTOM_CRTIN),)
-diff -Nur gcc-4.7.0-vanilla/Makefile.in gcc-4.7.0/Makefile.in
---- gcc-4.7.0-vanilla/Makefile.in 2012-01-02 11:59:04.000000000 +0100
-+++ gcc-4.7.0/Makefile.in 2012-05-18 10:54:00.273165482 +0200
-@@ -362,9 +362,17 @@
- BUILD_PREFIX = @BUILD_PREFIX@
- BUILD_PREFIX_1 = @BUILD_PREFIX_1@
-
-+# Some stuff don't compile with SSP
-+enable_esp = @enable_esp@
-+ifeq ($(enable_esp),yes)
-+ESP_NOSSP_CFLAGS = -fno-stack-protector
-+else
-+ESP_NOSSP_CFLAGS=
-+endif
-+
- # Flags to pass to stage2 and later makes. They are defined
- # here so that they can be overridden by Makefile fragments.
--BOOT_CFLAGS= -g -O2
-+BOOT_CFLAGS= -g -O2 $(ESP_NOSSP_CFLAGS)
- BOOT_LDFLAGS=
- BOOT_ADAFLAGS=-gnatpg -gnata
-
-@@ -410,9 +418,9 @@
-
- CFLAGS = @CFLAGS@
- LDFLAGS = @LDFLAGS@
--LIBCFLAGS = $(CFLAGS)
-+LIBCFLAGS = $(CFLAGS) $(ESP_NOSSP_CFLAGS)
- CXXFLAGS = @CXXFLAGS@
--LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
-+LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates $(ESP_NOSSP_CFLAGS)
- GOCFLAGS = $(CFLAGS)
-
- TFLAGS =
--- /dev/null
+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) <zorry@gentoo.org> */
++#ifndef GCC_ESP_H
++#define GCC_ESP_H
++
++/* This file will add -fstack-protector-all, -fPIE, -pie and -z now
++ as default if the defines and the spec allow it.
++ Added a hack for gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass
++ to support older hardened GCC patches and we don't need to change the code on gcc-specs-* and _filter-hardened.
++ This will add some unsupported upstream commands options as -nopie and -nonow.
++ -D__KERNEL__ is added so we don't have -fPIE, -pie and -fstack-protector-all when building kernels.
++ ESP_CC1_SPEC is added to CC1_SPEC.
++ ESP_CC1_STRICT_OVERFLOW_SPEC is added so we don't disable the strict-overflow check.
++ ESP_LINK_PIE_CHECK_SPEC check for -pie, -p, -pg, -profile and -static.
++ ENABLE_CRTBEGINP add support for crtbeginP.o, build -static with -fPIE or -fpie.
++*/
++#ifdef ENABLE_ESP
++
++ /* Hack to support gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass */
++ #define ESP_CC1_SPEC " %(esp_cc1_ssp) %(esp_cc1_pie) %(esp_cc1_strict_overflow)"
++ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP )
++ #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: }}"
++ #else
++ #define ESP_CC1_SSP_SPEC ""
++ #endif
++ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP )
++ #define ESP_CC1_PIE_SPEC "%{!nopie: }"
++ #else
++ #define ESP_CC1_PIE_SPEC ""
++ #endif
++ #define ESP_CC1_STRICT_OVERFLOW_SPEC "%{!fstrict-overflow:%{!fno-strict-overflow: -fno-strict-overflow}}"
++
++ /* ESP_LINK_SPEC is added to LINK_PIE_SPEC if esp is enable
++ -z now will be added if we don't have -vanilla spec. We do a -pie incompatible check
++ Don't remove the specs in the end */
++ #define ESP_LINK_SPEC "%(esp_link_now) %(esp_link_pie_check) "
++ #define ESP_LINK_NOW_SPEC "%{!nonow:-z now}"
++
++ /* We use ESP_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
+-\f
+
+ /* 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:%<mplt}}"
+
+ #undef DRIVER_SELF_SPECS
++#ifdef ENABLE_ESP
+ #define DRIVER_SELF_SPECS \
+ BASE_DRIVER_SELF_SPECS, \
++ ESP_DRIVER_SELF_SPEC, \
+ LINUX_DRIVER_SELF_SPECS
++# else
++#define DRIVER_SELF_SPECS \
++ BASE_DRIVER_SELF_SPECS, \
++ LINUX_DRIVER_SELF_SPECS
++#endif
+
+ /* Similar to standard Linux, but adding -ffast-math support. */
+ #undef GNU_USER_TARGET_MATHFILE_SPEC
+diff -Nur gcc-4.8.1-vanilla/gcc/config/mips/mips.h gcc-4.8.1/gcc/config/mips/mips.h
+--- gcc-4.8.1-vanilla/gcc/config/mips/mips.h 2013-02-25 14:53:16.000000000 +0100
++++ gcc-4.8.1/gcc/config/mips/mips.h 2013-06-27 23:57:54.032096249 +0200
+@@ -1197,9 +1197,13 @@
+ SUBTARGET_EXTRA_SPECS
+
+ #ifndef SUBTARGET_EXTRA_SPECS
++#ifdef ENABLE_ESP
++#define SUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS
++#else
+ #define SUBTARGET_EXTRA_SPECS
+ #endif
+-\f
++#endif
++
+ #define DBX_DEBUGGING_INFO 1 /* generate stabs (OSF/rose) */
+ #define DWARF2_DEBUGGING_INFO 1 /* dwarf2 debugging info */
+
+diff -Nur gcc-4.8.1-vanilla/gcc/config/rs6000/linux64.h gcc-4.8.1/gcc/config/rs6000/linux64.h
+--- gcc-4.8.1-vanilla/gcc/config/rs6000/linux64.h 2013-01-10 21:38:27.000000000 +0100
++++ gcc-4.8.1/gcc/config/rs6000/linux64.h 2013-06-27 23:57:54.029096174 +0200
+@@ -180,7 +180,7 @@
+ #endif
+
+ #define ASM_SPEC32 "-a32 \
+-%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
++%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} \
+ %{memb} %{!memb: %{msdata=eabi: -memb}} \
+ %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
+ %{mcall-freebsd: -mbig} \
+diff -Nur gcc-4.8.1-vanilla/gcc/config/rs6000/sysv4.h gcc-4.8.1/gcc/config/rs6000/sysv4.h
+--- gcc-4.8.1-vanilla/gcc/config/rs6000/sysv4.h 2013-01-10 21:38:27.000000000 +0100
++++ gcc-4.8.1/gcc/config/rs6000/sysv4.h 2013-06-27 23:57:54.030096199 +0200
+@@ -627,8 +627,13 @@
+
+ #define LINK_OS_DEFAULT_SPEC ""
+
++#ifdef ENABLE_ESP
++#define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
++ %<msingle-float %<mdouble-float}", ESP_DRIVER_SELF_SPECS
++#else
+ #define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
+ %<msingle-float %<mdouble-float}"
++#endif
+
+ /* Override rs6000.h definition. */
+ #undef CPP_SPEC
+@@ -769,7 +774,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} \
+@@ -933,7 +943,11 @@
+ { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \
+ { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \
+ { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }, \
+- SUBSUBTARGET_EXTRA_SPECS
++ SUBSUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS
++
++#ifndef ENABLE_ESP
++#define ESP_EXTRA_SPECS
++#endif
+
+ #define SUBSUBTARGET_EXTRA_SPECS
+
+diff -Nur gcc-4.8.1-vanilla/gcc/config.in gcc-4.8.1/gcc/config.in
+--- gcc-4.8.1-vanilla/gcc/config.in 2013-05-31 11:09:26.000000000 +0200
++++ gcc-4.8.1/gcc/config.in 2013-06-27 23:57:54.009095677 +0200
+@@ -52,6 +52,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
+@@ -71,6 +77,12 @@
+ #endif
+
+
++/* Define to 1 to enable esp. */
++#ifndef USED_FOR_TARGET
++#undef ENABLE_ESP
++#endif
++
++
+ /* Define to 1 to enable fixed-point arithmetic extension to C. */
+ #ifndef USED_FOR_TARGET
+ #undef ENABLE_FIXED_POINT
+diff -Nur gcc-4.8.1-vanilla/gcc/configure gcc-4.8.1/gcc/configure
+--- gcc-4.8.1-vanilla/gcc/configure 2013-05-08 13:36:36.000000000 +0200
++++ gcc-4.8.1/gcc/configure 2013-06-27 23:57:54.008095652 +0200
+@@ -600,6 +600,8 @@
+
+ ac_subst_vars='LTLIBOBJS
+ LIBOBJS
++enable_crtbeginP
++enable_esp
+ enable_plugin
+ pluginlibs
+ CLOOGINC
+@@ -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]
+@@ -27431,6 +27439,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 -Nur gcc-4.8.1-vanilla/gcc/configure.ac gcc-4.8.1/gcc/configure.ac
+--- gcc-4.8.1-vanilla/gcc/configure.ac 2013-05-08 13:36:36.000000000 +0200
++++ gcc-4.8.1/gcc/configure.ac 2013-06-27 23:57:54.001095478 +0200
+@@ -5297,6 +5297,55 @@
+ [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)
+
+diff -Nur gcc-4.8.1-vanilla/gcc/doc/invoke.texi gcc-4.8.1/gcc/doc/invoke.texi
+--- gcc-4.8.1-vanilla/gcc/doc/invoke.texi 2013-03-29 14:41:29.000000000 +0100
++++ gcc-4.8.1/gcc/doc/invoke.texi 2013-06-27 23:57:54.029096174 +0200
+@@ -8877,6 +8877,11 @@
+ @opindex fstack-protector-all
+ Like @option{-fstack-protector} except that all functions are protected.
+
++NOTE: When --enable-esp this option is enabled by default
++for C, C++, ObjC, ObjC++, if neither @option{-fno-stack-protector}
++or @option{-nostdlib} or @option{-nodefaultlibs} or
++@option{-fstack-protector} are found.
++
+ @item -fsection-anchors
+ @opindex fsection-anchors
+ Try to reduce the number of symbolic address calculations by using
+@@ -9905,6 +9910,12 @@
+ used for compilation (@option{-fpie}, @option{-fPIE},
+ or model suboptions) when you specify this linker 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
+@@ -20360,6 +20371,11 @@
+ @code{__pie__} and @code{__PIE__}. The macros have the value 1
+ for @option{-fpie} and 2 for @option{-fPIE}.
+
++NOTE: When --enable-esp this option is enabled by default
++for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE}
++or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or
++@option{-nostartfiles} or @option{-shared} are found.
++
+ @item -fno-jump-tables
+ @opindex fno-jump-tables
+ Do not use jump tables for switch statements even where it would be
+diff -Nur gcc-4.8.1-vanilla/gcc/gcc.c gcc-4.8.1/gcc/gcc.c
+--- gcc-4.8.1-vanilla/gcc/gcc.c 2013-05-17 14:24:26.000000000 +0200
++++ gcc-4.8.1/gcc/gcc.c 2013-06-27 23:57:54.021095975 +0200
+@@ -42,6 +42,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. */
+@@ -773,7 +774,9 @@
+
+ static const char *asm_debug = ASM_DEBUG_SPEC;
+ static const char *cpp_spec = CPP_SPEC;
++#ifndef ENABLE_ESP
+ static const char *cc1_spec = CC1_SPEC;
++#endif
+ static const char *cc1plus_spec = CC1PLUS_SPEC;
+ static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
+ static const char *link_ssp_spec = LINK_SSP_SPEC;
+diff -Nur gcc-4.8.1-vanilla/gcc/Makefile.in gcc-4.8.1/gcc/Makefile.in
+--- gcc-4.8.1-vanilla/gcc/Makefile.in 2013-05-21 18:00:49.000000000 +0200
++++ gcc-4.8.1/gcc/Makefile.in 2013-06-27 23:57:54.019095926 +0200
+@@ -235,6 +235,14 @@
+ LINKER_FLAGS = $(CFLAGS)
+ 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
+ # -------------------------------------------
+@@ -986,12 +994,13 @@
+
+ # This is the variable actually used when we compile. If you change this,
+ # you probably want to update BUILD_CFLAGS in configure.ac
+-ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \
++ALL_CFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) \
+ $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@
+
+ # The C++ version.
+-ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \
+- $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) $(WARN_CXXFLAGS) @DEFS@
++ALL_CXXFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) \
++ $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) \
++ $(WARN_CXXFLAGS) @DEFS@
+
+ # Likewise. Put INCLUDES at the beginning: this way, if some autoconf macro
+ # puts -I options in CPPFLAGS, our include files in the srcdir will always
+@@ -1808,6 +1817,8 @@
+ echo GCC_CFLAGS = '$(GCC_CFLAGS)' >> tmp-libgcc.mvars
+ echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars
+ echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars
++ echo enable_esp = '$(enable_esp)' >> tmp-libgcc.mvars
++ echo enable_crtbeginP = '@enable_crtbeginP@' >> tmp-libgcc.mvars
+
+ mv tmp-libgcc.mvars libgcc.mvars
+
+diff -Nur gcc-4.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 =
+++ /dev/null
-2007-10-02 Jakub Jelinek <jakub@redhat.com>
-
- * decl.c (duplicate_decls): When redeclaring a builtin function,
- keep the merged decl builtin whenever types match, even if new
- decl defines a function.
-
- * gcc.dg/builtins-85.c: New test.
- * g++.dg/ext/builtin30.C: New test.
-
---- gcc/cp/decl.c.jj 2007-10-01 22:11:09.000000000 +0200
-+++ gcc/cp/decl.c 2007-10-02 11:39:46.000000000 +0200
-@@ -2137,39 +2137,37 @@ duplicate_decls (tree newdecl, tree oldd
- DECL_ARGUMENTS (olddecl) = DECL_ARGUMENTS (newdecl);
- DECL_RESULT (olddecl) = DECL_RESULT (newdecl);
- }
-+ /* If redeclaring a builtin function, it stays built in. */
-+ if (types_match && DECL_BUILT_IN (olddecl))
-+ {
-+ DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
-+ DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
-+ /* If we're keeping the built-in definition, keep the rtl,
-+ regardless of declaration matches. */
-+ COPY_DECL_RTL (olddecl, newdecl);
-+ if (DECL_BUILT_IN_CLASS (newdecl) == BUILT_IN_NORMAL)
-+ {
-+ enum built_in_function fncode = DECL_FUNCTION_CODE (newdecl);
-+ switch (fncode)
-+ {
-+ /* If a compatible prototype of these builtin functions
-+ is seen, assume the runtime implements it with the
-+ expected semantics. */
-+ case BUILT_IN_STPCPY:
-+ if (builtin_decl_explicit_p (fncode))
-+ set_builtin_decl_implicit_p (fncode, true);
-+ break;
-+ default:
-+ break;
-+ }
-+ }
-+ }
- if (new_defines_function)
- /* If defining a function declared with other language
- linkage, use the previously declared language linkage. */
- SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl));
- else if (types_match)
- {
-- /* If redeclaring a builtin function, and not a definition,
-- it stays built in. */
-- if (DECL_BUILT_IN (olddecl))
-- {
-- DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
-- DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
-- /* If we're keeping the built-in definition, keep the rtl,
-- regardless of declaration matches. */
-- COPY_DECL_RTL (olddecl, newdecl);
-- if (DECL_BUILT_IN_CLASS (newdecl) == BUILT_IN_NORMAL)
-- {
-- enum built_in_function fncode = DECL_FUNCTION_CODE (newdecl);
-- switch (fncode)
-- {
-- /* If a compatible prototype of these builtin functions
-- is seen, assume the runtime implements it with the
-- expected semantics. */
-- case BUILT_IN_STPCPY:
-- if (builtin_decl_explicit_p (fncode))
-- set_builtin_decl_implicit_p (fncode, true);
-- break;
-- default:
-- break;
-- }
-- }
-- }
--
- DECL_RESULT (newdecl) = DECL_RESULT (olddecl);
- /* Don't clear out the arguments if we're just redeclaring a
- function. */
---- gcc/testsuite/gcc.dg/builtins-85.c.jj 2007-10-02 11:23:51.000000000 +0200
-+++ gcc/testsuite/gcc.dg/builtins-85.c 2007-10-02 11:24:12.000000000 +0200
-@@ -0,0 +1,25 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2" } */
-+
-+typedef __SIZE_TYPE__ size_t;
-+extern void __chk_fail (void);
-+extern int snprintf (char *, size_t, const char *, ...);
-+extern inline __attribute__((gnu_inline, always_inline)) int snprintf (char *a, size_t b, const char *fmt, ...)
-+{
-+ if (__builtin_object_size (a, 0) != -1UL && __builtin_object_size (a, 0) < b)
-+ __chk_fail ();
-+ return __builtin_snprintf (a, b, fmt, __builtin_va_arg_pack ());
-+}
-+extern int snprintf (char *, size_t, const char *, ...) __asm ("mysnprintf");
-+
-+char buf[10];
-+
-+int
-+main (void)
-+{
-+ snprintf (buf, 10, "%d%d\n", 10, 10);
-+ return 0;
-+}
-+
-+/* { dg-final { scan-assembler "mysnprintf" } } */
-+/* { dg-final { scan-assembler-not "__chk_fail" } } */
---- gcc/testsuite/g++.dg/ext/builtin30.C.jj 2007-10-02 11:19:45.000000000 +0200
-+++ gcc/testsuite/g++.dg/ext/builtin30.C 2007-10-02 11:23:26.000000000 +0200
-@@ -0,0 +1,27 @@
-+// { dg-do compile }
-+// { dg-options "-O2" }
-+
-+typedef __SIZE_TYPE__ size_t;
-+extern "C" {
-+extern void __chk_fail (void);
-+extern int snprintf (char *, size_t, const char *, ...);
-+extern inline __attribute__((gnu_inline, always_inline)) int snprintf (char *a, size_t b, const char *fmt, ...)
-+{
-+ if (__builtin_object_size (a, 0) != -1UL && __builtin_object_size (a, 0) < b)
-+ __chk_fail ();
-+ return __builtin_snprintf (a, b, fmt, __builtin_va_arg_pack ());
-+}
-+extern int snprintf (char *, size_t, const char *, ...) __asm ("mysnprintf");
-+}
-+
-+char buf[10];
-+
-+int
-+main (void)
-+{
-+ snprintf (buf, 10, "%d%d\n", 10, 10);
-+ return 0;
-+}
-+
-+// { dg-final { scan-assembler "mysnprintf" } }
-+// { dg-final { scan-assembler-not "__chk_fail" } }
+++ /dev/null
-2008-06-09 Jakub Jelinek <jakub@redhat.com>
-
- * omp.h.in (omp_nest_lock_t): Fix up for Linux multilibs.
-
---- libgomp/omp.h.in.jj 2008-06-09 13:34:05.000000000 +0200
-+++ libgomp/omp.h.in 2008-06-09 13:34:48.000000000 +0200
-@@ -42,8 +42,8 @@ typedef struct
-
- typedef struct
- {
-- unsigned char _x[@OMP_NEST_LOCK_SIZE@]
-- __attribute__((__aligned__(@OMP_NEST_LOCK_ALIGN@)));
-+ unsigned char _x[8 + sizeof (void *)]
-+ __attribute__((__aligned__(sizeof (void *))));
- } omp_nest_lock_t;
- #endif
-
+++ /dev/null
-2011-12-22 Jakub Jelinek <jakub@redhat.com>
-
- * Makefile.am (beginend.lo): Append -fno-exceptions to
- CXXFLAGS.
- * Makefile.in: Regenerated.
-
---- libitm/Makefile.am.jj 2011-12-20 13:47:57.000000000 +0100
-+++ libitm/Makefile.am 2011-12-22 09:14:06.663469165 +0100
-@@ -72,6 +72,8 @@ endif
- if ARCH_X86_AVX
- x86_avx.lo : XCFLAGS += -mavx
- endif
-+beginend.lo : CXXCOMPILE += -fno-exceptions
-+beginend.lo : LTCXXCOMPILE += -fno-exceptions
-
- if ARCH_FUTEX
- libitm_la_SOURCES += futex.cc
---- libitm/Makefile.in.jj 2011-12-20 13:47:57.000000000 +0100
-+++ libitm/Makefile.in 2011-12-22 09:14:29.466329944 +0100
-@@ -1278,6 +1278,8 @@ vpath % $(strip $(search_path))
- @LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@ > $@ || (rm -f $@ ; exit 1)
- @ARCH_X86_TRUE@x86_sse.lo : XCFLAGS += -msse
- @ARCH_X86_AVX_TRUE@x86_avx.lo : XCFLAGS += -mavx
-+beginend.lo : CXXCOMPILE += -fno-exceptions
-+beginend.lo : LTCXXCOMPILE += -fno-exceptions
-
- all-local: $(STAMP_GENINSRC)
-
+++ /dev/null
-2011-01-28 Jakub Jelinek <jakub@redhat.com>
-
- Revert:
- 2011-01-25 Sebastian Pop <sebastian.pop@amd.com>
-
- * configure: Regenerated.
- * configure.ac: Check for version 0.11 (or later revision) of PPL.
-gcc/
- * doc/install.texi: Update the expected version number of PPL to 0.11.
- * graphite-ppl.c (ppl_powerset_is_empty): Remove now dead code under
- #if PPL_VERSION_MINOR < 11.
-
---- gcc/doc/install.texi (revision 169207)
-+++ gcc/doc/install.texi (revision 169206)
-@@ -332,7 +332,7 @@ and @option{--with-mpc-include}. Altern
- distribution is found in a subdirectory of your GCC sources named
- @file{mpc}, it will be built together with GCC@.
-
--@item Parma Polyhedra Library (PPL) version 0.11
-+@item Parma Polyhedra Library (PPL) version 0.10
-
- Necessary to build GCC with the Graphite loop optimizations.
- It can be downloaded from @uref{http://www.cs.unipr.it/ppl/Download/}.
---- gcc/graphite-ppl.c (revision 169207)
-+++ gcc/graphite-ppl.c (revision 169206)
-@@ -521,6 +521,15 @@ debug_gmp_value (mpz_t val)
- bool
- ppl_powerset_is_empty (ppl_Pointset_Powerset_C_Polyhedron_t ps)
- {
-+#if PPL_VERSION_MAJOR == 0 && PPL_VERSION_MINOR < 11
-+ /* On PPL 0.10,
-+ ppl_Pointset_Powerset_C_Polyhedron_contains_integer_point (ps)
-+ takes too long on some cases and so we call _is_empty instead. */
-+ return ppl_Pointset_Powerset_C_Polyhedron_is_empty (ps);
-+
-+#else
-+ /* On PPL 0.11 or later, we can check for integer feasibility using
-+ the PIP solver. */
- ppl_PIP_Problem_t pip;
- ppl_dimension_type d;
- ppl_const_Constraint_System_t pcs;
-@@ -561,6 +570,7 @@ ppl_powerset_is_empty (ppl_Pointset_Powe
- ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (end);
-
- return !has_integer_solutions;
-+#endif
- }
-
- #endif
---- configure.ac (revision 169207)
-+++ configure.ac (revision 169206)
-@@ -1688,9 +1688,9 @@ if test "x$with_ppl" != xno; then
- if test "$enable_ppl_version_check" != no; then
- saved_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $pplinc $gmpinc"
-- AC_MSG_CHECKING([for version 0.11 (revision 0 or later) of PPL])
-+ AC_MSG_CHECKING([for version 0.10 (revision 0 or later) of PPL])
- AC_TRY_COMPILE([#include "ppl_c.h"],[
-- #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 11
-+ #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 10
- choke me
- #endif
- ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); ppllibs= ; pplinc= ; with_ppl=no ])
---- configure (revision 169207)
-+++ configure (revision 169206)
-@@ -5775,8 +5775,8 @@ fi
- if test "$enable_ppl_version_check" != no; then
- saved_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $pplinc $gmpinc"
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.11 (revision 0 or later) of PPL" >&5
--$as_echo_n "checking for version 0.11 (revision 0 or later) of PPL... " >&6; }
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.10 (revision 0 or later) of PPL" >&5
-+$as_echo_n "checking for version 0.10 (revision 0 or later) of PPL... " >&6; }
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
- #include "ppl_c.h"
-@@ -5784,7 +5784,7 @@ int
- main ()
- {
-
-- #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 11
-+ #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 10
- choke me
- #endif
-
---- gcc/testsuite/gcc.dg/graphite/interchange-11.c.jj 2011-01-28 09:38:11.000000000 +0100
-+++ gcc/testsuite/gcc.dg/graphite/interchange-11.c 2011-01-28 11:06:56.461429848 +0100
-@@ -46,5 +46,5 @@ main (void)
- return 0;
- }
-
--/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
-+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
- /* { dg-final { cleanup-tree-dump "graphite" } } */
---- gcc/testsuite/gcc.dg/graphite/interchange-13.c.jj 2011-01-28 09:38:12.000000000 +0100
-+++ gcc/testsuite/gcc.dg/graphite/interchange-13.c 2011-01-28 11:07:08.182429223 +0100
-@@ -50,5 +50,5 @@ main (void)
- }
-
-
--/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
-+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
- /* { dg-final { cleanup-tree-dump "graphite" } } */
---- gcc/testsuite/gcc.dg/graphite/interchange-1.c.jj 2011-01-28 09:38:13.000000000 +0100
-+++ gcc/testsuite/gcc.dg/graphite/interchange-1.c 2011-01-28 11:06:42.160429193 +0100
-@@ -49,5 +49,5 @@ main (void)
- return 0;
- }
-
--/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
-+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
- /* { dg-final { cleanup-tree-dump "graphite" } } */
---- gcc/testsuite/gfortran.dg/graphite/interchange-3.f90.jj 2011-01-28 09:38:05.000000000 +0100
-+++ gcc/testsuite/gfortran.dg/graphite/interchange-3.f90 2011-01-28 11:07:46.313420441 +0100
-@@ -24,5 +24,5 @@ Program FOO
-
- end Program FOO
-
--! { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } }
-+! { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } }
- ! { dg-final { cleanup-tree-dump "graphite" } }
+++ /dev/null
-2007-11-06 Jakub Jelinek <jakub@redhat.com>
-
- PR tree-optimization/33763
- * gcc.dg/pr33763.c: New test.
- * g++.dg/opt/inline13.C: New test.
-
-2007-11-06 Jan Hubicka <jh@suse.cz>
-
- PR tree-optimization/33763
- * tree-inline.c (expand_call_inline): Silently ignore always_inline
- attribute for redefined extern inline functions.
-
---- gcc/tree-inline.c.jj 2007-11-06 09:29:04.000000000 +0100
-+++ gcc/tree-inline.c 2007-11-06 16:19:12.000000000 +0100
-@@ -3817,6 +3817,12 @@ expand_call_inline (basic_block bb, gimp
- goto egress;
-
- if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn))
-+ /* For extern inline functions that get redefined we always
-+ silently ignored always_inline flag. Better behaviour would
-+ be to be able to keep both bodies and use extern inline body
-+ for inlining, but we can't do that because frontends overwrite
-+ the body. */
-+ && !cg_edge->callee->local.redefined_extern_inline
- /* Avoid warnings during early inline pass. */
- && cgraph_global_info_ready
- /* PR 20090218-1_0.c. Body can be provided by another module. */
---- gcc/testsuite/gcc.dg/pr33763.c.jj 2007-11-06 16:19:12.000000000 +0100
-+++ gcc/testsuite/gcc.dg/pr33763.c 2007-11-06 16:19:12.000000000 +0100
-@@ -0,0 +1,60 @@
-+/* PR tree-optimization/33763 */
-+/* { dg-do compile } */
-+/* { dg-options "-O2" } */
-+
-+typedef struct
-+{
-+ void *a;
-+ void *b;
-+} T;
-+extern void *foo (const char *, const char *);
-+extern void *bar (void *, const char *, T);
-+extern int baz (const char *, int);
-+
-+extern inline __attribute__ ((always_inline, gnu_inline)) int
-+baz (const char *x, int y)
-+{
-+ return 2;
-+}
-+
-+int
-+baz (const char *x, int y)
-+{
-+ return 1;
-+}
-+
-+int xa, xb;
-+
-+static void *
-+inl (const char *x, const char *y)
-+{
-+ T t = { &xa, &xb };
-+ int *f = (int *) __builtin_malloc (sizeof (int));
-+ const char *z;
-+ int o = 0;
-+ void *r = 0;
-+
-+ for (z = y; *z; z++)
-+ {
-+ if (*z == 'r')
-+ o |= 1;
-+ if (*z == 'w')
-+ o |= 2;
-+ }
-+ if (o == 1)
-+ *f = baz (x, 0);
-+ if (o == 2)
-+ *f = baz (x, 1);
-+ if (o == 3)
-+ *f = baz (x, 2);
-+
-+ if (o && *f > 0)
-+ r = bar (f, "w", t);
-+ return r;
-+}
-+
-+void *
-+foo (const char *x, const char *y)
-+{
-+ return inl (x, y);
-+}
---- gcc/testsuite/g++.dg/opt/inline13.C.jj 2007-11-06 16:20:20.000000000 +0100
-+++ gcc/testsuite/g++.dg/opt/inline13.C 2007-11-06 16:21:30.000000000 +0100
-@@ -0,0 +1,60 @@
-+// PR tree-optimization/33763
-+// { dg-do compile }
-+// { dg-options "-O2" }
-+
-+typedef struct
-+{
-+ void *a;
-+ void *b;
-+} T;
-+extern void *foo (const char *, const char *);
-+extern void *bar (void *, const char *, T);
-+extern int baz (const char *, int);
-+
-+extern inline __attribute__ ((always_inline, gnu_inline)) int
-+baz (const char *x, int y)
-+{
-+ return 2;
-+}
-+
-+int
-+baz (const char *x, int y)
-+{
-+ return 1;
-+}
-+
-+int xa, xb;
-+
-+static void *
-+inl (const char *x, const char *y)
-+{
-+ T t = { &xa, &xb };
-+ int *f = (int *) __builtin_malloc (sizeof (int));
-+ const char *z;
-+ int o = 0;
-+ void *r = 0;
-+
-+ for (z = y; *z; z++)
-+ {
-+ if (*z == 'r')
-+ o |= 1;
-+ if (*z == 'w')
-+ o |= 2;
-+ }
-+ if (o == 1)
-+ *f = baz (x, 0);
-+ if (o == 2)
-+ *f = baz (x, 1);
-+ if (o == 3)
-+ *f = baz (x, 2);
-+
-+ if (o && *f > 0)
-+ r = bar (f, "w", t);
-+ return r;
-+}
-+
-+void *
-+foo (const char *x, const char *y)
-+{
-+ return inl (x, y);
-+}
+++ /dev/null
-2009-03-18 Jakub Jelinek <jakub@redhat.com>
-
- PR debug/38757
- * langhooks.h (struct lang_hooks): Add source_language langhook.
- * langhooks-def.h (LANG_HOOKS_SOURCE_LANGUAGE): Define to NULL.
- (LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_SOURCE_LANGUAGE.
- * c-lang.c (c_source_language): New function.
- (LANG_HOOKS_SOURCE_LANGUAGE): Define.
- * dwarf2out.c (add_prototyped_attribute): Add DW_AT_prototype
- also for DW_LANG_{C,C99,ObjC}.
- (gen_compile_unit_die): Use lang_hooks.source_language () to
- determine if DW_LANG_C99 or DW_LANG_C89 should be returned.
-
---- gcc/langhooks.h.jj 2011-01-03 12:53:05.125745450 +0100
-+++ gcc/langhooks.h 2011-01-04 17:59:43.166744926 +0100
-@@ -467,6 +467,10 @@ struct lang_hooks
- gimplification. */
- bool deep_unsharing;
-
-+ /* Return year of the source language standard version if the FE supports
-+ multiple versions of the standard. */
-+ int (*source_language) (void);
-+
- /* Whenever you add entries here, make sure you adjust langhooks-def.h
- and langhooks.c accordingly. */
- };
---- gcc/langhooks-def.h.jj 2011-01-03 12:53:05.000000000 +0100
-+++ gcc/langhooks-def.h 2011-01-04 18:00:44.858851030 +0100
-@@ -118,6 +118,7 @@ extern void lhd_omp_firstprivatize_type_
- #define LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS NULL
- #define LANG_HOOKS_EH_USE_CXA_END_CLEANUP false
- #define LANG_HOOKS_DEEP_UNSHARING false
-+#define LANG_HOOKS_SOURCE_LANGUAGE NULL
-
- /* Attribute hooks. */
- #define LANG_HOOKS_ATTRIBUTE_TABLE NULL
-@@ -307,7 +308,8 @@ extern void lhd_end_section (void);
- LANG_HOOKS_EH_RUNTIME_TYPE, \
- LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS, \
- LANG_HOOKS_EH_USE_CXA_END_CLEANUP, \
-- LANG_HOOKS_DEEP_UNSHARING \
-+ LANG_HOOKS_DEEP_UNSHARING, \
-+ LANG_HOOKS_SOURCE_LANGUAGE \
- }
-
- #endif /* GCC_LANG_HOOKS_DEF_H */
---- gcc/c-lang.c.jj 2011-01-03 12:53:05.376056936 +0100
-+++ gcc/c-lang.c 2011-01-04 17:59:43.167743798 +0100
-@@ -36,6 +36,12 @@ along with GCC; see the file COPYING3.
-
- enum c_language_kind c_language = clk_c;
-
-+static int
-+c_source_language (void)
-+{
-+ return flag_isoc99 ? 1999 : 1989;
-+}
-+
- /* Lang hooks common to C and ObjC are declared in c-objc-common.h;
- consequently, there should be very few hooks below. */
-
-@@ -45,6 +51,8 @@ enum c_language_kind c_language = clk_c;
- #define LANG_HOOKS_INIT c_objc_common_init
- #undef LANG_HOOKS_INIT_TS
- #define LANG_HOOKS_INIT_TS c_common_init_ts
-+#undef LANG_HOOKS_SOURCE_LANGUAGE
-+#define LANG_HOOKS_SOURCE_LANGUAGE c_source_language
-
- /* Each front end provides its own lang hook initializer. */
- struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
---- gcc/dwarf2out.c.jj 2011-01-03 12:53:05.102056475 +0100
-+++ gcc/dwarf2out.c 2011-01-04 18:03:14.534151763 +0100
-@@ -15793,9 +15793,18 @@ add_bit_size_attribute (dw_die_ref die,
- static inline void
- add_prototyped_attribute (dw_die_ref die, tree func_type)
- {
-- if (get_AT_unsigned (comp_unit_die (), DW_AT_language) == DW_LANG_C89
-- && prototype_p (func_type))
-- add_AT_flag (die, DW_AT_prototyped, 1);
-+ switch (get_AT_unsigned (comp_unit_die (), DW_AT_language))
-+ {
-+ case DW_LANG_C:
-+ case DW_LANG_C89:
-+ case DW_LANG_C99:
-+ case DW_LANG_ObjC:
-+ if (prototype_p (func_type))
-+ add_AT_flag (die, DW_AT_prototyped, 1);
-+ break;
-+ default:
-+ break;
-+ }
- }
-
- /* Add an 'abstract_origin' attribute below a given DIE. The DIE is found
-@@ -18438,6 +18447,10 @@ gen_compile_unit_die (const char *filena
- if (strcmp (language_string, "GNU Go") == 0)
- language = DW_LANG_Go;
- }
-+ else if (strcmp (language_string, "GNU C") == 0
-+ && lang_hooks.source_language
-+ && lang_hooks.source_language () >= 1999)
-+ language = DW_LANG_C99;
- }
-
- add_AT_unsigned (die, DW_AT_language, language);
--- libgomp/configure.tgt.jj 2008-01-10 20:53:48.000000000 +0100
+++ libgomp/configure.tgt 2008-03-27 12:44:51.000000000 +0100
-@@ -44,14 +44,14 @@ if test $enable_linux_futex = yes; then
- ;;
-
- # Note that bare i386 is not included here. We need cmpxchg.
-- i[456]86-*-linux*)
-+ i[456]86-*-linux*)
- config_path="linux/x86 linux posix"
- case " ${CC} ${CFLAGS} " in
- *" -m64 "*)
+@@ -67,7 +67,7 @@ if test $enable_linux_futex = yes; then
;;
*)
if test -z "$with_arch"; then
fi
esac
;;
-@@ -63,7 +63,7 @@ if test $enable_linux_futex = yes; then
+@@ -79,7 +79,7 @@ if test $enable_linux_futex = yes; then
config_path="linux/x86 linux posix"
case " ${CC} ${CFLAGS} " in
*" -m32 "*)
--- libstdc++-v3/doc/html/index.html.jj 2011-01-03 12:53:21.282829010 +0100
+++ libstdc++-v3/doc/html/index.html 2011-01-04 18:06:28.999851145 +0100
@@ -5,6 +5,8 @@
- <a class="link" href="http://www.fsf.org/">FSF
+ <a class="link" href="http://www.fsf.org/" target="_top">FSF
</a>
</p><p>
-+ Release 4.7.0
++ Release 4.8.0
+ </p><p>
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation
License, Version 1.2 or any later version published by the
--- libstdc++-v3/doc/html/api.html.jj 2011-01-03 12:53:21.000000000 +0100
+++ libstdc++-v3/doc/html/api.html 2011-01-04 18:12:01.672757784 +0100
-@@ -19,8 +19,11 @@
+@@ -18,8 +18,11 @@
member functions for the library classes, finding out what is in a
particular include file, looking at inheritance diagrams, etc.
</p><p>
- The API documentation, rendered into HTML, can be viewed online:
+ The API documentation, rendered into HTML, can be viewed here:
- </p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>
-+ <a class="ulink" href="api/index.html">for the 4.7 release, local
+ </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
++ <a class="link" href="api/index.html" target="_top">for the 4.8 release, local
+ </a>
+ </p></li><li class="listitem"><p>
- <a class="link" href="http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-3.4/index.html">for the 3.4 release
+ <a class="link" href="http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-3.4/index.html" target="_top">for the 3.4 release
</a>
</p></li><li class="listitem"><p>
--- gcc/config/alpha/elf.h.jj 2011-01-03 12:52:31.118056764 +0100
+++ gcc/config/alpha/elf.h 2011-01-04 18:14:10.931874160 +0100
-@@ -438,7 +438,7 @@ extern int alpha_this_gpdisp_sequence_nu
+@@ -165,5 +165,5 @@ extern int alpha_this_gpdisp_sequence_nu
I imagine that other systems will catch up. In the meantime, it
doesn't harm to make sure that the data exists to be used later. */
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "--no-add-needed %{!static:--eh-frame-hdr} "
#endif
-
- /* A C statement (sans semicolon) to output to the stdio stream STREAM
--- gcc/config/ia64/linux.h.jj 2011-01-03 13:02:11.462994522 +0100
+++ gcc/config/ia64/linux.h 2011-01-04 18:14:10.931874160 +0100
@@ -77,7 +77,7 @@ do { \
name = gnutls
version = %{ver_maj}.%{ver_min}
-ver_maj = 3.1
-ver_min = 9
+ver_maj = 3.2
+ver_min = 1
release = 1
groups = System/Libraries
libidn-devel
libtasn1-devel >= 3.2
lzo-devel
- nettle-devel >= 2.5
+ nettle-devel >= 2.7
perl
p11-kit-devel >= 0.14
readline-devel
configure_options += \
--with-included-libcfg \
- --disable-srp-authentication \
--disable-openssl-compatibility \
--with-libgcrypt
# Test suite does not work when srp is disabled.
- #test
- # export LD_LIBRARY_PATH=$(pwd)/lib/.libs
- # make check
- #end
+ test
+ export LD_LIBRARY_PATH=$(pwd)/lib/.libs
+ make check
+ end
end
packages
package %{name}
requires
- nettle >= 2.5
+ nettle >= 2.7
p11-kit >= 0.14
end
end
###############################################################################
name = gzip
-version = 1.5
+version = 1.6
release = 1
groups = Applications/Compression
requires
coreutils
less
+ texinfo
+
+ /usr/bin/more
end
# NO_ASM is for textrels.
fi
- if gzip -lv < "$i" 2>/dev/null | grep '^defl' > /dev/null; then
-+ if gzip -l < "$i" 2>/dev/null | grep '^compressed' > /dev/null; then
++ if gzip -l < "$i" 2>/dev/null | grep 'compressed' > /dev/null; then
new="$i.gz"
if mv "$i" "$new"; then
+++ /dev/null
---- gzip-1.3.9/zmore.in.pom 2007-01-15 15:31:26.000000000 +0100
-+++ gzip-1.3.9/zmore.in 2007-01-15 15:34:06.000000000 +0100
-@@ -70,7 +70,7 @@
- --v*) exec echo "$version";;
- esac
-
-- < "$FILE" || continue
-+ if test -e $FILE || test -e $FILE.gz; then
- if test $FIRST -eq 0; then
- echo $n1 "--More--(Next file: $FILE)$n2"
- stty $cb -echo 2>/dev/null
-@@ -88,5 +88,7 @@
- if test -t 1; then
- FIRST=0
- fi
-+ else < $FILE
-+ fi
- done
- fi
name = libjpeg
version = 1.2.0
-release = 1
+release = 2
thisapp = libjpeg-turbo-%{version}
groups = System/Libraries
package %{name}-devel
template DEVEL
- files += !/usr/lib/libturbojpeg.so
+ files += !%{libdir}/libturbojpeg.so
end
package %{name}-debuginfo
###############################################################################
name = nettle
-version = 2.5
+version = 2.7.1
release = 1
groups = System/Libraries
requires
gmp-devel
m4
- openssl-devel
end
configure_options += \
###############################################################################
name = pcre
-version = 8.32
+version = 8.33
release = 1
compat_version = 8.21
make %{PARALLELISMFLAGS}
end
+ test
+ make check
+
+ cd %{DIR_SRC}/%{name}-%{compat_version}
+ make check
+ end
+
install_cmds
cd %{DIR_SRC}/%{name}-%{compat_version}
install -m 755 .libs/libpcre.so.0.0.1 %{BUILDROOT}%{libdir}
###############################################################################
name = samba
-version = 3.6.5
-release = 2
+version = 3.6.16
+release = 1
-maintainer = Christian Schmidt <christian.schmidt@ipfire.org>
groups = Networking/Daemons
url = http://www.samba.org/
license = GPLv3+ and LGPLv3+
--- /dev/null
+diff -up tftp-hpa-0.49/tftpd/remap.c.zero tftp-hpa-0.49/tftpd/remap.c
+--- tftp-hpa-0.49/tftpd/remap.c.zero 2008-10-20 18:08:31.000000000 -0400
++++ tftp-hpa-0.49/tftpd/remap.c 2008-11-25 11:41:09.000000000 -0500
+@@ -286,6 +286,7 @@ struct rule *parserulefile(FILE * f)
+ int lineno = 0;
+ int err = 0;
+
++ memset(this_rule, '\0', sizeof(struct rule));
+ while (lineno++, fgets(line, MAXLINE, f)) {
+ rv = parseline(line, this_rule, lineno);
+ if (rv < 0)
+@@ -294,6 +295,7 @@ struct rule *parserulefile(FILE * f)
+ *last_rule = this_rule;
+ last_rule = &this_rule->next;
+ this_rule = tfmalloc(sizeof(struct rule));
++ memset(this_rule, '\0', sizeof(struct rule));
+ }
+ }
+
--- /dev/null
+diff -up tftp-hpa-0.48/tftp-xinetd.tftpboot tftp-hpa-0.48/tftp-xinetd
+--- tftp-hpa-0.48/tftp-xinetd.tftpboot 2007-01-31 00:51:05.000000000 +0100
++++ tftp-hpa-0.48/tftp-xinetd 2008-05-20 12:05:53.000000000 +0200
+@@ -10,7 +10,7 @@ service tftp
+ wait = yes
+ user = root
+ server = /usr/sbin/in.tftpd
+- server_args = -s /tftpboot
++ server_args = -s /var/lib/tftpboot
+ disable = yes
+ per_source = 11
+ cps = 100 2
+diff -up tftp-hpa-0.48/README.security.tftpboot tftp-hpa-0.48/README.security
+--- tftp-hpa-0.48/README.security.tftpboot 2008-05-29 17:36:32.000000000 +0200
++++ tftp-hpa-0.48/README.security 2008-05-29 17:37:21.000000000 +0200
+@@ -17,10 +17,10 @@ probably the following:
+
+ 1. Create a separate "tftpd" user and group only used for tftpd;
+ 2. Have all your boot files in a single directory tree (usually called
+- /tftpboot).
+-3. Specify "-p -u tftpd -s /tftpboot" on the tftpd command line; if
++ /var/lib/tftpboot).
++3. Specify "-p -u tftpd -s /var/lib/tftpboot" on the tftpd command line; if
+ you want clients to be able to create files use
+- "-p -c -U 002 -u tftpd -s /tftpboot" (replace 002 with whatever
++ "-p -c -U 002 -u tftpd -s /var/lib/tftpboot" (replace 002 with whatever
+ umask is appropriate for your setup.)
+
+ =======================================
+@@ -40,12 +40,12 @@ directly. Thus, if your /etc/inetd.conf
+ line):
+
+ tftp dgram udp wait root /usr/sbin/tcpd
+-/usr/sbin/in.tftpd -s /tftpboot -r blksize
++/usr/sbin/in.tftpd -s /var/lib/tftpboot -r blksize
+
+ ... it's better to change to ...
+
+ tftp dgram udp wait root /usr/sbin/in.tftpd
+-in.tftpd -s /tftpboot -r blksize
++in.tftpd -s /var/lib/tftpboot -r blksize
+
+ You should make sure that you are using "wait" option in tftpd; you
+ also need to have tftpd spawned as root in order for chroot (-s) to
+diff -up tftp-hpa-0.48/tftpd/sample.rules.tftpboot tftp-hpa-0.48/tftpd/sample.rules
+--- tftp-hpa-0.48/tftpd/sample.rules.tftpboot 2008-05-29 17:38:46.000000000 +0200
++++ tftp-hpa-0.48/tftpd/sample.rules 2008-05-29 17:38:05.000000000 +0200
+@@ -30,5 +30,5 @@ rg \\ / # Convert backslashes to slash
+ rg \# @ # Convert hash marks to @ signs
+ rg /../ /..no../ # Convert /../ to /..no../
+ e ^ok/ # These are always ok
+-r ^[^/] /tftpboot/\0 # Convert non-absolute files
++r ^[^/] /var/lib/tftpboot/\0 # Convert non-absolute files
+ a \.pvt$ # Reject requests for private files
--- /dev/null
+diff -up tftp-hpa-0.49/tftpd/tftpd.c.chk_retcodes tftp-hpa-0.49/tftpd/tftpd.c
+--- tftp-hpa-0.49/tftpd/tftpd.c.chk_retcodes 2009-01-15 15:28:50.000000000 +0100
++++ tftp-hpa-0.49/tftpd/tftpd.c 2009-01-15 15:31:36.000000000 +0100
+@@ -932,7 +932,10 @@ int main(int argc, char **argv)
+ exit(EX_OSERR);
+ }
+ #ifdef __CYGWIN__
+- chdir("/"); /* Cygwin chroot() bug workaround */
++ if (chdir("/") < 0) { /* Cygwin chroot() bug workaround */
++ syslog(LOG_ERR, "chroot: %m");
++ exit(EX_OSERR);
++ }
+ #endif
+ }
+ #ifdef HAVE_SETREGID
--- /dev/null
+diff -up tftp-hpa-0.49/config.h.cmd_arg tftp-hpa-0.49/config.h
+--- tftp-hpa-0.49/config.h.cmd_arg 2010-04-19 15:29:10.567331454 +0200
++++ tftp-hpa-0.49/config.h 2010-04-20 07:33:03.133232772 +0200
+@@ -291,6 +291,7 @@ typedef int socklen_t;
+ /* Prototypes for libxtra functions */
+
+ void *xmalloc(size_t);
++void *xrealloc(void *, size_t);
+ char *xstrdup(const char *);
+
+ #ifndef HAVE_BSD_SIGNAL
+diff -up tftp-hpa-0.49/configure.in.cmd_arg tftp-hpa-0.49/configure.in
+--- tftp-hpa-0.49/configure.in.cmd_arg 2008-10-21 00:08:31.000000000 +0200
++++ tftp-hpa-0.49/configure.in 2010-04-19 11:05:12.387340698 +0200
+@@ -152,6 +152,7 @@ OBJROOT=`pwd`
+
+ XTRA=false
+ PA_SEARCH_LIBS_AND_ADD(xmalloc, iberty)
++PA_SEARCH_LIBS_AND_ADD(xrealloc, iberty)
+ PA_SEARCH_LIBS_AND_ADD(xstrdup, iberty)
+ PA_SEARCH_LIBS_AND_ADD(bsd_signal, bsd, bsdsignal)
+ PA_SEARCH_LIBS_AND_ADD(getopt_long, getopt, getopt_long)
+diff -up tftp-hpa-0.49/lib/xrealloc.c.cmd_arg tftp-hpa-0.49/lib/xrealloc.c
+--- tftp-hpa-0.49/lib/xrealloc.c.cmd_arg 2010-04-19 11:05:12.387340698 +0200
++++ tftp-hpa-0.49/lib/xrealloc.c 2010-04-19 11:05:12.387340698 +0200
+@@ -0,0 +1,20 @@
++/*
++ * xrealloc.c
++ *
++ * Simple error-checking version of realloc()
++ *
++ */
++
++#include "config.h"
++
++void *xrealloc(void *ptr, size_t size)
++{
++ void *p = realloc(ptr, size);
++
++ if (!p) {
++ fprintf(stderr, "Out of memory!\n");
++ exit(128);
++ }
++
++ return p;
++}
+diff -up tftp-hpa-0.49/tftp/main.c.cmd_arg tftp-hpa-0.49/tftp/main.c
+--- tftp-hpa-0.49/tftp/main.c.cmd_arg 2008-10-21 00:08:31.000000000 +0200
++++ tftp-hpa-0.49/tftp/main.c 2010-04-19 11:05:12.389329337 +0200
+@@ -89,11 +89,14 @@ int connected;
+ const struct modes *mode;
+ #ifdef WITH_READLINE
+ char *line = NULL;
++char *remote_pth = NULL;
+ #else
+ char line[LBUFLEN];
++char remote_pth[LBUFLEN];
+ #endif
+ int margc;
+-char *margv[20];
++char **margv;
++int sizeof_margv=0;
+ const char *prompt = "tftp> ";
+ sigjmp_buf toplevel;
+ void intr(int);
+@@ -379,6 +382,10 @@ static void getmoreargs(const char *part
+ free(line);
+ line = NULL;
+ }
++ if (remote_pth) {
++ free(remote_pth);
++ remote_pth = NULL;
++ }
+ line = xmalloc(len + elen + 1);
+ strcpy(line, partial);
+ strcpy(line + len, eline);
+@@ -535,6 +542,7 @@ void put(int argc, char *argv[])
+ int fd;
+ int n, err;
+ char *cp, *targ;
++ long dirlen, namelen, lastlen=0;
+
+ if (argc < 2) {
+ getmoreargs("send ", "(file) ");
+@@ -588,9 +596,22 @@ void put(int argc, char *argv[])
+ }
+ /* this assumes the target is a directory */
+ /* on a remote unix system. hmmmm. */
+- cp = strchr(targ, '\0');
+- *cp++ = '/';
++ dirlen = strlen(targ)+1;
++#ifdef WITH_READLINE
++ remote_pth = xmalloc(dirlen+1);
++#endif
++ strcpy(remote_pth, targ);
++ remote_pth[dirlen-1] = '/';
++ cp = remote_pth + dirlen;
+ for (n = 1; n < argc - 1; n++) {
++#ifdef WITH_READLINE
++ namelen = strlen(tail(argv[n])) + 1;
++ if (namelen > lastlen) {
++ remote_pth = xrealloc(remote_pth, dirlen + namelen + 1);
++ cp = remote_pth + dirlen;
++ lastlen = namelen;
++ }
++#endif
+ strcpy(cp, tail(argv[n]));
+ fd = open(argv[n], O_RDONLY | mode->m_openflags);
+ if (fd < 0) {
+@@ -600,9 +621,9 @@ void put(int argc, char *argv[])
+ }
+ if (verbose)
+ printf("putting %s to %s:%s [%s]\n",
+- argv[n], hostname, targ, mode->m_mode);
++ argv[n], hostname, remote_pth, mode->m_mode);
+ sa_set_port(&peeraddr, port);
+- tftp_sendfile(fd, targ, mode->m_mode);
++ tftp_sendfile(fd, remote_pth, mode->m_mode);
+ }
+ }
+
+@@ -801,6 +822,10 @@ static void command(void)
+ free(line);
+ line = NULL;
+ }
++ if (remote_pth) {
++ free(remote_pth);
++ remote_pth = NULL;
++ }
+ line = readline(prompt);
+ if (!line)
+ exit(0); /* EOF */
+@@ -872,7 +897,13 @@ struct cmd *getcmd(char *name)
+ static void makeargv(void)
+ {
+ char *cp;
+- char **argp = margv;
++ char **argp;
++
++ if (!sizeof_margv) {
++ sizeof_margv = 20;
++ margv = xmalloc(sizeof_margv * sizeof(char *));
++ }
++ argp = margv;
+
+ margc = 0;
+ for (cp = line; *cp;) {
+@@ -882,6 +913,11 @@ static void makeargv(void)
+ break;
+ *argp++ = cp;
+ margc += 1;
++ if (margc == sizeof_margv) {
++ sizeof_margv += 20;
++ margv = xrealloc(margv, sizeof_margv * sizeof(char *));
++ argp = margv + margc;
++ }
+ while (*cp != '\0' && !isspace(*cp))
+ cp++;
+ if (*cp == '\0')
--- /dev/null
+--- tftp-hpa-5.2/tftp/main.c 2013-04-19 09:34:09.737410319 +0200
++++ tftp-hpa-5.2/tftp/main.c 2013-04-19 09:42:53.559946374 +0200
+@@ -195,9 +195,11 @@
+ {
+ fprintf(stderr,
+ #ifdef HAVE_IPV6
+- "Usage: %s [-4][-6][-v][-l][-m mode] [host [port]] [-c command]\n",
++ "Usage: %s [-4][-6][-v][-V][-l][-m mode] [-R port:port] "
++ "[host [port]] [-c command]\n",
+ #else
+- "Usage: %s [-v][-l][-m mode] [host [port]] [-c command]\n",
++ "Usage: %s [-v][-V][-l][-m mode] [-R port:port] "
++ "[host [port]] [-c command]\n",
+ #endif
+ program);
+ exit(errcode);
+--- tftp-hpa-5.2/tftpd/tftpd.8.in 2012-11-20 09:43:46.000000000 +0100
++++ tftp-hpa-5.2/tftpd/tftpd.8.in 2013-04-19 09:44:37.399057279 +0200
+@@ -155,7 +155,7 @@
+ .B utimeout
+ option is negotiated. The default is 1000000 (1 second.)
+ .TP
+-\fB\-\-mapfile\fP \fIremap-file\fP, \fB\-m\fP \fIremap-file\fP
++\fB\-\-map\-file\fP \fIremap-file\fP, \fB\-m\fP \fIremap-file\fP
+ Specify the use of filename remapping. The
+ .I remap-file
+ is a file containing the remapping rules. See the section on filename
--- /dev/null
+diff -up tftp-hpa-0.49/tftpd/tftpd.c.tzfix tftp-hpa-0.49/tftpd/tftpd.c
+--- tftp-hpa-0.49/tftpd/tftpd.c.tzfix 2008-10-20 18:08:31.000000000 -0400
++++ tftp-hpa-0.49/tftpd/tftpd.c 2008-11-25 11:45:27.000000000 -0500
+@@ -350,6 +350,14 @@ int main(int argc, char **argv)
+ const char *pidfile = NULL;
+ u_short tp_opcode;
+
++ time_t my_time = 0;
++ struct tm* p_tm;
++ char envtz[10];
++ my_time = time(NULL);
++ p_tm = localtime(&my_time);
++ snprintf(envtz, sizeof(envtz) - 1, "UTC%+d", (p_tm->tm_gmtoff * -1)/3600);
++ setenv("TZ", envtz, 0);
++
+ /* basename() is way too much of a pain from a portability standpoint */
+
+ p = strrchr(argv[0], '/');
--- /dev/null
+diff -urN tftp-hpa-0.49.orig/tftp/tftp.c tftp-hpa-0.49/tftp/tftp.c
+--- tftp-hpa-0.49.orig/tftp/tftp.c 2008-10-20 18:08:31.000000000 -0400
++++ tftp-hpa-0.49/tftp/tftp.c 2009-08-05 09:47:18.072585848 -0400
+@@ -279,15 +279,16 @@
+ struct tftphdr *tp, const char *mode)
+ {
+ char *cp;
++ size_t len;
+
+ tp->th_opcode = htons((u_short) request);
+ cp = (char *)&(tp->th_stuff);
+- strcpy(cp, name);
+- cp += strlen(name);
+- *cp++ = '\0';
+- strcpy(cp, mode);
+- cp += strlen(mode);
+- *cp++ = '\0';
++ len = strlen(name) + 1;
++ memcpy(cp, name, len);
++ cp += len;
++ len = strlen(mode) + 1;
++ memcpy(cp, mode, len);
++ cp += len;
+ return (cp - (char *)tp);
+ }
+
--- /dev/null
+diff -up tftp-hpa-0.49/tftp/tftp.c.stats tftp-hpa-0.49/tftp/tftp.c
+--- tftp-hpa-0.49/tftp/tftp.c.stats 2011-01-03 15:38:34.217918067 +0100
++++ tftp-hpa-0.49/tftp/tftp.c 2011-01-03 15:38:37.498917014 +0100
+@@ -400,8 +400,8 @@ static void printstats(const char *direc
+ {
+ double delta;
+
+- delta = (tstop.tv_sec + (tstop.tv_usec / 100000.0)) -
+- (tstart.tv_sec + (tstart.tv_usec / 100000.0));
++ delta = (tstop.tv_sec + (tstop.tv_usec / 1000000.0)) -
++ (tstart.tv_sec + (tstart.tv_usec / 1000000.0));
+ if (verbose) {
+ printf("%s %lu bytes in %.1f seconds", direction, amount, delta);
+ printf(" [%.0f bit/s]", (amount * 8.) / delta);
--- /dev/null
+diff -up tftp-hpa-5.2/tftpd/recvfrom.c.test tftp-hpa-5.2/tftpd/recvfrom.c
+--- tftp-hpa-5.2/tftpd/recvfrom.c.test 2011-12-11 23:13:52.000000000 +0100
++++ tftp-hpa-5.2/tftpd/recvfrom.c 2012-01-04 10:05:17.852042256 +0100
+@@ -149,16 +149,16 @@ myrecvfrom(int s, void *buf, int len, un
+
+ /* Try to enable getting the return address */
+ #ifdef IP_RECVDSTADDR
+- if (from->sa_family == AF_INET)
++ if (from->sa_family == AF_INET || !from->sa_family)
+ setsockopt(s, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on));
+ #endif
+ #ifdef IP_PKTINFO
+- if (from->sa_family == AF_INET)
++ if (from->sa_family == AF_INET || !from->sa_family)
+ setsockopt(s, IPPROTO_IP, IP_PKTINFO, &on, sizeof(on));
+ #endif
+ #ifdef HAVE_IPV6
+ #ifdef IPV6_RECVPKTINFO
+- if (from->sa_family == AF_INET6)
++ if (from->sa_family == AF_INET6 || !from->sa_family)
+ setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on));
+ #endif
+ #endif
--- /dev/null
+[Unit]
+Description=Tftp Server
+
+[Service]
+ExecStart=/usr/sbin/in.tftpd -u tftp -s /var/lib/tftpboot
+StandardInput=socket
--- /dev/null
+[Unit]
+Description=Tftp Server Activation Socket
+
+[Socket]
+ListenDatagram=69
+
+[Install]
+WantedBy=sockets.target
--- /dev/null
+###############################################################################
+# IPFire.org - An Open Source Firewall Solution #
+# Copyright (C) - IPFire Development Team <info@ipfire.org> #
+###############################################################################
+
+name = tftp
+version = 5.2
+release = 1
+
+groups = Applications/Network
+url = http://www.kernel.org/pub/software/network/tftp/
+license = BSD
+summary = Client and server for the Trivial File Transfer Protocol (TFTP).
+
+description
+ The Trivial File Transfer Protocol (TFTP) is normally used only for
+ booting diskless workstations.
+end
+
+thisapp = %{name}-hpa-%{version}
+
+source_dl = http://www.kernel.org/pub/software/network/tftp/tftp-hpa/
+
+
+build
+ requires
+ autoconf
+ readline-devel
+ shadow-utils
+ end
+
+ prepare_cmds
+ autoreconf -vfi
+ %{create_user}
+ end
+
+ make_install_targets += \
+ INSTALLROOT=%{BUILDROOT}
+
+ install_cmds
+ mkdir -pv %{BUILDROOT}%{sharedstatedir}/tftpboot
+ chown tftp:tftp %{BUILDROOT}%{sharedstatedir}/tftpboot
+ end
+end
+
+create_user
+ getent group tftp >/dev/null || /usr/sbin/groupadd -r tftp
+ getent passwd tftp >/dev/null || /usr/sbin/useradd -r -g tftp \
+ -d %{sharedstatedir}/tftpboot -s /sbin/nologin tftp
+end
+
+packages
+ package %{name}
+ requires
+ %{name}-client = %{thisver}
+ %{name}-server = %{thisver}
+ end
+ end
+
+ package %{name}-client
+ summary = A client programm for the Trivial File Transfer Protocol (TFTP).
+ description
+ The tftp-client package provides the user
+ interface for TFTP, which allows users to transfer files to and from a
+ remote machine. This program and TFTP provide very little security,
+ and should not be enabled unless it is expressly needed.
+ end
+
+ files
+ %{bindir}/tftp
+ %{mandir}/man1/tftp*
+ end
+ end
+
+ package %{name}-server
+ summary = A Trivial File Transfer Protocol (TFTP) server.
+ description
+ The tftp-server package provides the
+ server for TFTP, which allows users to transfer files to and from a
+ remote machine. TFTP provides very little security, and should not be
+ enabled unless it is expressly needed.
+ end
+
+ prerequires += \
+ shadow-utils
+
+ datafiles
+ %{sharedstatedir}/tftpboot
+ end
+
+ files
+ %{sbindir}/in.tftpd
+ %{mandir}/man8/*
+ %{unitdir}/tftp.*
+ %{sharedstatedir}/tftpboot
+ end
+
+ script prein
+ %{create_user}
+ end
+
+ script postin
+ systemctl daemon-reload >/dev/null 2>&1 || :
+ end
+
+ script preun
+ systemctl --no-reload disable tftp.socket >/dev/null 2>&1 || :
+ systemctl stop tftp.socket >/dev/null 2>&1 || :
+ systemctl stop tftp.service >/dev/null 2>&1 || :
+ end
+
+ script postun
+ systemctl daemon-reload >/dev/null 2>&1 || :
+ end
+
+ script postup
+ systemctl daemon-reload >/dev/null 2>&1 || :
+ systemctl try-restart tftp.service >/dev/null 2>&1 || :
+ end
+ end
+
+ package %{name}-debuginfo
+ template DEBUGINFO
+ end
+end
###############################################################################
name = transmission
-version = 2.77
+version = 2.80
release = 1
groups = Internet/P2P