]> git.ipfire.org Git - ipfire-3.x.git/blame - gcc/patches/gcc-4.7.0-piepatch-20120518.patch
gcc: Fix typo in patch.
[ipfire-3.x.git] / gcc / patches / gcc-4.7.0-piepatch-20120518.patch
CommitLineData
4de56d3e
MT
1diff -Nur gcc-4.7.0-vanilla/configure gcc-4.7.0/configure
2--- gcc-4.7.0-vanilla/configure 2012-02-02 11:20:32.000000000 +0100
3+++ gcc-4.7.0/configure 2012-05-18 10:53:11.645610347 +0200
4@@ -671,6 +671,7 @@
3c926509
MT
5 CFLAGS
6 CC
4de56d3e 7 EXTRA_CONFIGARGS_LIBJAVA
3c926509 8+enable_esp
4de56d3e 9 target_subdir
3c926509
MT
10 host_subdir
11 build_subdir
4de56d3e
MT
12@@ -749,6 +750,7 @@
13 enable_libquadmath
14 enable_libquadmath_support
15 enable_libada
16+enable_esp
17 enable_libssp
18 enable_static_libjava
19 enable_bootstrap
20@@ -1467,6 +1469,11 @@
3c926509
MT
21 --disable-libquadmath-support
22 disable libquadmath support for Fortran
23 --enable-libada build libada directory
4de56d3e
MT
24+ --enable-esp Enable Stack protector, Position independent
25+ executable as default if we have suppot for it when
26+ compiling and link with -z relro and -z now as
27+ default. Linux targets supported i*86, x86_64,
28+ x86_x32, powerpc, powerpc64, ia64 and arm.
3c926509 29 --enable-libssp build libssp directory
4de56d3e
MT
30 --enable-static-libjava[=ARG]
31 build static libjava [default=no]
32@@ -2985,6 +2992,24 @@
3c926509
MT
33 noconfigdirs="$noconfigdirs gnattools"
34 fi
35
36+# Check whether --enable-esp was given and target have the support.
4de56d3e
MT
37+# Check whether --enable-esp was given.
38+if test "${enable_esp+set}" = set; then :
39+ enableval=$enable_esp;
3c926509 40+ case $target in
4de56d3e 41+ i?86*-*-linux* | x86_??*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*)
3c926509
MT
42+ enable_esp=yes
43+ ;;
44+ *)
4de56d3e
MT
45+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** --enable-esp is not supported on this $target target." >&5
46+$as_echo "$as_me: WARNING: *** --enable-esp is not supported on this $target target." >&2;}
3c926509
MT
47+ ;;
48+ esac
49+
4de56d3e
MT
50+fi
51+
3c926509
MT
52+
53+
54 # Check whether --enable-libssp was given.
55 if test "${enable_libssp+set}" = set; then :
56 enableval=$enable_libssp; ENABLE_LIBSSP=$enableval
4de56d3e
MT
57@@ -14422,6 +14447,11 @@
58 CFLAGS="$saved_CFLAGS"
3c926509
MT
59 fi
60
4de56d3e
MT
61+# Disable -fstack-protector on stage1
62+if test x$enable_esp = xyes; then
63+ stage1_cflags="$stage1_cflags -fno-stack-protector"
1d4e1316
MT
64+fi
65+
1d4e1316 66
1d4e1316 67
4de56d3e
MT
68 # Enable --enable-checking in stage1 of the compiler.
69diff -Nur gcc-4.7.0-vanilla/gcc/esp.h gcc-4.7.0/gcc/esp.h
70--- gcc-4.7.0-vanilla/gcc/esp.h 1970-01-01 01:00:00.000000000 +0100
71+++ gcc-4.7.0/gcc/esp.h 2012-05-18 10:54:28.787077373 +0200
3c926509
MT
72@@ -0,0 +1,145 @@
73+/* License terms see GNU GENERAL PUBLIC LICENSE Version 3.
1d4e1316 74+ * Version 20120403.2
3c926509
MT
75+ * Magnus Granberg (Zorry) <zorry@gentoo.org> */
76+#ifndef GCC_ESP_H
77+#define GCC_ESP_H
78+
79+/* This file will add -fstack-protector-all, -fPIE, -pie and -z now
80+ as default if the defines and the spec allow it.
81+ Added a hack for gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass
82+ to support older hardened GCC patches and we don't need to change the code on gcc-specs-* and _filter-hardened.
83+ This will add some unsupported upstream commands options as -nopie and -nonow.
84+ -D__KERNEL__ is added so we don't have -fPIE, -pie and -fstack-protector-all when building kernels.
85+ ESP_CC1_SPEC is added to CC1_SPEC.
86+ ESP_CC1_STRICT_OVERFLOW_SPEC is added so we don't disable the strict-overflow check.
87+ ESP_LINK_PIE_CHECK_SPEC check for -pie, -p, -pg, -profile and -static.
1d4e1316 88+ ENABLE_CRTBEGINP add support for crtbeginP.o, build -static with -fPIE or -fpie.
3c926509
MT
89+*/
90+#ifdef ENABLE_ESP
91+
92+ /* Hack to support gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass */
93+ #define ESP_CC1_SPEC " %(esp_cc1_ssp) %(esp_cc1_pie) %(esp_cc1_strict_overflow)"
94+ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP )
95+ #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: }}"
96+ #else
97+ #define ESP_CC1_SSP_SPEC ""
98+ #endif
99+ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP )
100+ #define ESP_CC1_PIE_SPEC "%{!nopie: }"
101+ #else
102+ #define ESP_CC1_PIE_SPEC ""
103+ #endif
104+ #define ESP_CC1_STRICT_OVERFLOW_SPEC "%{!fstrict-overflow:%{!fno-strict-overflow: -fno-strict-overflow}}"
105+
106+ /* ESP_LINK_SPEC is added to LINK_PIE_SPEC if esp is enable
107+ -z now will be added if we don't have -vanilla spec. We do a -pie incompatible check
108+ Don't remove the specs in the end */
109+ #define ESP_LINK_SPEC "%(esp_link_now) %(esp_link_pie_check) "
110+ #define ESP_LINK_NOW_SPEC "%{!nonow:-z now}"
111+
112+ /* We use ESP_COMMAND_OPTIONS_SPEC to add pie command-line options. */
113+ #define ESP_COMMAND_OPTIONS_SPEC "%{!D__KERNEL__:%{!nopie:%(esp_options_pie) %(esp_link_pie)}}"
114+
115+ /* ESP_OPTIONS_SPEC is added to the compiler spec in gcc/gcc.c */
116+ #define ESP_OPTIONS_SPEC "%(esp_options_ssp)"
117+
118+ /* ESP_CPP_OPTIONS_SPEC is added to the cpp_options spec in gcc/gcc.c
119+ For precompiling headers. */
120+ #define ESP_CPP_OPTIONS_SPEC "%(esp_options_ssp)"
121+
122+ /* This will add -fstack-protector-all if we don't have -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector
123+ -fstack-protector-all and we have EFAULT_SSP or EFAULT_PIE_SSP defined. */
1d4e1316 124+ #if ( defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) ) && defined ( ENABLE_ESP_SSP )
3c926509
MT
125+ #define ESP_OPTIONS_SSP_SPEC \
126+ "%{!D__KERNEL__:%{!nostdlib:%{!nodefaultlibs: %{!fno-stack-protector: \
127+ %{!fstack-protector:%{!fstack-protector-all:-fstack-protector-all}}}}}}"
128+ #else
129+ #define ESP_OPTIONS_SSP_SPEC ""
130+ #endif
131+
132+ /* If EFAULT_PIE or EFAULT_PIE_SSP is defined we will add -fPIE -pie */
133+ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP )
134+
135+ /* This will add -fPIE if we don't have -pie -fpic -fPIC -fpie -fPIE -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static
136+ -nostdlib -nostartfiles. */
1d4e1316
MT
137+ /* With ENABLE_CRTBEGINP we don't need to check for -static */
138+ #ifdef ENABLE_CRTBEGINP
3c926509
MT
139+ #define ESP_OPTIONS_PIE_SPEC \
140+ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \
141+ %{!shared: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }"
142+ #else
143+ #define ESP_OPTIONS_PIE_SPEC \
144+ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \
145+ %{!shared: %{!static: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }}"
146+ #endif
147+
148+ /* This will add -pie if we don't have -pie -A -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static -r -nostdlib
149+ -nostartfiles */
1d4e1316 150+ /* With ENABLE_CRTBEGINP we don't need to check for -static
3c926509 151+ and we add -pie only to get the start and endfiles. -pie will not go to the linker. */
1d4e1316 152+ #ifdef ENABLE_CRTBEGINP
3c926509
MT
153+ #define ESP_LINK_PIE_SPEC \
154+ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!r: \
155+ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}"
156+ #else
157+ #define ESP_LINK_PIE_SPEC \
158+ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r: \
159+ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}}"
160+ #endif
161+
162+ /* This will check if -pie is set when (-static) -pg -p -profile. If set it will make gcc print out
163+ "-pie and (static)|pg|p|profile are incompatible when linking" */
1d4e1316
MT
164+ /* With ENABLE_CRTBEGINP we don't need to check for -static */
165+ #ifdef ENABLE_CRTBEGINP
3c926509
MT
166+ #define ESP_LINK_PIE_CHECK_SPEC \
167+ "%{pie:%{pg|p|profile:%e-pie and -pg|p|profile are incompatible when linking}}"
168+ #else
169+ #define ESP_LINK_PIE_CHECK_SPEC \
170+ "%{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible when linking}}"
171+ #endif
172+
173+ /* We don't pass -pie to the linker when -static. */
1d4e1316 174+ #ifdef ENABLE_CRTBEGINP
3c926509
MT
175+ #define LINK_PIE_SPEC "%{!static:%{pie:-pie}} %(esp_link)"
176+ #else
177+ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)"
178+ #endif
179+
180+ #else
181+ #define ESP_OPTIONS_PIE_SPEC ""
182+ #define ESP_LINK_PIE_CHECK_SPEC ""
183+ #define ESP_LINK_PIE_SPEC ""
184+ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)"
185+ #endif
186+
187+ /* We add extra spec name's to the EXTRA_SPECS list */
188+ #define ESP_EXTRA_SPECS \
189+ { "esp_cc1", ESP_CC1_SPEC }, \
190+ { "esp_cc1_pie", ESP_CC1_PIE_SPEC }, \
191+ { "esp_cc1_ssp", ESP_CC1_SSP_SPEC }, \
192+ { "esp_cc1_strict_overflow", ESP_CC1_STRICT_OVERFLOW_SPEC }, \
193+ { "esp_link", ESP_LINK_SPEC }, \
194+ { "esp_link_now", ESP_LINK_NOW_SPEC }, \
195+ { "esp_link_pie", ESP_LINK_PIE_SPEC }, \
196+ { "esp_link_pie_check", ESP_LINK_PIE_CHECK_SPEC }, \
197+ { "esp_command_options", ESP_COMMAND_OPTIONS_SPEC }, \
198+ { "esp_cpp_options", ESP_CPP_OPTIONS_SPEC }, \
199+ { "esp_options", ESP_OPTIONS_SPEC }, \
200+ { "esp_options_pie", ESP_OPTIONS_PIE_SPEC }, \
201+ { "esp_options_ssp", ESP_OPTIONS_SSP_SPEC }
202+
203+ static const char *esp_command_options_spec = ESP_COMMAND_OPTIONS_SPEC;
204+ static const char *cc1_spec = CC1_SPEC ESP_CC1_SPEC;
205+
206+#else /* If not ESP_ENABLE defined do this. */
207+
208+ #define ESP_OPTIONS_SPEC ""
209+ #define ESP_CPP_OPTIONS_SPEC ""
210+
211+ /* We add extra spec name's to the EXTRA_SPECS list */
212+ #define ESP_EXTRA_SPECS \
213+ { "esp_options", ESP_OPTIONS_SPEC }, \
214+ { "esp_cpp_options", ESP_CPP_OPTIONS_SPEC }
215+
216+#endif
217+#endif /* End GCC_ESP_H */
4de56d3e
MT
218diff -Nur gcc-4.7.0-vanilla/gcc/common.opt gcc-4.7.0/gcc/common.opt
219--- gcc-4.7.0-vanilla/gcc/common.opt 2012-02-01 10:20:32.000000000 +0100
220+++ gcc-4.7.0/gcc/common.opt 2012-05-18 10:56:19.708624714 +0200
221@@ -2268,6 +2268,9 @@
222 nodefaultlibs
223 Driver
224
225+nopie
226+Driver
227+
228 nostartfiles
229 Driver
230
231diff -Nur gcc-4.7.0-vanilla/gcc/config/gnu-user.h gcc-4.7.0/gcc/config/gnu-user.h
232--- gcc-4.7.0-vanilla/gcc/config/gnu-user.h 2011-04-28 18:49:49.000000000 +0200
233+++ gcc-4.7.0/gcc/config/gnu-user.h 2012-05-18 10:56:49.987593058 +0200
234@@ -41,7 +41,11 @@
235 provides part of the support for getting C++ file-scope static
236 object constructed before entering `main'. */
237
238-#if defined HAVE_LD_PIE
239+#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINP)
240+#define GNU_USER_TARGET_STARTFILE_SPEC \
241+ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} crti.o%s \
242+ %{static:%{pie:crtbeginP.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}"
243+#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINP)
244 #define GNU_USER_TARGET_STARTFILE_SPEC \
245 "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
246 crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
247diff -Nur gcc-4.7.0-vanilla/gcc/config/rs6000/linux64.h gcc-4.7.0/gcc/config/rs6000/linux64.h
248--- gcc-4.7.0-vanilla/gcc/config/rs6000/linux64.h 2012-03-12 17:16:51.000000000 +0100
249+++ gcc-4.7.0/gcc/config/rs6000/linux64.h 2012-05-18 10:57:30.248880643 +0200
250@@ -180,7 +180,7 @@
251 #endif
252
253 #define ASM_SPEC32 "-a32 \
254-%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
255+%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} \
256 %{memb} %{!memb: %{msdata=eabi: -memb}} \
257 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
258 %{mcall-freebsd: -mbig} \
259diff -Nur gcc-4.7.0-vanilla/gcc/config/rs6000/sysv4.h gcc-4.7.0/gcc/config/rs6000/sysv4.h
260--- gcc-4.7.0-vanilla/gcc/config/rs6000/sysv4.h 2011-04-11 20:46:05.000000000 +0200
261+++ gcc-4.7.0/gcc/config/rs6000/sysv4.h 2012-05-18 10:56:49.988593089 +0200
262@@ -785,7 +785,12 @@
263 %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
264 %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
265
266-#ifdef HAVE_LD_PIE
267+#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINP)
268+#define STARTFILE_LINUX_SPEC "\
269+%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
270+%{mnewlib:ecrti.o%s;:crti.o%s} \
271+%{static:%{pie:crtbeginP.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}"
272+#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINP)
273 #define STARTFILE_LINUX_SPEC "\
274 %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
275 %{mnewlib:ecrti.o%s;:crti.o%s} \
276diff -Nur gcc-4.7.0-vanilla/gcc/config.in gcc-4.7.0/gcc/config.in
277--- gcc-4.7.0-vanilla/gcc/config.in 2012-03-22 08:37:39.000000000 +0100
278+++ gcc-4.7.0/gcc/config.in 2012-05-18 10:53:34.954355771 +0200
279@@ -58,6 +58,12 @@
280 #endif
281
282
283+/* Define to 1 to enable crtbeginP.o. */
284+#ifndef USED_FOR_TARGET
285+#undef ENABLE_CRTBEGINP
286+#endif
287+
288+
289 /* Define to 1 to specify that we are using the BID decimal floating point
290 format instead of DPD */
291 #ifndef USED_FOR_TARGET
292@@ -77,6 +83,18 @@
293 #endif
294
295
296+/* Define to 1 to enable esp. */
297+#ifndef USED_FOR_TARGET
298+#undef ENABLE_ESP
299+#endif
300+
301+
302+/* Define to 1 to enable esp. */
303+#ifndef USED_FOR_TARGET
304+#undef ENABLE_ESP_SSP
305+#endif
306+
307+
308 /* Define to 1 to enable fixed-point arithmetic extension to C. */
309 #ifndef USED_FOR_TARGET
310 #undef ENABLE_FIXED_POINT
311diff -Nur gcc-4.7.0-vanilla/gcc/configure gcc-4.7.0/gcc/configure
312--- gcc-4.7.0-vanilla/gcc/configure 2012-03-08 14:54:54.000000000 +0100
313+++ gcc-4.7.0/gcc/configure 2012-05-18 10:53:11.651610539 +0200
314@@ -600,6 +600,8 @@
315
316 ac_subst_vars='LTLIBOBJS
317 LIBOBJS
318+enable_esp
319+enable_crtbeginP
320 enable_plugin
321 pluginlibs
322 CLOOGINC
323@@ -917,6 +919,7 @@
324 enable_plugin
325 enable_libquadmath_support
326 with_linker_hash_style
327+enable_esp
328 '
329 ac_precious_vars='build_alias
330 host_alias
331@@ -1630,6 +1633,11 @@
332 --enable-plugin enable plugin support
333 --disable-libquadmath-support
334 disable libquadmath support for Fortran
335+ --enable-esp Enable Stack protector, Position independent
336+ executable and Fortify_sources as default if we have
337+ suppot for it when compiling and link -z now as
338+ default. Linux targets supported i*86, x86_64,
339+ x86_x32, powerpc, powerpc64, ia64, mips and arm
340
341 Optional Packages:
342 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
343@@ -27404,6 +27412,113 @@
344
345 fi
346
347+# --------------
348+# Esp checks
349+# --------------
350+
351+# Check whether --enable-esp was given and target have the support.
352+# Check whether --enable-esp was given.
353+if test "${enable_esp+set}" = set; then :
354+ enableval=$enable_esp; set_enable_esp=$enableval
355+else
356+ set_enable_esp=no
357+fi
358+
359+if test $set_enable_esp = yes ; then
360+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $target support esp" >&5
361+$as_echo_n "checking if $target support esp... " >&6; }
362+if test $set_enable_esp = yes ; then
363+ case "$target" in
364+ i?86*-*-linux* | x86_??*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux* | mips*-*-linux*)
365+ enable_esp=yes
366+
367+$as_echo "#define ENABLE_ESP 1" >>confdefs.h
368+
369+ ;;
370+ *)
371+ enable_esp=no
372+ ;;
373+ esac
374+else
375+ enable_esp=no
376+fi
377+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_esp" >&5
378+$as_echo "$enable_esp" >&6; }
379+fi
380+
381+if test $enable_esp = yes ; then
382+
383+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can default to use -fstack-protector" >&5
384+$as_echo_n "checking if we can default to use -fstack-protector... " >&6; }
385+ ssp_link_test=no
035e0ba7 386+ if test x$gcc_cv_libc_provides_ssp = xyes && test x$set_have_as_tls = xyes; then
4de56d3e
MT
387+ if $EGREP '^ *#[ ]*define[ ]+__UCLIBC__[ ]+1' \
388+ $target_header_dir/features.h > /dev/null; then
389+ if test -f $target_header_dir/bits/uClibc_config.h && \
390+ $EGREP '^ *#[ ]*define[ ]+__UCLIBC_SUBLEVEL__[ ]+([3-9][2-9]|[4-9][0-9])' \
391+ $target_header_dir/bits/uClibc_config.h > /dev/null && \
392+ $EGREP '^ *#[ ]*define[ ]+__UCLIBC_HAS_TLS__[ ]+1' \
393+ $target_header_dir/bits/uClibc_config.h > /dev/null; then
394+ ssp_link_test=yes
395+ fi
396+ else
397+ ssp_link_test=yes
398+ fi
399+ fi
400+ if test x$ssp_link_test=xyes ; then
401+ saved_CFLAGS="$CFLAGS"
402+ CFLAGS="$CFLAGS -O2 -fstack-protector -Werror"
403+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
404+/* end confdefs.h. */
405+
406+int
407+main ()
408+{
409+
410+ ;
411+ return 0;
412+}
413+_ACEOF
414+if ac_fn_c_try_link "$LINENO"; then :
415+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
416+$as_echo "yes" >&6; }; enable_esp_ssp=yes
417+else
418+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
419+$as_echo "no" >&6; }; enable_esp_ssp=no
420+fi
421+rm -f core conftest.err conftest.$ac_objext \
422+ conftest$ac_exeext conftest.$ac_ext
423+ CFLAGS="$saved_CFLAGS"
424+ else
425+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
426+$as_echo "no" >&6; }
427+ enable_esp_ssp=no
428+ fi
429+ if test $enable_esp_ssp = yes ; then
430+
431+$as_echo "#define ENABLE_ESP_SSP 1" >>confdefs.h
432+
433+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking checking for crtbeginP.o support" >&5
434+$as_echo_n "checking checking for crtbeginP.o support... " >&6; }
435+ case "$target" in
436+ ia64*-*-linux*)
437+ enable_crtbeginP=no ;;
438+ *-*-linux*)
439+ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then
440+ enable_crtbeginP=yes
441+
442+$as_echo "#define ENABLE_CRTBEGINP 1" >>confdefs.h
443+
444+ fi
445+ ;;
446+ *) enable_crtbeginP=no ;;
447+ esac
448+ fi
449+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_crtbeginP" >&5
450+$as_echo "$enable_crtbeginP" >&6; }
451+
452+fi
453+
454 # Configure the subdirectories
455 # AC_CONFIG_SUBDIRS($subdirs)
456
457diff -Nur gcc-4.7.0-vanilla/gcc/cp/lang-specs.h gcc-4.7.0/gcc/cp/lang-specs.h
458--- gcc-4.7.0-vanilla/gcc/cp/lang-specs.h 2011-03-06 17:27:57.000000000 +0100
459+++ gcc-4.7.0/gcc/cp/lang-specs.h 2012-05-18 10:54:40.279444906 +0200
460@@ -47,7 +47,7 @@
461 %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
462 cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
463 %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
464- %(cc1_options) %2\
465+ %(cc1_options) %(esp_options) %2\
466 %{!fsyntax-only:%{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\
467 %W{o*:--output-pch=%*}}%V}}}}",
468 CPLUSPLUS_CPP_SPEC, 0, 0},
469@@ -58,7 +58,7 @@
470 %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
471 cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
472 %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
473- %(cc1_options) %2\
474+ %(cc1_options) %(esp_options) %2\
475 %{!fsyntax-only:%(invoke_as)}}}}",
476 CPLUSPLUS_CPP_SPEC, 0, 0},
477 {".ii", "@c++-cpp-output", 0, 0, 0},
478diff -Nur gcc-4.7.0-vanilla/gcc/doc/invoke.texi gcc-4.7.0/gcc/doc/invoke.texi
479--- gcc-4.7.0-vanilla/gcc/doc/invoke.texi 2012-03-14 00:18:07.000000000 +0100
480+++ gcc-4.7.0/gcc/doc/invoke.texi 2012-05-18 10:56:59.156886298 +0200
481@@ -8479,6 +8479,11 @@
482 @opindex fstack-protector-all
483 Like @option{-fstack-protector} except that all functions are protected.
484
485+NOTE: When --enable-esp this option is enabled by default
486+for C, C++, ObjC, ObjC++, if neither @option{-fno-stack-protector}
487+or @option{-nostdlib} or @option{-nodefaultlibs} or
488+@option{-fstack-protector} are found.
489+
490 @item -fsection-anchors
491 @opindex fsection-anchors
492 Try to reduce the number of symbolic address calculations by using
493@@ -9457,6 +9462,12 @@
494 that were used to generate code (@option{-fpie}, @option{-fPIE},
495 or model suboptions) when you specify this option.
496
497+NOTE: When --enable-esp this option is enabled by default
498+for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE}
499+or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or
500+@option{-nostartfiles} or @option{-shared} or @option{-pg} or @option{-p}
501+are found.
502+
503 @item -rdynamic
504 @opindex rdynamic
505 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
506@@ -19125,6 +19136,11 @@
507 @code{__pie__} and @code{__PIE__}. The macros have the value 1
508 for @option{-fpie} and 2 for @option{-fPIE}.
509
510+NOTE: When --enable-esp this option is enabled by default
511+for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE}
512+or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or
513+@option{-nostartfiles} or @option{-shared} are found.
514+
515 @item -fno-jump-tables
516 @opindex fno-jump-tables
517 Do not use jump tables for switch statements even where it would be
518diff -Nur gcc-4.7.0-vanilla/gcc/gcc.c gcc-4.7.0/gcc/gcc.c
519--- gcc-4.7.0-vanilla/gcc/gcc.c 2012-02-28 18:31:38.000000000 +0100
520+++ gcc-4.7.0/gcc/gcc.c 2012-05-18 10:54:40.279444906 +0200
521@@ -45,6 +45,7 @@
3c926509 522 #include "opts.h"
4de56d3e 523 #include "params.h"
3c926509
MT
524 #include "vec.h"
525+#include "esp.h" /* for --enable-esp support */
4de56d3e 526 #include "filenames.h"
3c926509
MT
527
528 /* By default there is no special suffix for target executables. */
4de56d3e 529@@ -705,7 +706,9 @@
3c926509
MT
530
531 static const char *asm_debug;
532 static const char *cpp_spec = CPP_SPEC;
533+#ifndef ENABLE_ESP
534 static const char *cc1_spec = CC1_SPEC;
535+#endif
536 static const char *cc1plus_spec = CC1PLUS_SPEC;
537 static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
538 static const char *link_ssp_spec = LINK_SSP_SPEC;
4de56d3e 539@@ -767,7 +770,7 @@
3c926509
MT
540 static const char *cpp_options =
541 "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
542 %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\
543- %{undef} %{save-temps*:-fpch-preprocess}";
544+ %{undef} %{save-temps*:-fpch-preprocess} %(esp_cpp_options)";
545
546 /* This contains cpp options which are not passed when the preprocessor
547 output will be used by another program. */
4de56d3e 548@@ -946,9 +949,9 @@
3c926509
MT
549 %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
550 %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\
551 cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
552- %(cc1_options)}\
553+ %(cc1_options) %(esp_options)}\
554 %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
555- cc1 %(cpp_unique_options) %(cc1_options)}}}\
556+ cc1 %(cpp_unique_options) %(cc1_options) %(esp_options)}}}\
557 %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 1},
558 {"-",
559 "%{!E:%e-E or -x required when input is from standard input}\
4de56d3e 560@@ -971,7 +974,7 @@
3c926509
MT
561 %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
562 {".i", "@cpp-output", 0, 0, 0},
563 {"@cpp-output",
564- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
565+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(esp_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
566 {".s", "@assembler", 0, 0, 0},
567 {"@assembler",
568 "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
4de56d3e
MT
569@@ -1225,18 +1228,23 @@
570 INIT_STATIC_SPEC ("self_spec", &self_spec),
3c926509
MT
571 };
572
573-#ifdef EXTRA_SPECS /* additional specs needed */
574+/* EXTRA_SPECS needs to be defined */
575+#ifndef EXTRA_SPECS
576+#define EXTRA_SPECS
577+#endif
578+
579+/* EXTRA_SPECS and ESP_EXTRA_SPECS add additional specs */
580 /* Structure to keep track of just the first two args of a spec_list.
581- That is all that the EXTRA_SPECS macro gives us. */
582+ That is all that the EXTRA_SPECS and ESP_EXTRA_SPECS macro gives us. */
583 struct spec_list_1
584 {
585 const char *const name;
586 const char *const ptr;
587 };
588
589-static const struct spec_list_1 extra_specs_1[] = { EXTRA_SPECS };
590+/* ESP_EXTRA_SPECS before EXTRA_SPECS */
591+static const struct spec_list_1 extra_specs_1[] = { ESP_EXTRA_SPECS, EXTRA_SPECS };
592 static struct spec_list *extra_specs = (struct spec_list *) 0;
593-#endif
594
595 /* List of dynamically allocates specs that have been defined so far. */
596
4de56d3e 597@@ -1328,7 +1336,6 @@
3c926509
MT
598 if (verbose_flag)
599 fnotice (stderr, "Using built-in specs.\n");
600
601-#ifdef EXTRA_SPECS
602 extra_specs = XCNEWVEC (struct spec_list, ARRAY_SIZE (extra_specs_1));
603
604 for (i = ARRAY_SIZE (extra_specs_1) - 1; i >= 0; i--)
4de56d3e 605@@ -1341,7 +1348,6 @@
3c926509
MT
606 sl->ptr_spec = &sl->ptr;
607 next = sl;
608 }
609-#endif
610
611 for (i = ARRAY_SIZE (static_specs) - 1; i >= 0; i--)
612 {
4de56d3e 613@@ -6449,6 +6455,12 @@
3c926509
MT
614 gcc_exec_prefix = concat (gcc_exec_prefix, spec_machine, dir_separator_str,
615 spec_version, dir_separator_str, NULL);
616
617+#ifdef ENABLE_ESP
618+ /* Process ESP_COMMAND_OPTIONS_SPEC, adding any new options to the end
619+ of the command line. */
620+ do_self_spec (esp_command_options_spec);
621+#endif
622+
623 /* Now we have the specs.
624 Set the `valid' bits for switches that match anything in any spec. */
625
4de56d3e
MT
626diff -Nur gcc-4.7.0-vanilla/gcc/Makefile.in gcc-4.7.0/gcc/Makefile.in
627--- gcc-4.7.0-vanilla/gcc/Makefile.in 2012-03-07 11:59:56.000000000 +0100
628+++ gcc-4.7.0/gcc/Makefile.in 2012-05-18 10:54:00.275165546 +0200
629@@ -247,6 +247,14 @@
630 endif
3c926509
MT
631 endif
632
4de56d3e 633+# We don't want to compile the compiler with -fPIE, it make PCH fail.
3c926509
MT
634+enable_esp = @enable_esp@
635+ifeq ($(enable_esp),yes)
636+ESP_NOPIE_CFLAGS = -fno-PIE
637+else
638+ESP_NOPIE_CFLAGS=
639+endif
640+
4de56d3e
MT
641 # -------------------------------------------
642 # Programs which operate on the build machine
643 # -------------------------------------------
644@@ -975,12 +983,13 @@
3c926509
MT
645
646 # This is the variable actually used when we compile. If you change this,
647 # you probably want to update BUILD_CFLAGS in configure.ac
648-ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \
649+ALL_CFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) \
650 $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@
651
652 # The C++ version.
4de56d3e
MT
653-ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \
654- $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) $(WARN_CXXFLAGS) @DEFS@
655+ALL_CXXFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) \
656+ $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) \
657+ $(WARN_CXXFLAGS) @DEFS@
1d4e1316
MT
658
659 # Likewise. Put INCLUDES at the beginning: this way, if some autoconf macro
660 # puts -I options in CPPFLAGS, our include files in the srcdir will always
4de56d3e
MT
661@@ -1815,6 +1824,8 @@
662 echo GCC_CFLAGS = '$(GCC_CFLAGS)' >> tmp-libgcc.mvars
663 echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars
3c926509 664 echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars
4de56d3e
MT
665+ echo enable_esp = '$(enable_esp)' >> tmp-libgcc.mvars
666+ echo enable_crtbeginP = '@enable_crtbeginP@' >> tmp-libgcc.mvars
3c926509
MT
667
668 mv tmp-libgcc.mvars libgcc.mvars
669
4de56d3e
MT
670diff -Nur gcc-4.7.0-vanilla/gcc/objc/lang-specs.h gcc-4.7.0/gcc/objc/lang-specs.h
671--- gcc-4.7.0-vanilla/gcc/objc/lang-specs.h 2011-03-06 17:27:57.000000000 +0100
672+++ gcc-4.7.0/gcc/objc/lang-specs.h 2012-05-18 10:54:40.281444970 +0200
3c926509
MT
673@@ -30,9 +30,9 @@
674 %{traditional|traditional-cpp:\
675 %eGNU Objective C no longer supports traditional compilation}\
676 %{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
677- cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}\
678+ cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}}\
679 %{!save-temps*:%{!no-integrated-cpp:\
680- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}}\
681+ cc1obj %(cpp_unique_options) %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}}}\
682 %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
683 {"@objective-c-header",
684 "%{E|M|MM:cc1obj -E %{traditional|traditional-cpp:-traditional-cpp}\
685@@ -41,18 +41,18 @@
686 %{traditional|traditional-cpp:\
687 %eGNU Objective C no longer supports traditional compilation}\
688 %{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
689- cc1obj -fpreprocessed %b.mi %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
690+ cc1obj -fpreprocessed %b.mi %(cc1_options)%(esp_options) %{print-objc-runtime-info} %{gen-decls}\
691 -o %g.s %{!o*:--output-pch=%i.gch}\
692 %W{o*:--output-pch=%*}%V}\
693 %{!save-temps*:%{!no-integrated-cpp:\
694- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
695+ cc1obj %(cpp_unique_options) %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\
696 -o %g.s %{!o*:--output-pch=%i.gch}\
697 %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0},
698 {".mi", "@objective-c-cpp-output", 0, 0, 0},
699 {"@objective-c-cpp-output",
700- "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
701+ "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\
702 %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
703 {"@objc-cpp-output",
704 "%nobjc-cpp-output is deprecated; please use objective-c-cpp-output instead\n\
705- %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
706+ %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\
707 %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
4de56d3e
MT
708diff -Nur gcc-4.7.0-vanilla/gcc/objcp/lang-specs.h gcc-4.7.0/gcc/objcp/lang-specs.h
709--- gcc-4.7.0-vanilla/gcc/objcp/lang-specs.h 2011-03-06 17:27:57.000000000 +0100
710+++ gcc-4.7.0/gcc/objcp/lang-specs.h 2012-05-18 10:54:40.281444969 +0200
3c926509
MT
711@@ -36,7 +36,7 @@
712 %(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
713 cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
714 %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
715- %(cc1_options) %2\
716+ %(cc1_options) %(esp_options) %2\
717 -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
718 CPLUSPLUS_CPP_SPEC, 0, 0},
719 {"@objective-c++",
720@@ -46,16 +46,16 @@
721 %(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
722 cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
723 %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
724- %(cc1_options) %2\
725+ %(cc1_options) %(esp_options) %2\
726 %{!fsyntax-only:%(invoke_as)}}}}",
727 CPLUSPLUS_CPP_SPEC, 0, 0},
728 {".mii", "@objective-c++-cpp-output", 0, 0, 0},
729 {"@objective-c++-cpp-output",
730 "%{!M:%{!MM:%{!E:\
731- cc1objplus -fpreprocessed %i %(cc1_options) %2\
732+ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2\
733 %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
734 {"@objc++-cpp-output",
735 "%nobjc++-cpp-output is deprecated; please use objective-c++-cpp-output instead\n\
736 %{!M:%{!MM:%{!E:\
737- cc1objplus -fpreprocessed %i %(cc1_options) %2\
738+ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2\
739 %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
4de56d3e
MT
740diff -Nur gcc-4.7.0-vanilla/gcc/varasm.c gcc-4.7.0/gcc/varasm.c
741--- gcc-4.7.0-vanilla/gcc/varasm.c 2012-02-20 12:47:25.000000000 +0100
742+++ gcc-4.7.0/gcc/varasm.c 2012-05-18 10:55:21.633767441 +0200
743@@ -6186,7 +6186,11 @@
3c926509
MT
744 bool is_local;
745
746 is_local = targetm.binds_local_p (decl);
747- if (!flag_shlib)
748+ #ifdef ENABLE_ESP
749+ if (!flag_pic)
750+ #else
751+ if (!flag_shlib)
752+ #endif
753 {
754 if (is_local)
755 kind = TLS_MODEL_LOCAL_EXEC;
4de56d3e
MT
756diff -Nur gcc-4.7.0-vanilla/libgcc/Makefile.in gcc-4.7.0/libgcc/Makefile.in
757--- gcc-4.7.0-vanilla/libgcc/Makefile.in 2011-11-22 04:01:02.000000000 +0100
758+++ gcc-4.7.0/libgcc/Makefile.in 2012-05-18 10:54:00.276165578 +0200
759@@ -219,6 +219,17 @@
760 DECNUMINC =
3c926509
MT
761 endif
762
4de56d3e
MT
763+ifeq ($(enable_esp),yes)
764+ESP_NOPIE_CFLAGS = -fno-PIE
765+else
766+ESP_NOPIE_CFLAGS=
767+endif
768+
1d4e1316 769+# We add crtbeginP.o to the EXTRA_PARTS list if enable_crtbeginP = yes
4de56d3e 770+ifeq ($(enable_crtbeginP),yes)
1d4e1316 771+EXTRA_PARTS += crtbeginP.o
3c926509
MT
772+endif
773+
4de56d3e
MT
774 # Options to use when compiling libgcc2.a.
775 #
776 LIBGCC2_DEBUG_CFLAGS = -g
777@@ -279,7 +290,7 @@
778 CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
779 -finhibit-size-directive -fno-inline -fno-exceptions \
780 -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
781- -fno-stack-protector \
782+ -fno-stack-protector $(ESP_NOPIE_CFLAGS) \
783 $(INHIBIT_LIBC_CFLAGS)
784
785 # Extra flags to use when compiling crt{begin,end}.o.
786@@ -966,6 +977,13 @@
787 # This is a version of crtbegin for -static links.
788 crtbeginT$(objext): $(srcdir)/crtstuff.c
789 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O
3c926509
MT
790+
791+# This is a version of crtbegin for -static -fPIE links.
4de56d3e
MT
792+ifeq ($(enable_crtbeginP),yes)
793+crtbeginP$(objext): $(srcdir)/crtstuff.c
3c926509 794+ $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
4de56d3e 795+ -c $< -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O
3c926509
MT
796+endif
797 endif
798
4de56d3e
MT
799 ifeq ($(CUSTOM_CRTIN),)
800diff -Nur gcc-4.7.0-vanilla/Makefile.in gcc-4.7.0/Makefile.in
801--- gcc-4.7.0-vanilla/Makefile.in 2012-01-02 11:59:04.000000000 +0100
802+++ gcc-4.7.0/Makefile.in 2012-05-18 10:54:00.273165482 +0200
803@@ -362,9 +362,17 @@
3c926509
MT
804 BUILD_PREFIX = @BUILD_PREFIX@
805 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
806
807+# Some stuff don't compile with SSP
808+enable_esp = @enable_esp@
809+ifeq ($(enable_esp),yes)
810+ESP_NOSSP_CFLAGS = -fno-stack-protector
811+else
812+ESP_NOSSP_CFLAGS=
813+endif
814+
815 # Flags to pass to stage2 and later makes. They are defined
816 # here so that they can be overridden by Makefile fragments.
817-BOOT_CFLAGS= -g -O2
818+BOOT_CFLAGS= -g -O2 $(ESP_NOSSP_CFLAGS)
819 BOOT_LDFLAGS=
820 BOOT_ADAFLAGS=-gnatpg -gnata
821
4de56d3e 822@@ -410,9 +418,9 @@
3c926509
MT
823
824 CFLAGS = @CFLAGS@
825 LDFLAGS = @LDFLAGS@
826-LIBCFLAGS = $(CFLAGS)
827+LIBCFLAGS = $(CFLAGS) $(ESP_NOSSP_CFLAGS)
828 CXXFLAGS = @CXXFLAGS@
829-LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
830+LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates $(ESP_NOSSP_CFLAGS)
831 GOCFLAGS = $(CFLAGS)
832
833 TFLAGS =