Gentoo Archives: gentoo-commits

From: Magnus Granberg <zorry@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-gccpatchset:master commit in: gcc-4.7.0/piepatch/, gcc-4.6.0/piepatch/, gcc-4.5.0/piepatch/
Date: Sun, 08 Apr 2012 12:33:52
Message-Id: 1333888397.a47328a2beadfa7ab70802444f0aabac82ede1b9.zorry@gentoo
1 commit: a47328a2beadfa7ab70802444f0aabac82ede1b9
2 Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 8 12:33:17 2012 +0000
4 Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 8 12:33:17 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-gccpatchset.git;a=commit;h=a47328a2
7
8 Update 4.6 and 4.7
9
10 ---
11 gcc-4.5.0/piepatch/15_all_gcc45-pr52194.patch | 61 +++++
12 gcc-4.6.0/piepatch/10_all_gcc45_configure.patch | 4 +-
13 .../piepatch/13_all_gcc46_ssp_uclibc_check.patch | 68 +++++
14 ..._gcc45_esp.h.patch => 30_all_gcc46_esp.h.patch} | 8 +-
15 gcc-4.6.0/piepatch/README.Changelog | 6 +
16 gcc-4.6.0/piepatch/README.history | 66 +++---
17 gcc-4.7.0/piepatch/01_all_gcc47_configure.patch | 267 ++++----------------
18 ...onfig.in.patch => 02_all_gcc47_config.in.patch} | 13 +-
19 ..._gcc45_esp.h.patch => 06_all_gcc46_esp.h.patch} | 8 +-
20 gcc-4.7.0/piepatch/README.Changelog | 19 +-
21 gcc-4.7.0/piepatch/README.history | 6 +
22 11 files changed, 258 insertions(+), 268 deletions(-)
23
24 diff --git a/gcc-4.5.0/piepatch/15_all_gcc45-pr52194.patch b/gcc-4.5.0/piepatch/15_all_gcc45-pr52194.patch
25 new file mode 100644
26 index 0000000..4b7b4ae
27 --- /dev/null
28 +++ b/gcc-4.5.0/piepatch/15_all_gcc45-pr52194.patch
29 @@ -0,0 +1,61 @@
30 +2012-02-11 Magnus Granberg <zorry@g.o>
31 +
32 + PR52194
33 + * gcc/c-pch.c (c_common_valid_pch) check for
34 + Pax and RANDMMAP.
35 +
36 +--- a/gcc/c-pch.c 2011-08-28 22:14:46.000000000 +0200
37 ++++ b/gcc/c-pch.c 2012-02-11 17:10:23.158018580 +0100
38 +@@ -36,6 +36,10 @@ along with GCC; see the file COPYING3.
39 + #include "opts.h"
40 + #include "timevar.h"
41 +
42 ++#define FILE_BUFFER 256
43 ++#define LINE_BUFFER 1024
44 ++#define WORD_BUFFER 1024
45 ++
46 + /* This is a list of flag variables that must match exactly, and their
47 + names for the error message. The possible values for *flag_var must
48 + fit in a 'signed char'. */
49 +@@ -240,6 +244,11 @@ c_common_valid_pch (cpp_reader *pfile, c
50 + char ident[IDENT_LENGTH + 16];
51 + const char *pch_ident;
52 + struct c_pch_validity v;
53 ++ FILE *f;
54 ++ char file[FILE_BUFFER];
55 ++ char line[LINE_BUFFER];
56 ++ char word[WORD_BUFFER];
57 ++ char value[WORD_BUFFER];
58 +
59 + /* Perform a quick test of whether this is a valid
60 + precompiled header for the current language. */
61 +@@ -351,6 +360,29 @@ c_common_valid_pch (cpp_reader *pfile, c
62 + }
63 + }
64 +
65 ++ /* FIXME: On PaX enabled kernel with RANDMMAP enabled we can't use
66 ++ PCH. #PR52194 */
67 ++
68 ++ f = fopen ("/proc/self/status", "r");
69 ++ if (f != NULL)
70 ++ {
71 ++ memset(file, 0, FILE_BUFFER);
72 ++ while( fgets(line, LINE_BUFFER, f) )
73 ++ {
74 ++ sscanf(line, "%s %s", word, value);
75 ++ if(!strcmp(word, "PaX:"))
76 ++ {
77 ++ if(value[3] == 'R')
78 ++ {
79 ++ cpp_error (pfile, CPP_DL_WARNING, "%s can't be used \
80 ++ with PaX enabled kernel with RANDMMAP \
81 ++ enabled.", name);
82 ++ return 2;
83 ++ }
84 ++ }
85 ++ }
86 ++ }
87 ++
88 + /* Check the preprocessor macros are the same as when the PCH was
89 + generated. */
90 +
91
92 diff --git a/gcc-4.6.0/piepatch/10_all_gcc45_configure.patch b/gcc-4.6.0/piepatch/10_all_gcc45_configure.patch
93 index 357e63a..a526b00 100644
94 --- a/gcc-4.6.0/piepatch/10_all_gcc45_configure.patch
95 +++ b/gcc-4.6.0/piepatch/10_all_gcc45_configure.patch
96 @@ -1,4 +1,4 @@
97 -2011-12-07 Magnus Granberg <zorry@g.o>, Anthony G. Basile <basile@××××××××××××××.edu>
98 +2012-02-14 Magnus Granberg <zorry@g.o>, Anthony G. Basile <basile@××××××××××××××.edu>
99
100 * configure Add --enable-esp. Add-fno-stack-protector
101 to stage1_cflags.
102 @@ -26,7 +26,7 @@
103 + Enable Stack protector, Position independent executable as
104 + default if we have suppot for it when compiling
105 + and link with -z relro and -z now as default.
106 -+ Linux targets supported i*86, x86_64, powerpc, powerpc64, ia64 and arm
107 ++ Linux targets supported i*86, x86_64, powerpc, powerpc64, ia64 and arm.
108 --enable-libssp build libssp directory
109 --disable-ppl-version-check disable check for PPL version
110 --disable-cloog-version-check disable check for CLooG version
111
112 diff --git a/gcc-4.6.0/piepatch/13_all_gcc46_ssp_uclibc_check.patch b/gcc-4.6.0/piepatch/13_all_gcc46_ssp_uclibc_check.patch
113 new file mode 100644
114 index 0000000..c0abb3e
115 --- /dev/null
116 +++ b/gcc-4.6.0/piepatch/13_all_gcc46_ssp_uclibc_check.patch
117 @@ -0,0 +1,68 @@
118 +2012-04-03 Magnus Granberg <zorry@g.o>
119 +
120 + * gcc/config.in Add define for ENABLE_ESP_SSP
121 + * gcc/configure Check SSP for uClibc
122 +
123 +--- a/gcc/config.in 2012-04-03 17:44:35.173548352 +0200
124 ++++ b/gcc/config.in 2012-04-03 15:25:23.272299470 +0200
125 +@@ -89,6 +89,12 @@
126 + #endif
127 +
128 +
129 ++/* Define to 1 to enable esp ssp. */
130 ++#ifndef USED_FOR_TARGET
131 ++#undef ENABLE_ESP_SSP
132 ++#endif
133 ++
134 ++
135 + /* Define to 1 to enable fixed-point arithmetic extension to C. */
136 + #ifndef USED_FOR_TARGET
137 + #undef ENABLE_FIXED_POINT
138 +--- a/gcc/configure 2012-04-03 17:44:32.793548281 +0200
139 ++++ b/gcc/configure 2012-04-03 17:40:00.000000000 +0200
140 +@@ -25915,6 +25915,45 @@ _ACEOF
141 +
142 + fi
143 +
144 ++
145 ++# Check if we have SSP support. if uClibc we need 0.9.32 or newer and TLS.
146 ++echo "$as_me:$LINENO: checking for SSP support" >&5
147 ++echo $ECHO_N "checking for SSP support... $ECHO_C" >&6
148 ++if test "${enable_esp_SSP+set}" = set; then
149 ++ echo $ECHO_N "(cached) $ECHO_C" >&6
150 ++else
151 ++ if test x$enable_esp = xyes && test x$gcc_cv_libc_provides_ssp = xyes \
152 ++ && test x$set_have_as_tls = xyes; then
153 ++ if $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC__[ ]+1' \
154 ++ $target_header_dir/features.h > /dev/null; then
155 ++ if test -f $target_header_dir/bits/uClibc_config.h && \
156 ++ $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC_SUBLEVEL__[ ]+([3-9][2-9]|[4-9][0-9])' \
157 ++ $target_header_dir/bits/uClibc_config.h > /dev/null && \
158 ++ $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC_HAS_TLS__[ ]+1' \
159 ++ $target_header_dir/bits/uClibc_config.h > /dev/null; then
160 ++ enable_esp_SSP=yes
161 ++ else
162 ++ enable_esp_SSP=no
163 ++ fi
164 ++ else
165 ++ enable_esp_SSP=yes
166 ++ fi
167 ++ else
168 ++ enable_esp_SSP=no
169 ++ fi
170 ++fi
171 ++echo "$as_me:$LINENO: result: $enable_esp_SSP" >&5
172 ++echo "${ECHO_T}$enable_esp_SSP" >&6
173 ++
174 ++if test x$$enable_esp_SSP = xyes; then
175 ++
176 ++cat >>confdefs.h <<\_ACEOF
177 ++#define ENABLE_ESP_SSP 1
178 ++_ACEOF
179 ++
180 ++fi
181 ++
182 ++
183 + # Check if TFmode long double should be used by default or not.
184 + # Some glibc targets used DFmode long double, but with glibc 2.4
185 + # and later they can use TFmode.
186
187 diff --git a/gcc-4.6.0/piepatch/30_all_gcc45_esp.h.patch b/gcc-4.6.0/piepatch/30_all_gcc46_esp.h.patch
188 similarity index 97%
189 rename from gcc-4.6.0/piepatch/30_all_gcc45_esp.h.patch
190 rename to gcc-4.6.0/piepatch/30_all_gcc46_esp.h.patch
191 index c51e8b4..e11c910 100644
192 --- a/gcc-4.6.0/piepatch/30_all_gcc45_esp.h.patch
193 +++ b/gcc-4.6.0/piepatch/30_all_gcc46_esp.h.patch
194 @@ -1,13 +1,13 @@
195 -2011-12-05 Magnus Granberg <zorry@g.o>
196 +2012-04-03 Magnus Granberg <zorry@g.o>
197
198 * gcc/esp.h New file to support --enable-esp
199 - Version 20111205.1
200 + Version 20120403.2
201
202 --- gcc/esp.h 2010-04-09 16:14:00.000000000 +0200
203 +++ gcc/esp.h 2010-04-29 21:30:47.000000000 +0200
204 @@ -0,0 +1,145 @@
205 +/* License terms see GNU GENERAL PUBLIC LICENSE Version 3.
206 -+ * Version 20111205.1
207 ++ * Version 20120403.2
208 + * Magnus Granberg (Zorry) <zorry@g.o> */
209 +#ifndef GCC_ESP_H
210 +#define GCC_ESP_H
211 @@ -57,7 +57,7 @@
212 +
213 + /* This will add -fstack-protector-all if we don't have -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector
214 + -fstack-protector-all and we have EFAULT_SSP or EFAULT_PIE_SSP defined. */
215 -+ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP )
216 ++ #if ( defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) ) && defined ( ENABLE_ESP_SSP )
217 + #define ESP_OPTIONS_SSP_SPEC \
218 + "%{!D__KERNEL__:%{!nostdlib:%{!nodefaultlibs: %{!fno-stack-protector: \
219 + %{!fstack-protector:%{!fstack-protector-all:-fstack-protector-all}}}}}}"
220
221 diff --git a/gcc-4.6.0/piepatch/README.Changelog b/gcc-4.6.0/piepatch/README.Changelog
222 index abf59f9..d903cb9 100644
223 --- a/gcc-4.6.0/piepatch/README.Changelog
224 +++ b/gcc-4.6.0/piepatch/README.Changelog
225 @@ -1,3 +1,9 @@
226 +0.5.1 Magnus Granberg <zorry@g.o>
227 +
228 + * gcc/config.in Add define for ENABLE_ESP_SSP
229 + * gcc/configure Check SSP for uClibc
230 + * gcc/esp.h ENABLE_ESP_SSP
231 +
232 0.5.0 Magnus Granberg <zorry@g.o>
233
234 #393321
235
236 diff --git a/gcc-4.6.0/piepatch/README.history b/gcc-4.6.0/piepatch/README.history
237 index 49980dc..6fd4386 100644
238 --- a/gcc-4.6.0/piepatch/README.history
239 +++ b/gcc-4.6.0/piepatch/README.history
240 @@ -1,4 +1,8 @@
241 -0.5.0 07-12-2011
242 +0.5.1 03 Apr 2012
243 + 13_all_gcc46_ssp_uclibc_check.patch
244 + + 30_all_gcc46_esp.h.patch
245 + - 30_all_gcc45_esp.h.patch
246 +0.5.0 07 Dec 2011
247 + 35_all_gcc46_config_crtbeginp.patch
248 - 35_all_gcc46_config_crtbegints.patch
249 U 10_all_gcc45_configure.patch
250 @@ -7,18 +11,18 @@
251 - 11_all_gcc44_config.in.patch
252 + 30_all_gcc45_esp.h.patch
253 - 30_all_gcc44_esp.h.patch
254 -0.4.9 09-11-2011
255 +0.4.9 09 Nov 2011
256 U 12_all_gcc46_Makefile.in.patch
257 -0.4.8 26-03-2011
258 +0.4.8 26 Mar 2011
259 U 22_all_gcc46-default-ssp.patch
260 -0.4.7 05-03-2011
261 +0.4.7 05 Mar 2011
262 U 20_all_gcc46_gcc.c.patch
263 + 22_all_gcc46-default-ssp.patch
264 - 30_all_gcc46_esp.h.patch
265 + 30_all_gcc44_esp.h.patch
266 U 33_all_gcc46_config_rs6000_linux64.h.patch
267 U 35_all_gcc46_config_crtbegints.patch
268 -0.4.6 07-01-2011
269 +0.4.6 07 Jan 2011
270 + 12_all_gcc46_Makefile.in.patch
271 - 12_all_gcc44_Makefile.in.patch
272 + 20_all_gcc46_gcc.c.patch
273 @@ -32,25 +36,25 @@
274 - 40_all_gcc44_obj_lang-specs.h.patch
275 - 40_all_gcc44_objp_lang-specs.h.patch
276 - 40_all_gcc44_cp_lang-specs.h.patch
277 -0.4.5 18-06-2010
278 +0.4.5 18 Jun 2010
279 U 35_all_gcc44_config_crtbegints.patch
280 -0.4.4 26-05-2010
281 +0.4.4 26 May 2010
282 U 30_all_gcc44_esp.h.patch
283 -0.4.3 26-05-2010
284 +0.4.3 26 May 2010
285 U 20_all_gcc44_gcc.c.patch
286 U 30_all_gcc44_esp.h.patch
287 -0.4.2 24-05-2010
288 +0.4.2 24 May 2010
289 U 10_all_gcc44_configure.patch
290 U 12_all_gcc44_Makefile.in.patch
291 U 11_all_gcc44_config.in.patch
292 U 30_all_gcc44_esp.h.patch
293 -0.4.1 29-04-2010
294 +0.4.1 29 Apr 2010
295 U 10_all_gcc45_configure.patch
296 U 12_all_gcc45_Makefile.in.patch
297 U 11_all_gcc44_config.in.patch
298 U 30_all_gcc44_esp.h.patch
299
300 -0.4.0 19-04-2010
301 +0.4.0 19 Apr 2010
302 U 10_all_gcc45_configure.patch
303 U 12_all_gcc45_Makefile.in.patch
304 U 11_all_gcc44_config.in.patch
305 @@ -58,23 +62,23 @@
306 - 30_all_gcc44_espf.h.patch
307 + 30_all_gcc44_esp.h.patch
308
309 -0.3.9 14-04-2010
310 +0.3.9 14 Apr 2010
311 U 10_all_gcc45_configure.patch
312 - 50_all_gcc44_no_ssp_tls_uclibc.patch
313 U 33_all_gcc45_config_rs6000_linux64.h.patch
314
315 -0.3.8 10-04-2010
316 +0.3.8 10 Apr 2010
317 10_all_gcc44_configure.patch
318 11_all_gcc44_config.in.patch
319 20_all_gcc44_gcc.c.patch
320 30_all_gcc44_espf.h.patch
321
322 -0.3.7 10-02-2010
323 +0.3.7 10 Feb 2010
324 20_all_gcc44_gcc.c.patch
325 30_all_gcc44_espf.h.patch
326 10_all_gcc44_configure.patch
327
328 -0.3.6 23-12-2009
329 +0.3.6 23 Dec 2009
330 - 10_all_gcc44_configure.patch
331 + 10_all_gcc44_configure.patch
332 - 30_all_gcc44_espf.h.patch
333 @@ -86,7 +90,7 @@
334 - README
335 + README
336
337 -0.3.5 24-09-2009
338 +0.3.5 24 Sep 2009
339 - 30_all_gcc44_espf.h.patch
340 + 30_all_gcc44_espf.h.patch
341 - 35_all_gcc44_config_crtbegints.patch
342 @@ -98,7 +102,7 @@
343 + README.history
344 + README.Gentoo.patches
345
346 -0.3.4 11-09-2009
347 +0.3.4 11 Sep 2009
348 - 10_all_gcc44_configure.patch
349 + 10_all_gcc44_configure.patch
350 - 11_all_gcc44_config.in.patch
351 @@ -119,11 +123,11 @@
352 - README
353 + README
354
355 -0.3.3 14-08-2009
356 +0.3.3 14 Aug 2009
357 - 23_all_gcc44_opts.c.patch
358 + 23_all_gcc44_opts.c.patch
359
360 -0.3.2 09-08-2009
361 +0.3.2 09 Aug 2009
362 + 50_all_gcc44_no_ssp_tls_uclibc.patch
363 + README.Changelog
364 + README.history
365 @@ -132,11 +136,11 @@
366 - 30_all_gcc44-espf.h.patch
367 + 30_all_gcc44-espf.h.patch
368
369 -0.3.1 23-07-2009
370 +0.3.1 23 Jul 2009
371 - 10_all_gcc44_configure.patch
372 + 10_all_gcc44_configure.patch
373
374 -0.3.0 23-07-2009
375 +0.3.0 23 Jul 2009
376 - 10_all_gcc44_configure.patch
377 + 10_all_gcc44_configure.patch
378 - 11_all_gcc44_config.in.patch
379 @@ -152,7 +156,7 @@
380 - 30_all_gcc44-espf.h.patch
381 + 30_all_gcc44-espf.h.patch
382
383 -0.2.9 14-06-2009
384 +0.2.9 14 Jun 2009
385 - 12_all_gcc44_Makefile.in.patch
386 + 12_all_gcc44_Makefile.in.patch
387 - 30_all_gcc44-espf.h.patch
388 @@ -160,7 +164,7 @@
389 - 50_all_gcc44_gentoo_v20090612.2.patch
390 + 50_all_gcc44_gentoo_v20090614.1.patch
391
392 -0.2.8 12-06-2009
393 +0.2.8 12 Jun 2009
394 - 10_all_gcc44_configure.patch
395 + 10_all_gcc44_configure.patch
396 - 11_all_gcc44_config.in.patch
397 @@ -172,7 +176,7 @@
398 + 30_all_gcc44-espf.h.patch
399 + 50_all_gcc44_gentoo_v20090612.2.patch
400
401 -0.2.7 29-05-2009
402 +0.2.7 29 May 2009
403 - 11_all_gcc44_config.in.patch
404 + 11_all_gcc44_config.in.patch
405 - 12_all_gcc44_Makefile.in.patch
406 @@ -184,14 +188,14 @@
407 + 25_all_gcc44-espf.h.patch
408 - 30_all_gcc44-config-defaul-linux.patch
409
410 -0.2.6 28-05-2009
411 +0.2.6 28 May 2009
412 + 22_all_gcc44-toplev.c.patch
413 - 25_all_gcc44-espf.h.patch
414 + 25_all_gcc44-espf.h.patch
415 - 30_all_gcc44-config-defaul-linux.patch
416 + 30_all_gcc44-config-defaul-linux.patch
417
418 -0.2.5 27-05-2009
419 +0.2.5 27 May 2009
420 - 10_all_gcc44_configure.patch
421 + 10_all_gcc44_configure.patch
422 - 12_all_gcc44_Makefile.in.patch
423 @@ -204,17 +208,17 @@
424 + 30_all_gcc44-config-defaul-linux.patch
425 - 40_all_gcc44-gentoo.patch
426
427 -0.2.4 08-05-2009
428 +0.2.4 08 May 2009
429 - 12_all_gcc44_Makefile.in.patch
430 + 12_all_gcc44_Makefile.in.patch
431
432 -0.2.3 08-05-2009
433 +0.2.3 08 May 2009
434 - 20_all_gcc44_gcc.c.patch
435 + 20_all_gcc44_gcc.c.patch
436 - 40_all_gcc44-gentoo.patch
437 + 40_all_gcc44-gentoo.patch
438
439 -0.2.2 04-05-2009
440 +0.2.2 04 May 2009
441 + 10_all_gcc44_configure.patch
442 + 11_all_gcc44_config.in.patch
443 + 12_all_gcc44_Makefile.in.patch
444 @@ -236,7 +240,7 @@
445 - 23_all_gcc44-gcc_varasm.c.patch
446 - 30_all_gcc44-add-crt-start-endfiles-linux.patch
447
448 -0.2.1 28-04-2009
449 +0.2.1 28 Apr 2009
450 + 01_all_gcc44-configure.patch
451 + 10_all_gcc44-gcc_configure.patch
452 + 11_all_gcc44-gcc_config.in.patch
453 @@ -257,7 +261,7 @@
454 - 20-all_gcc4.4-default-crt-start-endfile.patch
455 - 30-all_gcc4.4-crtbeginTS-fno-PIE.patch
456
457 -0.1.0 16.04.2009
458 +0.1.0 16 Apr 2009
459 + 00_all_gcc4.4-cvs-incompat.patch
460 + 05_all_gcc4.4-compile-no-ssp.patch
461 + 10_all_gcc4.4-hardened-minispecs-support.patch
462
463 diff --git a/gcc-4.7.0/piepatch/01_all_gcc47_configure.patch b/gcc-4.7.0/piepatch/01_all_gcc47_configure.patch
464 index 94958b1..e79ea25 100644
465 --- a/gcc-4.7.0/piepatch/01_all_gcc47_configure.patch
466 +++ b/gcc-4.7.0/piepatch/01_all_gcc47_configure.patch
467 @@ -1,10 +1,9 @@
468 -2012-01-07 Magnus Granberg <zorry@g.o>
469 +2012-04-06 Magnus Granberg <zorry@g.o>
470
471 * configure Add --enable-esp. Add-fno-stack-protector
472 to stage1_cflags.
473 - * gcc/configure Add --enable-esp. Check -z now,
474 - PIE, SSP and FORTIFY_SOURCES.
475 - Define ENABLE_ESP.
476 + * gcc/configure Add --enable-esp and check if SSP works.
477 + Define ENABLE_ESP ENABLE_ESP_SSP.
478 Check if we support crtbeginP and define ENABLE_CRTBEGINP.
479
480 --- a/configure 2011-12-22 21:51:34.700589641 +0100
481 @@ -46,12 +45,12 @@
482 +if test "${enable_esp+set}" = set; then :
483 + enableval=$enable_esp;
484 + case $target in
485 -+ i?86*-*-linux* | x86_64*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*)
486 ++ i?86*-*-linux* | x86_??*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*)
487 + enable_esp=yes
488 + ;;
489 + *)
490 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** --enable-espf is not supported on this $target target." >&5
491 -+$as_echo "$as_me: WARNING: *** --enable-espf is not supported on this $target target." >&2;}
492 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** --enable-esp is not supported on this $target target." >&5
493 ++$as_echo "$as_me: WARNING: *** --enable-esp is not supported on this $target target." >&2;}
494 + ;;
495 + esac
496 +
497 @@ -97,49 +96,20 @@
498 --enable-plugin enable plugin support
499 --disable-libquadmath-support
500 disable libquadmath support for Fortran
501 -+ --enable-esp Enable Stack protector, Position independent
502 ++ --enable-esp Enable Stack protector, Position independent
503 + executable and Fortify_sources as default if we have
504 + suppot for it when compiling and link -z now as
505 + default. Linux targets supported i*86, x86_64,
506 -+ x86_x32, powerpc, powerpc64, ia64 and arm
507 ++ x86_x32, powerpc, powerpc64, ia64, mips and arm
508
509 Optional Packages:
510 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
511 -@@ -26575,6 +26582,28 @@ else
512 - target_header_dir=${native_system_header_dir}
513 - fi
514 -
515 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker -z now support" >&5
516 -+$as_echo_n "checking linker -z now support... " >&6; }
517 -+if test "${gcc_cv_ld_now+set}" = set; then :
518 -+ $as_echo_n "(cached) " >&6
519 -+else
520 -+ gcc_cv_ld_now=no
521 -+ if test $in_tree_ld = yes ; then
522 -+ if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \
523 -+ && test $in_tree_ld_is_elf = yes; then
524 -+ gcc_cv_ld_now=yes
525 -+ fi
526 -+ elif test x$gcc_cv_ld != x; then
527 -+ # Check if linker supports -z now options
528 -+ if $gcc_cv_ld --help 2>/dev/null | grep now > /dev/null; then
529 -+ gcc_cv_ld_now=yes
530 -+ fi
531 -+ fi
532 -+
533 -+fi
534 -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_now" >&5
535 -+$as_echo "$gcc_cv_ld_now" >&6; }
536 -+
537 - # Test for stack protector support in target C library.
538 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking __stack_chk_fail in target C library" >&5
539 - $as_echo_n "checking __stack_chk_fail in target C library... " >&6; }
540 -@@ -27290,6 +27319,252 @@ _ACEOF
541 +@@ -27290,6 +27411,113 @@ _ACEOF
542
543 fi
544
545 +# --------------
546 -+# Espf checks
547 ++# Esp checks
548 +# --------------
549 +
550 +# Check whether --enable-esp was given and target have the support.
551 @@ -153,9 +123,9 @@
552 +if test $set_enable_esp = yes ; then
553 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $target support esp" >&5
554 +$as_echo_n "checking if $target support esp... " >&6; }
555 -+if test x"$set_enable_esp" = x"yes" ; then
556 ++if test $set_enable_esp = yes ; then
557 + case "$target" in
558 -+ i?86*-*-linux* | x86_64*-*-linux* | x86_x32*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*)
559 ++ i?86*-*-linux* | x86_??*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux* | mips*-*-linux*)
560 + enable_esp=yes
561 +
562 +$as_echo "#define ENABLE_ESP 1" >>confdefs.h
563 @@ -174,80 +144,26 @@
564 +
565 +if test $enable_esp = yes ; then
566 +
567 -+# Check for FORTIFY_SOURCES support in target C library.
568 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FORTIFY_SOURCES support in target C library" >&5
569 -+$as_echo_n "checking for _FORTIFY_SOURCES support in target C library... " >&6; }
570 -+if test "${gcc_cv_libc_provides_fortify+set}" = set; then :
571 -+ $as_echo_n "(cached) " >&6
572 -+else
573 -+ gcc_cv_libc_provides_fortify=no
574 -+ case "$target" in
575 -+ *-*-linux*)
576 -+ # glibc 2.8 and later provides _FORTIFY_SOURCES.
577 -+ if test -f $target_header_dir/features.h; then
578 -+ if $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+2' \
579 -+ $target_header_dir/features.h > /dev/null \
580 -+ && $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+([1-9][0-9]|[8-9])' \
581 -+ $target_header_dir/features.h > /dev/null; then
582 -+ gcc_cv_libc_provides_fortify=yes
583 -+ elif $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC__[ ]' \
584 -+ $target_header_dir/features.h > /dev/null ; then
585 -+ gcc_cv_libc_provides_fortify=no
586 -+ fi
587 -+ fi
588 -+ ;;
589 -+ *) gcc_cv_libc_provides_fortify=no ;;
590 -+ esac
591 -+fi
592 -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_libc_provides_fortify" >&5
593 -+$as_echo "$gcc_cv_libc_provides_fortify" >&6; }
594 -+
595 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can default to use -fPIE and link with -pie" >&5
596 -+$as_echo_n "checking if we can default to use -fPIE and link with -pie... " >&6; }
597 -+ if test x"$gcc_cv_ld_pie" = x"yes"; then
598 -+ saved_LDFLAGS="$LDFLAGS"
599 -+ saved_CFLAGS="$CFLAGS"
600 -+ CFLAGS="$CFLAGS -fPIE -Werror"
601 -+ LDFLAGS="$LDFLAGS -fPIE -pie"
602 -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
603 -+/* end confdefs.h. */
604 -+
605 -+int
606 -+main ()
607 -+{
608 -+
609 -+ ;
610 -+ return 0;
611 -+}
612 -+_ACEOF
613 -+if ac_fn_c_try_link "$LINENO"; then :
614 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
615 -+$as_echo "yes" >&6; }; enable_espf_pie=yes
616 -+else
617 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
618 -+$as_echo "no" >&6; }; enable_espf_pie=no
619 -+fi
620 -+rm -f core conftest.err conftest.$ac_objext \
621 -+ conftest$ac_exeext conftest.$ac_ext
622 -+ LDFLAGS="$saved_LDFLAGS"
623 -+ CFLAGS="$saved_CFLAGS"
624 -+ else
625 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
626 -+$as_echo "no" >&6; }
627 -+ enable_espf_pie=no
628 -+ fi
629 -+
630 -+ if test $enable_espf_pie = yes ; then
631 -+
632 -+$as_echo "#define ENABLE_ESPF_PIE 1" >>confdefs.h
633 -+
634 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can default to use -fstack-protector" >&5
635 ++$as_echo_n "checking if we can default to use -fstack-protector... " >&6; }
636 ++ ssp_link_test=no
637 ++ if test x$gcc_cv_libc_provides_ssp = xyes && test x$set_have_as_tls = yes; then
638 ++ if $EGREP '^ *#[ ]*define[ ]+__UCLIBC__[ ]+1' \
639 ++ $target_header_dir/features.h > /dev/null; then
640 ++ if test -f $target_header_dir/bits/uClibc_config.h && \
641 ++ $EGREP '^ *#[ ]*define[ ]+__UCLIBC_SUBLEVEL__[ ]+([3-9][2-9]|[4-9][0-9])' \
642 ++ $target_header_dir/bits/uClibc_config.h > /dev/null && \
643 ++ $EGREP '^ *#[ ]*define[ ]+__UCLIBC_HAS_TLS__[ ]+1' \
644 ++ $target_header_dir/bits/uClibc_config.h > /dev/null; then
645 ++ ssp_link_test=yes
646 ++ fi
647 ++ else
648 ++ ssp_link_test=yes
649 ++ fi
650 + fi
651 -+
652 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can default to use -fstack-protector-all" >&5
653 -+$as_echo_n "checking if we can default to use -fstack-protector-all... " >&6; }
654 -+ if test x"$gcc_cv_libc_provides_ssp" = x"yes" && test x"$set_have_as_tls" = x"yes" ; then
655 ++ if test x$ssp_link_test=xyes ; then
656 + saved_CFLAGS="$CFLAGS"
657 -+ CFLAGS="$CFLAGS -O2 -fstack-protector-all -Werror"
658 ++ CFLAGS="$CFLAGS -O2 -fstack-protector -Werror"
659 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
660 +/* end confdefs.h. */
661 +
662 @@ -261,127 +177,42 @@
663 +_ACEOF
664 +if ac_fn_c_try_link "$LINENO"; then :
665 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
666 -+$as_echo "yes" >&6; }; enable_espf_ssp=yes
667 ++$as_echo "yes" >&6; }; enable_esp_ssp=yes
668 +else
669 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
670 -+$as_echo "no" >&6; }; enable_espf_ssp=no
671 -+fi
672 -+rm -f core conftest.err conftest.$ac_objext \
673 -+ conftest$ac_exeext conftest.$ac_ext
674 -+ CFLAGS="$saved_CFLAGS"
675 -+ else
676 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
677 -+$as_echo "no" >&6; }
678 -+ enable_espf_ssp=no
679 -+ fi
680 -+ if test x"$enable_espf_ssp" = x"yes" ; then
681 -+
682 -+$as_echo "#define ENABLE_ESPF_SSP 1" >>confdefs.h
683 -+
684 -+ fi
685 -+
686 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler default to use -D_FORTIFY_SOURCES" >&5
687 -+$as_echo_n "checking if the compiler default to use -D_FORTIFY_SOURCES... " >&6; }
688 -+ if test x"$gcc_cv_libc_provides_fortify" = x"yes"; then
689 -+ saved_CFLAGS="$CFLAGS"
690 -+ saved_CPPFLAGS="$CPPFLAGS"
691 -+ CFLAGS="$CFLAGS -O2 -Werror -Wall"
692 -+ CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCES=2"
693 -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
694 -+/* end confdefs.h. */
695 -+
696 -+ #include <sys/types.h>
697 -+ #include <sys/stat.h>
698 -+ #include <fcntl.h>
699 -+
700 -+int
701 -+main ()
702 -+{
703 -+
704 -+ open ("/tmp/foo", O_WRONLY | O_CREAT);
705 -+
706 -+ ;
707 -+ return 0;
708 -+}
709 -+_ACEOF
710 -+if ac_fn_c_try_link "$LINENO"; then :
711 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
712 -+$as_echo "no" >&6; }; enable_espf_fortify=no
713 -+else
714 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
715 -+$as_echo "yes" >&6; }; enable_espf_fortify=yes
716 ++$as_echo "no" >&6; }; enable_esp_ssp=no
717 +fi
718 +rm -f core conftest.err conftest.$ac_objext \
719 + conftest$ac_exeext conftest.$ac_ext
720 + CFLAGS="$saved_CFLAGS"
721 -+ CPPFLAGS="$saved_CPPFLAGS"
722 + else
723 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
724 +$as_echo "no" >&6; }
725 -+ enable_espf_fortify=no
726 -+ fi
727 -+ if test x"$enable_espf_fortify" = x"yes" ; then
728 -+
729 -+$as_echo "#define ENABLE_ESPF_FORTIFY 1" >>confdefs.h
730 -+
731 ++ enable_esp_ssp=no
732 + fi
733 ++ if test $enable_esp_ssp = yes ; then
734 +
735 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler default to use -z now to the linker" >&5
736 -+$as_echo_n "checking if the compiler default to use -z now to the linker... " >&6; }
737 -+ if test x"$gcc_cv_ld_now" = x"yes"; then
738 -+ saved_LDFLAGS="$LDFLAGS"
739 -+ saved_CFLAGS="$CFLAGS"
740 -+ CFLAGS="$CFLAGS -Werror"
741 -+ LDFLAGS="$LDFLAGS -Wl,-z,now"
742 -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
743 -+/* end confdefs.h. */
744 ++$as_echo "#define ENABLE_ESP_SSP 1" >>confdefs.h
745 +
746 -+int
747 -+main ()
748 -+{
749 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking checking for crtbeginP.o support" >&5
750 ++$as_echo_n "checking checking for crtbeginP.o support... " >&6; }
751 ++ case "$target" in
752 ++ ia64*-*-linux*)
753 ++ enable_crtbeginP=no ;;
754 ++ *-*-linux*)
755 ++ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then
756 ++ enable_crtbeginP=yes
757 +
758 -+ ;
759 -+ return 0;
760 -+}
761 -+_ACEOF
762 -+if ac_fn_c_try_link "$LINENO"; then :
763 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
764 -+$as_echo "yes" >&6; }; enable_espf_now=yes
765 -+else
766 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
767 -+$as_echo "no" >&6; }; enable_espf_now=no
768 -+fi
769 -+rm -f core conftest.err conftest.$ac_objext \
770 -+ conftest$ac_exeext conftest.$ac_ext
771 -+ LDFLAGS="$saved_LDFLAGS"
772 -+ CFLAGS="$saved_CFLAGS"
773 -+ else
774 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
775 -+$as_echo "no" >&6; }
776 -+ enable_espf_now=no
777 -+ fi
778 -+ if test x"$enable_espf_now" = x"yes" ; then
779 -+
780 -+$as_echo "#define ENABLE_ESPF_NOW 1" >>confdefs.h
781 ++$as_echo "#define ENABLE_CRTBEGINP 1" >>confdefs.h
782 +
783 ++ fi
784 ++ ;;
785 ++ *) enable_crtbeginP=no ;;
786 ++ esac
787 + fi
788 -+
789 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crtbeginP.o support" >&5
790 -+$as_echo_n "checking for crtbeginP.o support... " >&6; }
791 -+ case "$target" in
792 -+ ia64*-*-linux*)
793 -+ enable_crtbeginP=no ;;
794 -+ *-*-linux*)
795 -+ if test x"$gcc_cv_ld_pie" = x"yes" && test x"$lt_cv_prog_compiler_static_works" = x"yes"; then
796 -+ enable_crtbeginP=yes
797 -+$as_echo "#define ENABLE_CRTBEGINP 1" >>confdefs.h
798 -+ else
799 -+ enable_crtbeginP=no
800 -+ fi ;;
801 -+ *) enable_crtbeginP=no ;;
802 -+ esac
803 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_crtbeginP" >&5
804 +$as_echo "$enable_crtbeginP" >&6; }
805 ++
806 +fi
807 +
808 # Configure the subdirectories
809
810 diff --git a/gcc-4.7.0/piepatch/02_all_gcc45_config.in.patch b/gcc-4.7.0/piepatch/02_all_gcc47_config.in.patch
811 similarity index 72%
812 rename from gcc-4.7.0/piepatch/02_all_gcc45_config.in.patch
813 rename to gcc-4.7.0/piepatch/02_all_gcc47_config.in.patch
814 index 489658f..43cd7f8 100644
815 --- a/gcc-4.7.0/piepatch/02_all_gcc45_config.in.patch
816 +++ b/gcc-4.7.0/piepatch/02_all_gcc47_config.in.patch
817 @@ -1,6 +1,7 @@
818 -2011-12-05 Magnus Granberg <zorry@g.o>
819 +2012-04-06 Magnus Granberg <zorry@g.o>
820
821 - * gcc/config.in Add ENABLE_CRTBEGINP and ENABLE_ESP
822 + * gcc/config.in Add ENABLE_CRTBEGINP, ENABLE_ESP
823 + and ENABLE_ESP_SSP
824
825 --- gcc/config.in 2009-04-21 11:08:08.000000000 +0200
826 +++ gcc/config.in 2009-05-12 00:10:08.000000000 +0200
827 @@ -17,7 +18,7 @@
828 /* Define to 1 to specify that we are using the BID decimal floating point
829 format instead of DPD */
830 #ifndef USED_FOR_TARGET
831 -@@ -65,6 +65,12 @@
832 +@@ -65,6 +65,18 @@
833 #endif
834
835
836 @@ -27,6 +28,12 @@
837 +#endif
838 +
839 +
840 ++/* Define to 1 to enable esp. */
841 ++#ifndef USED_FOR_TARGET
842 ++#undef ENABLE_ESP_SSP
843 ++#endif
844 ++
845 ++
846 /* Define to 1 to enable fixed-point arithmetic extension to C. */
847 #ifndef USED_FOR_TARGET
848 #undef ENABLE_FIXED_POINT
849
850 diff --git a/gcc-4.7.0/piepatch/06_all_gcc45_esp.h.patch b/gcc-4.7.0/piepatch/06_all_gcc46_esp.h.patch
851 similarity index 97%
852 rename from gcc-4.7.0/piepatch/06_all_gcc45_esp.h.patch
853 rename to gcc-4.7.0/piepatch/06_all_gcc46_esp.h.patch
854 index c51e8b4..e11c910 100644
855 --- a/gcc-4.7.0/piepatch/06_all_gcc45_esp.h.patch
856 +++ b/gcc-4.7.0/piepatch/06_all_gcc46_esp.h.patch
857 @@ -1,13 +1,13 @@
858 -2011-12-05 Magnus Granberg <zorry@g.o>
859 +2012-04-03 Magnus Granberg <zorry@g.o>
860
861 * gcc/esp.h New file to support --enable-esp
862 - Version 20111205.1
863 + Version 20120403.2
864
865 --- gcc/esp.h 2010-04-09 16:14:00.000000000 +0200
866 +++ gcc/esp.h 2010-04-29 21:30:47.000000000 +0200
867 @@ -0,0 +1,145 @@
868 +/* License terms see GNU GENERAL PUBLIC LICENSE Version 3.
869 -+ * Version 20111205.1
870 ++ * Version 20120403.2
871 + * Magnus Granberg (Zorry) <zorry@g.o> */
872 +#ifndef GCC_ESP_H
873 +#define GCC_ESP_H
874 @@ -57,7 +57,7 @@
875 +
876 + /* This will add -fstack-protector-all if we don't have -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector
877 + -fstack-protector-all and we have EFAULT_SSP or EFAULT_PIE_SSP defined. */
878 -+ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP )
879 ++ #if ( defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) ) && defined ( ENABLE_ESP_SSP )
880 + #define ESP_OPTIONS_SSP_SPEC \
881 + "%{!D__KERNEL__:%{!nostdlib:%{!nodefaultlibs: %{!fno-stack-protector: \
882 + %{!fstack-protector:%{!fstack-protector-all:-fstack-protector-all}}}}}}"
883
884 diff --git a/gcc-4.7.0/piepatch/README.Changelog b/gcc-4.7.0/piepatch/README.Changelog
885 index 1729b6a..b6252ed 100644
886 --- a/gcc-4.7.0/piepatch/README.Changelog
887 +++ b/gcc-4.7.0/piepatch/README.Changelog
888 @@ -1,15 +1,22 @@
889 +0.5.3 Magnus Granberg <zorry@g.o>
890 +
891 + * gcc/configure Clean up the checks and added
892 + check for uclibc ssp support.
893 + * gcc/config.in Add define for ENABLE_ESP_SSP
894 + * gcc/esp.h Check for ENABLE_ESP_SSP
895 +
896 0.5.2 Magnus Granberg <zorry@g.o>
897
898 - * gcc/common.opt Add -nopie
899 + * gcc/common.opt Add -nopie
900
901 0.5.1 Magnus Granberg <zorry@g.o>
902
903 - * configure Bumped for 4.7.0 release
904 - * gcc/configure Bumped for 4.7.0 release and
905 + * configure Bumped for 4.7.0 release
906 + * gcc/configure Bumped for 4.7.0 release and
907 added some checks.
908 - * gcc/Makefile Bumped for 4.7.0 release
909 - * gcc/gcc.c Bumped for 4.7.0 release
910 - * libgcc/Makefile Bumped for 4.7.0 release
911 + * gcc/Makefile Bumped for 4.7.0 release
912 + * gcc/gcc.c Bumped for 4.7.0 release
913 + * libgcc/Makefile Bumped for 4.7.0 release
914
915 0.5.0 Magnus Granberg <zorry@g.o>
916
917
918 diff --git a/gcc-4.7.0/piepatch/README.history b/gcc-4.7.0/piepatch/README.history
919 index 3c5a7b1..537cc48 100644
920 --- a/gcc-4.7.0/piepatch/README.history
921 +++ b/gcc-4.7.0/piepatch/README.history
922 @@ -1,3 +1,9 @@
923 +0.5.3 06 Apr 2012
924 + U 01_all_gcc47_configure.patch
925 + + 02_all_gcc47_config.in.patch
926 + - 02_all_gcc45_config.in.patch
927 + + 06_all_gcc46_esp.h.patch
928 + - 06_all_gcc45_esp.h.patch
929 0.5.2 24 Jan 2012
930 + 16_all_gcc47_nopie_option.patch
931 0.5.1 17 Jan 2012