1 |
dirtyepic 11/07/01 07:17:43 |
2 |
|
3 |
Added: 00_all_gcc-4.4-cvs-incompat.patch |
4 |
05_all_gcc-4.3-compile-no-ssp.patch |
5 |
06_all_gcc-4.4-decl-tls-model.patch |
6 |
10_all_gcc-4.4-gen-crt-start-endfile.patch |
7 |
11_all_gcc-4.3-sparc-gen-crt-start-endfiles.patch |
8 |
20_all_gcc-4.4-gentoo-hardened-setup.patch |
9 |
30_all_gcc-4.3-crtbeginTS-fno-PIE.patch |
10 |
Log: |
11 |
Initial 4.3.6 patchset based on latest 4.3.5 patchset. |
12 |
|
13 |
Revision Changes Path |
14 |
1.1 src/patchsets/gcc/4.3.6/pie/00_all_gcc-4.4-cvs-incompat.patch |
15 |
|
16 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.3.6/pie/00_all_gcc-4.4-cvs-incompat.patch?rev=1.1&view=markup |
17 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.3.6/pie/00_all_gcc-4.4-cvs-incompat.patch?rev=1.1&content-type=text/plain |
18 |
|
19 |
Index: 00_all_gcc-4.4-cvs-incompat.patch |
20 |
=================================================================== |
21 |
2004-11-14 Peter S Mazinger <ps.m@×××.net> |
22 |
|
23 |
* gcc/gcc.c: Add some test spec. |
24 |
Fix for incompatible spec options. |
25 |
|
26 |
--- gcc/gcc.c.mps |
27 |
+++ gcc/gcc.c |
28 |
@@ -794,6 +794,8 @@ |
29 |
/* NB: This is shared amongst all front-ends. */ |
30 |
static const char *cc1_options = |
31 |
"%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ |
32 |
+ %{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}}\ |
33 |
+ %{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible}}\ |
34 |
%1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\ |
35 |
%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}\ |
36 |
%{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi}\ |
37 |
|
38 |
|
39 |
|
40 |
1.1 src/patchsets/gcc/4.3.6/pie/05_all_gcc-4.3-compile-no-ssp.patch |
41 |
|
42 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.3.6/pie/05_all_gcc-4.3-compile-no-ssp.patch?rev=1.1&view=markup |
43 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.3.6/pie/05_all_gcc-4.3-compile-no-ssp.patch?rev=1.1&content-type=text/plain |
44 |
|
45 |
Index: 05_all_gcc-4.3-compile-no-ssp.patch |
46 |
=================================================================== |
47 |
2007-05-20 Natanael Copa <natanael.copa@gmail> |
48 |
Magnus Granberg <zorry@×××.nu> |
49 |
|
50 |
* gcc/Makefile.in: Add no-ssp. |
51 |
Make libgcc2 not comile with ssp. |
52 |
Make crtstuff not compile wuth ssp. |
53 |
stage1/cc1: stack smashing attack in function ix86_split_to_parts(). |
54 |
|
55 |
--- gcc/Makefile.in |
56 |
+++ gcc/Makefile.in |
57 |
@@ -563,7 +563,7 @@ |
58 |
LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \ |
59 |
$(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \ |
60 |
-DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ |
61 |
- $(INHIBIT_LIBC_CFLAGS) |
62 |
+ -fno-stack-protector $(INHIBIT_LIBC_CFLAGS) |
63 |
|
64 |
# Additional options to use when compiling libgcc2.a. |
65 |
# Some targets override this to -isystem include |
66 |
@@ -576,7 +576,7 @@ |
67 |
CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ |
68 |
-finhibit-size-directive -fno-inline-functions -fno-exceptions \ |
69 |
-fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \ |
70 |
- $(INHIBIT_LIBC_CFLAGS) |
71 |
+ -fno-stack-protector $(INHIBIT_LIBC_CFLAGS) |
72 |
|
73 |
# Additional sources to handle exceptions; overridden by targets as needed. |
74 |
LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ |
75 |
@@ -2641,7 +2641,7 @@ |
76 |
output.h $(INSN_ATTR_H) $(SYSTEM_H) toplev.h $(TARGET_H) libfuncs.h \ |
77 |
$(TARGET_DEF_H) $(FUNCTION_H) $(SCHED_INT_H) $(TM_P_H) $(EXPR_H) \ |
78 |
langhooks.h $(GGC_H) $(OPTABS_H) $(REAL_H) tm-constrs.h |
79 |
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ |
80 |
+ $(CC) -c $(ALL_CFLAGS) -fno-stack-protector $(ALL_CPPFLAGS) \ |
81 |
$(out_file) $(OUTPUT_OPTION) |
82 |
|
83 |
# Build auxiliary files that support ecoff format. |
84 |
|
85 |
|
86 |
|
87 |
1.1 src/patchsets/gcc/4.3.6/pie/06_all_gcc-4.4-decl-tls-model.patch |
88 |
|
89 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.3.6/pie/06_all_gcc-4.4-decl-tls-model.patch?rev=1.1&view=markup |
90 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.3.6/pie/06_all_gcc-4.4-decl-tls-model.patch?rev=1.1&content-type=text/plain |
91 |
|
92 |
Index: 06_all_gcc-4.4-decl-tls-model.patch |
93 |
=================================================================== |
94 |
2008-12-12 <zorry@×××.nu> |
95 |
|
96 |
* gcc/varasm.c (decl_tls_model): Check flag_pic instead of flag_shlib. |
97 |
|
98 |
flag_pie never get use to change the tls model. |
99 |
|
100 |
--- gcc/varasm.c.zorry |
101 |
+++ gcc/varasm.c |
102 |
@@ -4614,7 +4614,7 @@ |
103 |
} |
104 |
|
105 |
is_local = targetm.binds_local_p (decl); |
106 |
- if (!flag_shlib) |
107 |
+ if (!flag_pic) |
108 |
{ |
109 |
if (is_local) |
110 |
kind = TLS_MODEL_LOCAL_EXEC; |
111 |
|
112 |
|
113 |
|
114 |
1.1 src/patchsets/gcc/4.3.6/pie/10_all_gcc-4.4-gen-crt-start-endfile.patch |
115 |
|
116 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.3.6/pie/10_all_gcc-4.4-gen-crt-start-endfile.patch?rev=1.1&view=markup |
117 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.3.6/pie/10_all_gcc-4.4-gen-crt-start-endfile.patch?rev=1.1&content-type=text/plain |
118 |
|
119 |
Index: 10_all_gcc-4.4-gen-crt-start-endfile.patch |
120 |
=================================================================== |
121 |
2008-12-29 Magnus Granberg <zorry@×××.nu> |
122 |
Petet S. Mazinger <ps.m@×××.net> |
123 |
|
124 |
* gcc/config/alpha/elf.h: Move CRT, START and ENDFILE to gcc/gcc.c |
125 |
* gcc/config/i386/linux64.h: Likewise. |
126 |
* gcc/config/i386/linux.h: Likewise. |
127 |
* gcc/config/ia64/linux.h: Likewise. |
128 |
* gcc/config/linux.h: Likewise. |
129 |
* gcc/config/rs6000/linux64.h: Likewise. |
130 |
* gcc/config/rs6000/sysv4.h: Likewise. |
131 |
* gcc/gcc.c Add CRT, START and ENDFILE |
132 |
|
133 |
--- gcc/config/alpha/elf.h.zorry |
134 |
+++ gcc/config/alpha/elf.h |
135 |
@@ -360,15 +360,7 @@ |
136 |
before entering `main'. */ |
137 |
|
138 |
#undef STARTFILE_SPEC |
139 |
-#ifdef HAVE_LD_PIE |
140 |
-#define STARTFILE_SPEC \ |
141 |
- "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\ |
142 |
- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" |
143 |
-#else |
144 |
-#define STARTFILE_SPEC \ |
145 |
- "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\ |
146 |
- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" |
147 |
-#endif |
148 |
+#define STARTFILE_SPEC "%(ld_pie_crtfile_gen) crti.o%s %(startfile_pie_t_gen)" |
149 |
|
150 |
/* Provide a ENDFILE_SPEC appropriate for ELF. Here we tack on the |
151 |
magical crtend.o file which provides part of the support for |
152 |
@@ -378,7 +370,7 @@ |
153 |
#undef ENDFILE_SPEC |
154 |
#define ENDFILE_SPEC \ |
155 |
"%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ |
156 |
- %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" |
157 |
+ %(endfile_pie_gen) crtn.o%s" |
158 |
|
159 |
/* We support #pragma. */ |
160 |
#define HANDLE_SYSV_PRAGMA 1 |
161 |
--- gcc/config/i386/linux64.h.zorry |
162 |
+++ gcc/config/i386/linux64.h |
163 |
@@ -81,7 +81,7 @@ |
164 |
%{mpc32:crtprec32.o%s} \ |
165 |
%{mpc64:crtprec64.o%s} \ |
166 |
%{mpc80:crtprec80.o%s} \ |
167 |
- %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" |
168 |
+ %(endfile_pie_gen) crtn.o%s" |
169 |
|
170 |
#if TARGET_64BIT_DEFAULT |
171 |
#define MULTILIB_DEFAULTS { "m64" } |
172 |
--- gcc/config/i386/linux.h.zorry |
173 |
+++ gcc/config/i386/linux.h |
174 |
@@ -123,7 +123,7 @@ |
175 |
%{mpc32:crtprec32.o%s} \ |
176 |
%{mpc64:crtprec64.o%s} \ |
177 |
%{mpc80:crtprec80.o%s} \ |
178 |
- %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" |
179 |
+ %(endfile_pie_gen) crtn.o%s" |
180 |
|
181 |
/* A C statement (sans semicolon) to output to the stdio stream |
182 |
FILE the assembler definition of uninitialized global DECL named |
183 |
--- gcc/config/ia64/linux.h.zorry |
184 |
+++ gcc/config/ia64/linux.h |
185 |
@@ -20,21 +20,13 @@ |
186 |
|
187 |
/* Need to override linux.h STARTFILE_SPEC, since it has crtbeginT.o in. */ |
188 |
#undef STARTFILE_SPEC |
189 |
-#ifdef HAVE_LD_PIE |
190 |
-#define STARTFILE_SPEC \ |
191 |
- "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\ |
192 |
- crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}" |
193 |
-#else |
194 |
-#define STARTFILE_SPEC \ |
195 |
- "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}}\ |
196 |
- crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}" |
197 |
-#endif |
198 |
+#define STARTFILE_SPEC "%(ld_pie_crtfile_gen) crti.o%s %(startfile_pie_gen)" |
199 |
|
200 |
/* Similar to standard Linux, but adding -ffast-math support. */ |
201 |
#undef ENDFILE_SPEC |
202 |
#define ENDFILE_SPEC \ |
203 |
"%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ |
204 |
- %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" |
205 |
+ %(endfile_pie_gen) crtn.o%s" |
206 |
|
207 |
/* Define this for shared library support because it isn't in the main |
208 |
linux.h file. */ |
209 |
--- gcc/config/linux.h.zorry |
210 |
+++ gcc/config/linux.h |
211 |
@@ -38,15 +38,7 @@ |
212 |
object constructed before entering `main'. */ |
213 |
|
214 |
#undef STARTFILE_SPEC |
215 |
-#if defined HAVE_LD_PIE |
216 |
-#define STARTFILE_SPEC \ |
217 |
- "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ |
218 |
- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" |
219 |
-#else |
220 |
-#define STARTFILE_SPEC \ |
221 |
- "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \ |
222 |
- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" |
223 |
-#endif |
224 |
+#define STARTFILE_SPEC "%(ld_pie_crtfile_gen) crti.o%s %(startfile_pie_t_gen)" |
225 |
|
226 |
/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on |
227 |
the GNU/Linux magical crtend.o file (see crtstuff.c) which |
228 |
@@ -55,8 +47,7 @@ |
229 |
GNU/Linux "finalizer" file, `crtn.o'. */ |
230 |
|
231 |
#undef ENDFILE_SPEC |
232 |
-#define ENDFILE_SPEC \ |
233 |
- "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" |
234 |
+#define ENDFILE_SPEC "%(endfile_pie_gen) crtn.o%s" |
235 |
|
236 |
/* This is for -profile to use -lc_p instead of -lc. */ |
237 |
#ifndef CC1_SPEC |
238 |
--- gcc/config/rs6000/linux64.h.zorry |
239 |
+++ gcc/config/rs6000/linux64.h |
240 |
@@ -151,7 +151,7 @@ |
241 |
#endif |
242 |
|
243 |
#define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \ |
244 |
-%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \ |
245 |
+%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_pie) \ |
246 |
%{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \ |
247 |
%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \ |
248 |
%{mcall-freebsd: -mbig} \ |
249 |
--- gcc/config/rs6000/sysv4.h.zorry |
250 |
+++ gcc/config/rs6000/sysv4.h |
251 |
@@ -873,20 +873,13 @@ |
252 |
%{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \ |
253 |
%{!shared: %{profile:-lc_p} %{!profile:-lc}}}" |
254 |
|
255 |
-#ifdef HAVE_LD_PIE |
256 |
#define STARTFILE_LINUX_SPEC "\ |
257 |
-%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ |
258 |
+%(ld_pie_crtfile_gen) \ |
259 |
%{mnewlib:ecrti.o%s;:crti.o%s} \ |
260 |
-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" |
261 |
-#else |
262 |
-#define STARTFILE_LINUX_SPEC "\ |
263 |
-%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \ |
264 |
-%{mnewlib:ecrti.o%s;:crti.o%s} \ |
265 |
-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" |
266 |
-#endif |
267 |
+%(startfile_pie_t_gen)" |
268 |
|
269 |
#define ENDFILE_LINUX_SPEC "\ |
270 |
-%{shared|pie:crtendS.o%s;:crtend.o%s} \ |
271 |
+%(endfile_pie_gen) \ |
272 |
%{mnewlib:ecrtn.o%s;:crtn.o%s}" |
273 |
|
274 |
#define LINK_START_LINUX_SPEC "" |
275 |
--- gcc/gcc.c.zorry |
276 |
+++ gcc/gcc.c |
277 |
@@ -701,12 +701,34 @@ |
278 |
#endif |
279 |
#endif |
280 |
|
281 |
-#ifndef LINK_PIE_SPEC |
282 |
#ifdef HAVE_LD_PIE |
283 |
#define LINK_PIE_SPEC "%{pie:-pie} " |
284 |
+#define LD_PIE_CRTFILE_GEN_SPEC "%(crtfile_pie_gen)" |
285 |
+#define ASM_PIE_SPEC "%{pie:-K PIC}" |
286 |
#else |
287 |
#define LINK_PIE_SPEC "%{pie:} " |
288 |
+#define LD_PIE_CRTFILE_GEN_SPEC "%(crtfile_gen)" |
289 |
+#define ASM_PIE_SPEC "" |
290 |
#endif |
291 |
+ |
292 |
+#ifndef CRTFILE_GEN_SPEC |
293 |
+#define CRTFILE_GEN_SPEC "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}}" |
294 |
+#endif |
295 |
+ |
296 |
+#ifndef CRTFILE_PIE_GEN_SPEC |
297 |
+#define CRTFILE_PIE_GEN_SPEC "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s} }" |
298 |
+#endif |
299 |
+ |
300 |
+#ifndef STARTFILE_PIE_T_GEN_SPEC |
301 |
+#define STARTFILE_PIE_T_GEN_SPEC "%{shared|pie:crtbeginS.o%s;static:crtbeginT.o%s;:crtbegin.o%s}" |
302 |
+#endif |
303 |
+ |
304 |
+#ifndef STARTFILE_PIE_GEN_SPEC |
305 |
+#define STARTFILE_PIE_GEN_SPEC "%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}" |
306 |
+#endif |
307 |
+ |
308 |
+#ifndef ENDFILE_PIE_GEN_SPEC |
309 |
+#define ENDFILE_PIE_GEN_SPEC "%{shared|pie:crtendS.o%s;:crtend.o%s}" |
310 |
#endif |
311 |
|
312 |
/* -u* was put back because both BSD and SysV seem to support it. */ |
313 |
@@ -772,6 +794,13 @@ |
314 |
static const char *sysroot_spec = SYSROOT_SPEC; |
315 |
static const char *sysroot_suffix_spec = SYSROOT_SUFFIX_SPEC; |
316 |
static const char *sysroot_hdrs_suffix_spec = SYSROOT_HEADERS_SUFFIX_SPEC; |
317 |
+static const char *asm_pie_spec = ASM_PIE_SPEC; |
318 |
+static const char *ld_pie_crtfile_gen_spec = LD_PIE_CRTFILE_GEN_SPEC; |
319 |
+static const char *crtfile_gen_spec = CRTFILE_GEN_SPEC; |
320 |
+static const char *crtfile_pie_gen_spec = CRTFILE_PIE_GEN_SPEC; |
321 |
+static const char *startfile_pie_t_gen_spec = STARTFILE_PIE_T_GEN_SPEC; |
322 |
+static const char *startfile_pie_gen_spec = STARTFILE_PIE_GEN_SPEC; |
323 |
+static const char *endfile_pie_gen_spec = ENDFILE_PIE_GEN_SPEC; |
324 |
|
325 |
/* Standard options to cpp, cc1, and as, to reduce duplication in specs. |
326 |
There should be no need to override these in target dependent files, |
327 |
@@ -1605,6 +1634,13 @@ |
328 |
INIT_STATIC_SPEC ("sysroot_spec", &sysroot_spec), |
329 |
INIT_STATIC_SPEC ("sysroot_suffix_spec", &sysroot_suffix_spec), |
330 |
INIT_STATIC_SPEC ("sysroot_hdrs_suffix_spec", &sysroot_hdrs_suffix_spec), |
331 |
+ INIT_STATIC_SPEC ("asm_pie", &asm_pie_spec), |
332 |
+ INIT_STATIC_SPEC ("ld_pie_crtfile_gen", &ld_pie_crtfile_gen_spec), |
333 |
+ INIT_STATIC_SPEC ("crtfile_gen", &crtfile_gen_spec), |
334 |
+ INIT_STATIC_SPEC ("crtfile_pie_gen", &crtfile_pie_gen_spec), |
335 |
+ INIT_STATIC_SPEC ("startfile_pie_t_gen", &startfile_pie_t_gen_spec), |
336 |
+ INIT_STATIC_SPEC ("startfile_pie_gen", &startfile_pie_gen_spec), |
337 |
+ INIT_STATIC_SPEC ("endfile_pie_gen", &endfile_pie_gen_spec), |
338 |
}; |
339 |
|
340 |
#ifdef EXTRA_SPECS /* additional specs needed */ |
341 |
|
342 |
|
343 |
|
344 |
1.1 src/patchsets/gcc/4.3.6/pie/11_all_gcc-4.3-sparc-gen-crt-start-endfiles.patch |
345 |
|
346 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.3.6/pie/11_all_gcc-4.3-sparc-gen-crt-start-endfiles.patch?rev=1.1&view=markup |
347 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.3.6/pie/11_all_gcc-4.3-sparc-gen-crt-start-endfiles.patch?rev=1.1&content-type=text/plain |
348 |
|
349 |
Index: 11_all_gcc-4.3-sparc-gen-crt-start-endfiles.patch |
350 |
=================================================================== |
351 |
2008-11-26 Magnus Granberg <zorry@×××.nu> |
352 |
Peter S. Mazinger <ps.m@×××.net> |
353 |
|
354 |
* gcc/config/sparc/linux64.h: Move CRT, START and ENDFILE to gcc/gcc.c |
355 |
* gcc/config/sparc/linux.h: Likewise. |
356 |
|
357 |
--- gcc/config/sparc/linux64.h |
358 |
+++ gcc/config/sparc/linux64.h |
359 |
@@ -83,7 +74,7 @@ |
360 |
#undef ENDFILE_SPEC |
361 |
|
362 |
#define ENDFILE_SPEC \ |
363 |
- "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ |
364 |
+ "%(endfile_pie_gen) crtn.o%s\ |
365 |
%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" |
366 |
|
367 |
/* The GNU C++ standard library requires that these macros be defined. */ |
368 |
@@ -281,7 +272,7 @@ |
369 |
%{T} \ |
370 |
%{Ym,*} \ |
371 |
%{Wa,*:%*} \ |
372 |
--s %{fpic|fPIC|fpie|fPIE:-K PIC} \ |
373 |
+-s %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_pie) \ |
374 |
%{mlittle-endian:-EL} \ |
375 |
%(asm_cpu) %(asm_arch) %(asm_relax)" |
376 |
|
377 |
--- gcc/config/sparc/linux.h |
378 |
+++ gcc/config/sparc/linux.h |
379 |
@@ -64,7 +56,7 @@ |
380 |
|
381 |
#undef ENDFILE_SPEC |
382 |
#define ENDFILE_SPEC \ |
383 |
- "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ |
384 |
+ "%(endfile_pie_gen) crtn.o%s\ |
385 |
%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" |
386 |
|
387 |
/* This is for -profile to use -lc_p instead of -lc. */ |
388 |
@@ -146,7 +138,7 @@ |
389 |
#undef ASM_SPEC |
390 |
#define ASM_SPEC \ |
391 |
"%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \ |
392 |
- %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu) %(asm_relax)" |
393 |
+ %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_pie) %(asm_cpu) %(asm_relax)" |
394 |
|
395 |
/* Same as sparc.h */ |
396 |
#undef DBX_REGISTER_NUMBER |
397 |
|
398 |
|
399 |
|
400 |
1.1 src/patchsets/gcc/4.3.6/pie/20_all_gcc-4.4-gentoo-hardened-setup.patch |
401 |
|
402 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.3.6/pie/20_all_gcc-4.4-gentoo-hardened-setup.patch?rev=1.1&view=markup |
403 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.3.6/pie/20_all_gcc-4.4-gentoo-hardened-setup.patch?rev=1.1&content-type=text/plain |
404 |
|
405 |
Index: 20_all_gcc-4.4-gentoo-hardened-setup.patch |
406 |
=================================================================== |
407 |
2008-12-17 Magnus Granberg <zorry@×××.nu> |
408 |
Peter S. Mazinger <ps.m@×××.net> |
409 |
|
410 |
* gcc/gcc.c: Add spec suff. |
411 |
We add Gentoo Hardened minispec support. |
412 |
|
413 |
--- gcc/gcc.c.zorry |
414 |
+++ gcc/gcc.c |
415 |
@@ -705,10 +705,12 @@ |
416 |
#define LINK_PIE_SPEC "%{pie:-pie} " |
417 |
#define LD_PIE_CRTFILE_GEN_SPEC "%(crtfile_pie_gen)" |
418 |
#define ASM_PIE_SPEC "%{pie:-K PIC}" |
419 |
+#define CC1_PIE_SPEC "%{pie:-fPIE}" |
420 |
#else |
421 |
#define LINK_PIE_SPEC "%{pie:} " |
422 |
#define LD_PIE_CRTFILE_GEN_SPEC "%(crtfile_gen)" |
423 |
#define ASM_PIE_SPEC "" |
424 |
+#define CC1_PIE_SPEC "" |
425 |
#endif |
426 |
|
427 |
#ifndef CRTFILE_GEN_SPEC |
428 |
@@ -731,6 +733,28 @@ |
429 |
#define ENDFILE_PIE_GEN_SPEC "%{shared|pie:crtendS.o%s;:crtend.o%s}" |
430 |
#endif |
431 |
|
432 |
+#ifndef CC1_GENTOO_HARDENED_SPEC |
433 |
+#define CC1_GENTOO_HARDENED_SPEC "%{!D__KERNEL__: %(cc1_pie) %(cc1_ssp) } %(cc1_strict)" |
434 |
+#endif |
435 |
+#ifndef CC1_SSP_SPEC |
436 |
+#define CC1_SSP_SPEC "" |
437 |
+#endif |
438 |
+#ifndef CC1_SSP_ALL_SPEC |
439 |
+#define CC1_SSP_ALL_SPEC "" |
440 |
+#endif |
441 |
+#ifndef CC1_STRICT_SPEC |
442 |
+#define CC1_STRICT_SPEC "" |
443 |
+#endif |
444 |
+#ifndef LINK_NOW_SPEC |
445 |
+#define LINK_NOW_SPEC "" |
446 |
+#endif |
447 |
+ |
448 |
+ |
449 |
+ |
450 |
+ |
451 |
+ |
452 |
+ |
453 |
+ |
454 |
/* -u* was put back because both BSD and SysV seem to support it. */ |
455 |
/* %{static:} simply prevents an error message if the target machine |
456 |
doesn't handle -static. */ |
457 |
@@ -740,7 +764,7 @@ |
458 |
#ifndef LINK_COMMAND_SPEC |
459 |
#define LINK_COMMAND_SPEC "\ |
460 |
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ |
461 |
- %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\ |
462 |
+ %(linker) %l %(link_pie) %(link_now) %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\ |
463 |
%{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ |
464 |
%{static:} %{L*} %(mfwrap) %(link_libgcc) %o\ |
465 |
%{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)} %(mflib)\ |
466 |
@@ -772,7 +796,7 @@ |
467 |
|
468 |
static const char *asm_debug; |
469 |
static const char *cpp_spec = CPP_SPEC; |
470 |
-static const char *cc1_spec = CC1_SPEC; |
471 |
+static const char *cc1_spec = CC1_SPEC CC1_GENTOO_HARDENED_SPEC; |
472 |
static const char *cc1plus_spec = CC1PLUS_SPEC; |
473 |
static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC; |
474 |
static const char *link_ssp_spec = LINK_SSP_SPEC; |
475 |
@@ -801,6 +825,14 @@ |
476 |
static const char *startfile_pie_t_gen_spec = STARTFILE_PIE_T_GEN_SPEC; |
477 |
static const char *startfile_pie_gen_spec = STARTFILE_PIE_GEN_SPEC; |
478 |
static const char *endfile_pie_gen_spec = ENDFILE_PIE_GEN_SPEC; |
479 |
+static const char *cc1_ssp_spec = CC1_SSP_SPEC; |
480 |
+static const char *cc1_ssp_all_spec = CC1_SSP_ALL_SPEC; |
481 |
+static const char *cc1_pie_spec = CC1_PIE_SPEC; |
482 |
+static const char *cc1_strict_spec = CC1_STRICT_SPEC; |
483 |
+static const char *link_now_spec = LINK_NOW_SPEC; |
484 |
+static const char *link_pie_spec = LINK_PIE_SPEC; |
485 |
+ |
486 |
+ |
487 |
|
488 |
/* Standard options to cpp, cc1, and as, to reduce duplication in specs. |
489 |
There should be no need to override these in target dependent files, |
490 |
@@ -1643,6 +1675,14 @@ |
491 |
INIT_STATIC_SPEC ("startfile_pie_t_gen", &startfile_pie_t_gen_spec), |
492 |
INIT_STATIC_SPEC ("startfile_pie_gen", &startfile_pie_gen_spec), |
493 |
INIT_STATIC_SPEC ("endfile_pie_gen", &endfile_pie_gen_spec), |
494 |
+ INIT_STATIC_SPEC ("cc1_ssp", &cc1_ssp_spec), |
495 |
+ INIT_STATIC_SPEC ("cc1_ssp_all", &cc1_ssp_all_spec), |
496 |
+ INIT_STATIC_SPEC ("cc1_pie", &cc1_pie_spec), |
497 |
+ /* INIT_STATIC_SPEC ("cc1_fortify", &cc1_fortify_spec), */ |
498 |
+ INIT_STATIC_SPEC ("cc1_strict", &cc1_strict_spec), |
499 |
+ /* INIT_STATIC_SPEC ("link_relro", &link_relro_spec), */ |
500 |
+ INIT_STATIC_SPEC ("link_now", &link_now_spec), |
501 |
+ INIT_STATIC_SPEC ("link_pie", &link_pie_spec), |
502 |
}; |
503 |
|
504 |
#ifdef EXTRA_SPECS /* additional specs needed */ |
505 |
|
506 |
|
507 |
|
508 |
1.1 src/patchsets/gcc/4.3.6/pie/30_all_gcc-4.3-crtbeginTS-fno-PIE.patch |
509 |
|
510 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.3.6/pie/30_all_gcc-4.3-crtbeginTS-fno-PIE.patch?rev=1.1&view=markup |
511 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.3.6/pie/30_all_gcc-4.3-crtbeginTS-fno-PIE.patch?rev=1.1&content-type=text/plain |
512 |
|
513 |
Index: 30_all_gcc-4.3-crtbeginTS-fno-PIE.patch |
514 |
=================================================================== |
515 |
2008-11-26 Magnus Granberg <zorry@×××.nu> |
516 |
Peter S. Mazinger <ps.m@×××.net> |
517 |
|
518 |
* gcc/config.gcc: Add crtbeginTS.o |
519 |
* gcc/Makefile.in: Add -fnoPIE and crtbeginTS.o |
520 |
* libgcc/config.host: Add crtbeginTS.o |
521 |
* libgcc/Makefile.in: Add crtbeginTS.o |
522 |
|
523 |
--- gcc/config.gcc.zorry |
524 |
+++ gcc/config.gcc |
525 |
@@ -493,7 +493,7 @@ |
526 |
;; |
527 |
*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) |
528 |
# Must come before *-*-gnu* (because of *-*-linux-gnu* systems). |
529 |
- extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o" |
530 |
+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtbeginTS.o crtend.o crtendS.o" |
531 |
extra_options="${extra_options} linux.opt" |
532 |
gas=yes |
533 |
gnu_ld=yes |
534 |
--- gcc/Makefile.in.zorry |
535 |
+++ gcc/Makefile.in |
536 |
@@ -1665,36 +1665,43 @@ |
537 |
# constructors. |
538 |
$(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ |
539 |
gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) |
540 |
- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ |
541 |
+ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ |
542 |
-c $(srcdir)/crtstuff.c -DCRT_BEGIN \ |
543 |
-o $(T)crtbegin$(objext) |
544 |
|
545 |
$(T)crtend.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ |
546 |
gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) |
547 |
- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ |
548 |
+ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ |
549 |
-c $(srcdir)/crtstuff.c -DCRT_END \ |
550 |
-o $(T)crtend$(objext) |
551 |
|
552 |
# These are versions of crtbegin and crtend for shared libraries. |
553 |
$(T)crtbeginS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ |
554 |
gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) |
555 |
- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \ |
556 |
+ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \ |
557 |
-c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O \ |
558 |
-o $(T)crtbeginS$(objext) |
559 |
|
560 |
$(T)crtendS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ |
561 |
gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) |
562 |
- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \ |
563 |
+ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \ |
564 |
-c $(srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O \ |
565 |
-o $(T)crtendS$(objext) |
566 |
|
567 |
# This is a version of crtbegin for -static links. |
568 |
$(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ |
569 |
gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) |
570 |
- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ |
571 |
+ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ |
572 |
-c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \ |
573 |
-o $(T)crtbeginT$(objext) |
574 |
|
575 |
+# This is a version of crtbegin for -static -fPIE links. |
576 |
+$(T)crtbeginTS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ |
577 |
+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) |
578 |
+ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \ |
579 |
+ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O \ |
580 |
+ -o $(T)crtbeginTS$(objext) |
581 |
+ |
582 |
# Compile the start modules crt0.o and mcrt0.o that are linked with |
583 |
# every program |
584 |
$(T)crt0.o: s-crt0 ; @true |
585 |
--- libgcc/config.host.zorry |
586 |
+++ libgcc/config.host |
587 |
@@ -164,7 +164,7 @@ |
588 |
;; |
589 |
*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) |
590 |
# Must come before *-*-gnu* (because of *-*-linux-gnu* systems). |
591 |
- extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o" |
592 |
+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtbeginTS.o crtend.o crtendS.o" |
593 |
;; |
594 |
*-*-gnu*) |
595 |
;; |
596 |
--- libgcc/Makefile.in.zorry |
597 |
+++ libgcc/Makefile.in |
598 |
@@ -783,6 +783,11 @@ |
599 |
crtbeginT.o: $(gcc_srcdir)/crtstuff.c |
600 |
$(crt_compile) $(CRTSTUFF_T_CFLAGS) \ |
601 |
-c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O |
602 |
+ |
603 |
+# This is a version of crtbegin for -static -fPIE links. |
604 |
+crtbeginTS.o: $(gcc_srcdir)/crtstuff.c |
605 |
+ $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \ |
606 |
+ -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O |
607 |
endif |
608 |
|
609 |
# Build extra startfiles in the libgcc directory. |