Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/binutils/2.21.1: 03_all_binutils-2.15.92.0.2-ppc64-pie.patch 08_all_binutils-RPATH_ENVVAR-smack.patch 12_all_sh-targets.patch 15_all_alpha-relax-pr12608.patch 20_all_ld-sysroot.patch 30_all_binutils-2.20-flexible-tests.patch 63_all_binutils-2.21-pt-pax-flags-20101209.patch 65_all_binutils-2.20-amd64-32bit-path.patch 66_all_binutils-2.18.50.0.2-warn-textrel.patch 75_all_binutils-default-test-flags.patch 76_all_only-use-new-ld-dtags.patch.disabled 76_all_use-new-ld-dtags.patch 77_all_generate-gnu-hash.patch 78_all_use-relro.patch 91_all_libiberty-pic.patch README.history
Date: Tue, 28 Jun 2011 02:22:01
Message-Id: 20110628022150.82D9E20057@flycatcher.gentoo.org
1 vapier 11/06/28 02:21:50
2
3 Added: 03_all_binutils-2.15.92.0.2-ppc64-pie.patch
4 08_all_binutils-RPATH_ENVVAR-smack.patch
5 12_all_sh-targets.patch
6 15_all_alpha-relax-pr12608.patch
7 20_all_ld-sysroot.patch
8 30_all_binutils-2.20-flexible-tests.patch
9 63_all_binutils-2.21-pt-pax-flags-20101209.patch
10 65_all_binutils-2.20-amd64-32bit-path.patch
11 66_all_binutils-2.18.50.0.2-warn-textrel.patch
12 75_all_binutils-default-test-flags.patch
13 76_all_only-use-new-ld-dtags.patch.disabled
14 76_all_use-new-ld-dtags.patch
15 77_all_generate-gnu-hash.patch
16 78_all_use-relro.patch 91_all_libiberty-pic.patch
17 README.history
18 Log:
19 initial 2.21.1 patchset based on last 2.21 patchset
20
21 Revision Changes Path
22 1.1 src/patchsets/binutils/2.21.1/03_all_binutils-2.15.92.0.2-ppc64-pie.patch
23
24 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/03_all_binutils-2.15.92.0.2-ppc64-pie.patch?rev=1.1&view=markup
25 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/03_all_binutils-2.15.92.0.2-ppc64-pie.patch?rev=1.1&content-type=text/plain
26
27 Index: 03_all_binutils-2.15.92.0.2-ppc64-pie.patch
28 ===================================================================
29 --- bfd/elf64-ppc.c.jj 2004-09-27 16:46:06.000000000 -0400
30 +++ bfd/elf64-ppc.c 2004-10-04 09:09:50.000000000 -0400
31 @@ -9681,7 +9681,12 @@ ppc64_elf_relocate_section (bfd *output_
32 else if (!SYMBOL_REFERENCES_LOCAL (info, &h->elf)
33 && !is_opd
34 && r_type != R_PPC64_TOC)
35 - outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
36 + {
37 + outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
38 + if (h->elf.dynindx == -1
39 + && h->elf.root.type == bfd_link_hash_undefweak)
40 + memset (&outrel, 0, sizeof outrel);
41 + }
42 else
43 {
44 /* This symbol is local, or marked to become local,
45
46
47
48 1.1 src/patchsets/binutils/2.21.1/08_all_binutils-RPATH_ENVVAR-smack.patch
49
50 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/08_all_binutils-RPATH_ENVVAR-smack.patch?rev=1.1&view=markup
51 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/08_all_binutils-RPATH_ENVVAR-smack.patch?rev=1.1&content-type=text/plain
52
53 Index: 08_all_binutils-RPATH_ENVVAR-smack.patch
54 ===================================================================
55 http://sourceware.org/ml/binutils/2007-07/msg00401.html
56 http://sourceware.org/bugzilla/show_bug.cgi?id=4970
57
58 --- configure
59 +++ configure
60 @@ -5601,6 +5601,7 @@ case "${host}" in
61 *-*-mingw* | *-*-cygwin ) RPATH_ENVVAR=PATH ;;
62 *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
63 esac
64 +RPATH_ENVVAR="cant_touch_this_nah_nah_nah"
65
66 # On systems where the dynamic library environment variable is PATH,
67 if test "$RPATH_ENVVAR" = PATH; then
68
69
70
71 1.1 src/patchsets/binutils/2.21.1/12_all_sh-targets.patch
72
73 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/12_all_sh-targets.patch?rev=1.1&view=markup
74 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/12_all_sh-targets.patch?rev=1.1&content-type=text/plain
75
76 Index: 12_all_sh-targets.patch
77 ===================================================================
78 r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines
79
80 Likewise, binutils has no idea about any of these new targets either, so we
81 fix that up too.. now we're able to actually build a real toolchain for
82 sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
83 inept targets than that one, really. Go look, I promise).
84
85 --- binutils-2.16.90.0.2-dist/configure
86 +++ binutils-2.16.90.0.2/configure
87 @@ -1207,7 +1207,7 @@
88 am33_2.0-*-linux*)
89 noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
90 ;;
91 - sh-*-linux*)
92 + sh*-*-linux*)
93 noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
94 ;;
95 sh*-*-pe|mips*-*-pe|*arm-wince-pe)
96 @@ -1495,7 +1495,7 @@
97 romp-*-*)
98 noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
99 ;;
100 - sh-*-* | sh64-*-*)
101 + sh*-*-* | sh64-*-*)
102 case "${host}" in
103 i[3456789]86-*-vsta) ;; # don't add gprof back in
104 i[3456789]86-*-go32*) ;; # don't add gprof back in
105 --- binutils-2.16.90.0.2-dist/configure.ac
106 +++ binutils-2.16.90.0.2/configure.ac
107 @@ -424,7 +424,7 @@
108 am33_2.0-*-linux*)
109 noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
110 ;;
111 - sh-*-linux*)
112 + sh*-*-linux*)
113 noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
114 ;;
115 sh*-*-pe|mips*-*-pe|*arm-wince-pe)
116 @@ -712,7 +712,7 @@
117 romp-*-*)
118 noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
119 ;;
120 - sh-*-* | sh64-*-*)
121 + sh*-*-* | sh64-*-*)
122 case "${host}" in
123 i[[3456789]]86-*-vsta) ;; # don't add gprof back in
124 i[[3456789]]86-*-go32*) ;; # don't add gprof back in
125
126
127
128 1.1 src/patchsets/binutils/2.21.1/15_all_alpha-relax-pr12608.patch
129
130 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/15_all_alpha-relax-pr12608.patch?rev=1.1&view=markup
131 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/15_all_alpha-relax-pr12608.patch?rev=1.1&content-type=text/plain
132
133 Index: 15_all_alpha-relax-pr12608.patch
134 ===================================================================
135 http://bugs.gentoo.org/366025
136 http://sourceware.org/bugzilla/show_bug.cgi?id=12608
137
138 taken from upstream cvs
139
140 ===================================================================
141 RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
142 retrieving revision 1.179
143 retrieving revision 1.180
144 diff -u -r1.179 -r1.180
145 --- src/bfd/elf64-alpha.c 2011/06/22 16:18:24 1.179
146 +++ src/bfd/elf64-alpha.c 2011/06/24 17:38:17 1.180
147 @@ -3508,6 +3508,13 @@
148 pos[3] = info->contents + gpdisp->r_offset;
149 pos[4] = pos[3] + gpdisp->r_addend;
150
151 + /* Beware of the compiler hoisting part of the sequence out a loop
152 + and adjusting the destination register for the TLSGD insn. If this
153 + happens, there will be a move into $16 before the JSR insn, so only
154 + transformations of the first insn pair should use this register. */
155 + tlsgd_reg = bfd_get_32 (info->abfd, pos[0]);
156 + tlsgd_reg = (tlsgd_reg >> 21) & 31;
157 +
158 /* Generally, the positions are not allowed to be out of order, lest the
159 modified insn sequence have different register lifetimes. We can make
160 an exception when pos 1 is adjacent to pos 0. */
161 @@ -3575,13 +3582,6 @@
162 use_gottprel = FALSE;
163 new_symndx = is_gd ? ELF64_R_SYM (irel->r_info) : STN_UNDEF;
164
165 - /* Beware of the compiler hoisting part of the sequence out a loop
166 - and adjusting the destination register for the TLSGD insn. If this
167 - happens, there will be a move into $16 before the JSR insn, so only
168 - transformations of the first insn pair should use this register. */
169 - tlsgd_reg = bfd_get_32 (info->abfd, pos[0]);
170 - tlsgd_reg = (tlsgd_reg >> 21) & 31;
171 -
172 switch (!dynamic && !info->link_info->shared)
173 {
174 case 1:
175
176
177
178 1.1 src/patchsets/binutils/2.21.1/20_all_ld-sysroot.patch
179
180 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/20_all_ld-sysroot.patch?rev=1.1&view=markup
181 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/20_all_ld-sysroot.patch?rev=1.1&content-type=text/plain
182
183 Index: 20_all_ld-sysroot.patch
184 ===================================================================
185 Signed-off-by: Sven Rebhan <odinshorse@××××××××××.com>
186
187 Always try to prepend the sysroot prefix to absolute filenames first.
188
189 http://bugs.gentoo.org/275666
190 http://sourceware.org/bugzilla/show_bug.cgi?id=10340
191
192 --- ld/ldfile.c
193 +++ ld/ldfile.c
194 @@ -308,18 +308,24 @@
195 directory first. */
196 if (! entry->is_archive)
197 {
198 - if (entry->sysrooted && IS_ABSOLUTE_PATH (entry->filename))
199 + /* For absolute pathnames, try to always open the file in the
200 + sysroot first. If this fails, try to open the file at the
201 + given location. */
202 + entry->sysrooted = is_sysrooted_pathname(entry->filename, FALSE);
203 + if (IS_ABSOLUTE_PATH (entry->filename) && ld_sysroot && ! entry->sysrooted)
204 {
205 char *name = concat (ld_sysroot, entry->filename,
206 (const char *) NULL);
207 if (ldfile_try_open_bfd (name, entry))
208 {
209 entry->filename = name;
210 + entry->sysrooted = TRUE;
211 return TRUE;
212 }
213 free (name);
214 }
215 - else if (ldfile_try_open_bfd (entry->filename, entry))
216 +
217 + if (ldfile_try_open_bfd (entry->filename, entry))
218 {
219 entry->sysrooted = IS_ABSOLUTE_PATH (entry->filename)
220 && is_sysrooted_pathname (entry->filename, TRUE);
221
222
223
224 1.1 src/patchsets/binutils/2.21.1/30_all_binutils-2.20-flexible-tests.patch
225
226 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/30_all_binutils-2.20-flexible-tests.patch?rev=1.1&view=markup
227 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/30_all_binutils-2.20-flexible-tests.patch?rev=1.1&content-type=text/plain
228
229 Index: 30_all_binutils-2.20-flexible-tests.patch
230 ===================================================================
231 making some of the address matches more flexible fixes tests when using
232 pax/relro/hash patches
233
234 --- binutils/ld/testsuite/ld-i386/hidden2.d
235 +++ binutils/ld/testsuite/ld-i386/hidden2.d
236 @@ -8,6 +8,6 @@
237 Disassembly of section .text:
238
239 [a-f0-9]+ <bar>:
240 -[ ]*[a-f0-9]+: e8 cf fe ff ff call 0 .*
241 +[ ]*[a-f0-9]+: e8 ([a-f0-9]{2} ){2}ff ff call 0 .*
242 [ ]*[a-f0-9]+: c3 ret
243 #pass
244 --- binutils/ld/testsuite/ld-x86-64/hidden2.d
245 +++ binutils/ld/testsuite/ld-x86-64/hidden2.d
246 @@ -8,6 +8,6 @@
247 Disassembly of section .text:
248
249 [a-f0-9]+ <bar>:
250 -[ ]*[a-f0-9]+: e8 33 fe ff ff callq 0 .*
251 +[ ]*[a-f0-9]+: e8 ([a-f0-9]{2} ){2}ff ff callq 0 .*
252 [ ]*[a-f0-9]+: c3 retq
253 #pass
254 --- binutils/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d
255 +++ binutils/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d
256 @@ -3,5 +3,5 @@
257 #target: x86_64-*-* i?86-*-*
258
259 #...
260 -[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x200|)@plt>
261 +[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x[a-f0-9]+|)@plt>
262 #pass
263 --- binutils/ld/testsuite/ld-ifunc/ifunc-1-x86.d
264 +++ binutils/ld/testsuite/ld-ifunc/ifunc-1-x86.d
265 @@ -3,5 +3,5 @@
266 #target: x86_64-*-* i?86-*-*
267
268 #...
269 -[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x220|)@plt>
270 +[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x[a-f0-9]+|)@plt>
271 #pass
272 --- binutils/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d
273 +++ binutils/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d
274 @@ -4,6 +4,6 @@
275 #target: x86_64-*-*
276
277 #...
278 -[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*\+0x220@plt>
279 -[ \t0-9a-f]+:[ \t0-9a-f]+lea[ \t]+.*\(%rip\),%rax.*[ \t0-9a-fq]+<\*ABS\*\+0x220@plt>
280 +[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*\+0x[a-f0-9]+@plt>
281 +[ \t0-9a-f]+:[ \t0-9a-f]+lea[ \t]+.*\(%rip\),%rax.*[ \t0-9a-fq]+<\*ABS\*\+0x[a-f0-9]+@plt>
282 #pass
283 --- binutils/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d
284 +++ binutils/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d
285 @@ -4,6 +4,6 @@
286 #target: x86_64-*-*
287
288 #...
289 -[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*\+0x220@plt>
290 -[ \t0-9a-f]+:[ \t0-9a-f]+lea[ \t]+.*\(%rip\),%rax.*[ \t0-9a-fq]+<\*ABS\*\+0x220@plt>
291 +[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*\+0x[a-f0-9]+@plt>
292 +[ \t0-9a-f]+:[ \t0-9a-f]+lea[ \t]+.*\(%rip\),%rax.*[ \t0-9a-fq]+<\*ABS\*\+0x[a-f0-9]+@plt>
293 #pass
294 --- binutils/ld/testsuite/ld-ifunc/ifunc-3a-x86.d
295 +++ binutils/ld/testsuite/ld-ifunc/ifunc-3a-x86.d
296 @@ -4,5 +4,5 @@
297 #target: x86_64-*-* i?86-*-*
298
299 #...
300 -[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x258|)@plt>
301 +[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x[a-f0-9]+|)@plt>
302 #pass
303
304
305
306 1.1 src/patchsets/binutils/2.21.1/63_all_binutils-2.21-pt-pax-flags-20101209.patch
307
308 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/63_all_binutils-2.21-pt-pax-flags-20101209.patch?rev=1.1&view=markup
309 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/63_all_binutils-2.21-pt-pax-flags-20101209.patch?rev=1.1&content-type=text/plain
310
311 Index: 63_all_binutils-2.21-pt-pax-flags-20101209.patch
312 ===================================================================
313 --- binutils-2.21/bfd/elf-bfd.h
314 +++ binutils-2.21/bfd/elf-bfd.h
315 @@ -1527,6 +1527,9 @@ struct elf_obj_tdata
316 /* Segment flags for the PT_GNU_STACK segment. */
317 unsigned int stack_flags;
318
319 + /* Segment flags for the PT_PAX_FLAGS segment. */
320 + unsigned int pax_flags;
321 +
322 /* Symbol version definitions in external objects. */
323 Elf_Internal_Verdef *verdef;
324
325 --- binutils-2.21/bfd/elf.c
326 +++ binutils-2.21/bfd/elf.c
327 @@ -1081,6 +1081,7 @@ get_segment_type (unsigned int p_type)
328 case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
329 case PT_GNU_STACK: pt = "STACK"; break;
330 case PT_GNU_RELRO: pt = "RELRO"; break;
331 + case PT_PAX_FLAGS: pt = "PAX_FLAGS"; break;
332 default: pt = NULL; break;
333 }
334 return pt;
335 @@ -2379,6 +2380,9 @@ bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index)
336 case PT_GNU_RELRO:
337 return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro");
338
339 + case PT_PAX_FLAGS:
340 + return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "pax_flags");
341 +
342 default:
343 /* Check for any processor-specific program segment types. */
344 bed = get_elf_backend_data (abfd);
345 @@ -3393,6 +3397,11 @@ get_program_header_size (bfd *abfd, struct bfd_link_info *info)
346 ++segs;
347 }
348
349 + {
350 + /* We need a PT_PAX_FLAGS segment. */
351 + ++segs;
352 + }
353 +
354 for (s = abfd->sections; s != NULL; s = s->next)
355 {
356 if ((s->flags & SEC_LOAD) != 0
357 @@ -3972,6 +3981,20 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
358 }
359 }
360
361 + {
362 + amt = sizeof (struct elf_segment_map);
363 + m = bfd_zalloc (abfd, amt);
364 + if (m == NULL)
365 + goto error_return;
366 + m->next = NULL;
367 + m->p_type = PT_PAX_FLAGS;
368 + m->p_flags = elf_tdata (abfd)->pax_flags;
369 + m->p_flags_valid = 1;
370 +
371 + *pm = m;
372 + pm = &m->next;
373 + }
374 +
375 free (sections);
376 elf_tdata (abfd)->segment_map = mfirst;
377 }
378 @@ -5176,7 +5199,8 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
379 6. PT_TLS segment includes only SHF_TLS sections.
380 7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments.
381 8. PT_DYNAMIC should not contain empty sections at the beginning
382 - (with the possible exception of .dynamic). */
383 + (with the possible exception of .dynamic).
384 + 9. PT_PAX_FLAGS segments do not include any sections. */
385 #define IS_SECTION_IN_INPUT_SEGMENT(section, segment, bed) \
386 ((((segment->p_paddr \
387 ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \
388 @@ -5184,6 +5208,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
389 && (section->flags & SEC_ALLOC) != 0) \
390 || IS_NOTE (segment, section)) \
391 && segment->p_type != PT_GNU_STACK \
392 + && segment->p_type != PT_PAX_FLAGS \
393 && (segment->p_type != PT_TLS \
394 || (section->flags & SEC_THREAD_LOCAL)) \
395 && (segment->p_type == PT_LOAD \
396 --- binutils-2.21/bfd/elflink.c
397 +++ binutils-2.21/bfd/elflink.c
398 @@ -5465,16 +5465,30 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
399 return TRUE;
400
401 bed = get_elf_backend_data (output_bfd);
402 +
403 + elf_tdata (output_bfd)->pax_flags = PF_NORANDEXEC;
404 + if (info->execheap)
405 + elf_tdata (output_bfd)->pax_flags |= PF_NOMPROTECT;
406 + else if (info->noexecheap)
407 + elf_tdata (output_bfd)->pax_flags |= PF_MPROTECT;
408 +
409 if (info->execstack)
410 - elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
411 + {
412 + elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
413 + elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
414 + }
415 else if (info->noexecstack)
416 - elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
417 + {
418 + elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
419 + elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
420 + }
421 else
422 {
423 bfd *inputobj;
424 asection *notesec = NULL;
425 int exec = 0;
426
427 + elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
428 for (inputobj = info->input_bfds;
429 inputobj;
430 inputobj = inputobj->link_next)
431 @@ -5487,7 +5501,11 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
432 if (s)
433 {
434 if (s->flags & SEC_CODE)
435 - exec = PF_X;
436 + {
437 + elf_tdata (output_bfd)->pax_flags &= ~PF_NOEMUTRAMP;
438 + elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
439 + exec = PF_X;
440 + }
441 notesec = s;
442 }
443 else if (bed->default_execstack)
444 --- binutils-2.21/binutils/readelf.c
445 +++ binutils-2.21/binutils/readelf.c
446 @@ -2556,6 +2556,7 @@ get_segment_type (unsigned long p_type)
447 return "GNU_EH_FRAME";
448 case PT_GNU_STACK: return "GNU_STACK";
449 case PT_GNU_RELRO: return "GNU_RELRO";
450 + case PT_PAX_FLAGS: return "PAX_FLAGS";
451
452 default:
453 if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
454 --- binutils-2.21/include/bfdlink.h
455 +++ binutils-2.21/include/bfdlink.h
456 @@ -319,6 +319,14 @@ struct bfd_link_info
457 /* TRUE if PT_GNU_RELRO segment should be created. */
458 unsigned int relro: 1;
459
460 + /* TRUE if PT_PAX_FLAGS segment should be created with PF_NOMPROTECT
461 + flags. */
462 + unsigned int execheap: 1;
463 +
464 + /* TRUE if PT_PAX_FLAGS segment should be created with PF_MPROTECT
465 + flags. */
466 + unsigned int noexecheap: 1;
467 +
468 /* TRUE if we should warn when adding a DT_TEXTREL to a shared object. */
469 unsigned int warn_shared_textrel: 1;
470
471 --- binutils-2.21/include/elf/common.h
472 +++ binutils-2.21/include/elf/common.h
473 @@ -422,6 +422,7 @@
474 #define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME /* Solaris uses the same value */
475 #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */
476 #define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */
477 +#define PT_PAX_FLAGS (PT_LOOS + 0x5041580) /* PaX flags */
478
479 /* Program segment permissions, in program header p_flags field. */
480
481 @@ -432,6 +433,21 @@
482 #define PF_MASKOS 0x0FF00000 /* New value, Oct 4, 1999 Draft */
483 #define PF_MASKPROC 0xF0000000 /* Processor-specific reserved bits */
484
485 +/* Flags to control PaX behavior. */
486 +
487 +#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
488 +#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
489 +#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
490 +#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
491 +#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
492 +#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
493 +#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
494 +#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
495 +#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
496 +#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
497 +#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
498 +#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
499 +
500 /* Values for section header, sh_type field. */
501
502 #define SHT_NULL 0 /* Section header table entry unused */
503 --- binutils-2.21/ld/emultempl/elf32.em
504 +++ binutils-2.21/ld/emultempl/elf32.em
505 @@ -2159,6 +2159,16 @@ fragment <<EOF
506 link_info.noexecstack = TRUE;
507 link_info.execstack = FALSE;
508 }
509 + else if (strcmp (optarg, "execheap") == 0)
510 + {
511 + link_info.execheap = TRUE;
512 + link_info.noexecheap = FALSE;
513 + }
514 + else if (strcmp (optarg, "noexecheap") == 0)
515 + {
516 + link_info.noexecheap = TRUE;
517 + link_info.execheap = FALSE;
518 + }
519 EOF
520
521 if test -n "$COMMONPAGESIZE"; then
522 @@ -2237,6 +2247,8 @@ fragment <<EOF
523 fprintf (file, _("\
524 -z execstack Mark executable as requiring executable stack\n"));
525 fprintf (file, _("\
526 + -z execheap Mark executable as requiring executable heap\n"));
527 + fprintf (file, _("\
528 -z initfirst Mark DSO to be initialized first at runtime\n"));
529 fprintf (file, _("\
530 -z interpose Mark object to interpose all DSOs but executable\n"));
531 @@ -2260,6 +2272,8 @@ fragment <<EOF
532 -z nodump Mark DSO not available to dldump\n"));
533 fprintf (file, _("\
534 -z noexecstack Mark executable as not requiring executable stack\n"));
535 + fprintf (file, _("\
536 + -z noexecheap Mark executable as not requiring executable heap\n"));
537 EOF
538
539 if test -n "$COMMONPAGESIZE"; then
540 --- binutils-2.21/ld/ldgram.y
541 +++ binutils-2.21/ld/ldgram.y
542 @@ -1116,6 +1116,8 @@ phdr_type:
543 $$ = exp_intop (0x6474e550);
544 else if (strcmp (s, "PT_GNU_STACK") == 0)
545 $$ = exp_intop (0x6474e551);
546 + else if (strcmp (s, "PT_PAX_FLAGS") == 0)
547 + $$ = exp_intop (0x65041580);
548 else
549 {
550 einfo (_("\
551
552
553
554 1.1 src/patchsets/binutils/2.21.1/65_all_binutils-2.20-amd64-32bit-path.patch
555
556 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/65_all_binutils-2.20-amd64-32bit-path.patch?rev=1.1&view=markup
557 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/65_all_binutils-2.20-amd64-32bit-path.patch?rev=1.1&content-type=text/plain
558
559 Index: 65_all_binutils-2.20-amd64-32bit-path.patch
560 ===================================================================
561 --- binutils/ld/emulparams/elf_i386.sh
562 +++ binutils/ld/emulparams/elf_i386.sh
563 @@ -13,3 +13,13 @@
564 NO_SMALL_DATA=yes
565 SEPARATE_GOTPLT=12
566 IREL_IN_PLT=
567 +
568 +# In Gentoo, we install 32bit libs into /lib32 in an
569 +# ABI setup with amd64/x86
570 +case "$target" in
571 + x86_64*-linux*)
572 + case "$EMULATION_NAME" in
573 + *i386*) LIBPATH_SUFFIX=32 ;;
574 + esac
575 + ;;
576 +esac
577
578
579
580 1.1 src/patchsets/binutils/2.21.1/66_all_binutils-2.18.50.0.2-warn-textrel.patch
581
582 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/66_all_binutils-2.18.50.0.2-warn-textrel.patch?rev=1.1&view=markup
583 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/66_all_binutils-2.18.50.0.2-warn-textrel.patch?rev=1.1&content-type=text/plain
584
585 Index: 66_all_binutils-2.18.50.0.2-warn-textrel.patch
586 ===================================================================
587 textrels are bad for forcing copy-on-write (this affects everyone),
588 and for security/runtime code generation, this affects security ppl.
589 But in either case, it doesn't matter who needs textrels, it's
590 the very fact that they're needed at all.
591
592 2006-06-10 Ned Ludd <solar@g.o>, Mike Frysinger <vapier@g.o>
593
594 * bfd/elflink.c (bfd_elf_final_link): Check all objects for TEXTRELs.
595 * ld/ldmain.c (main): Change textrel warning default to true.
596 * ld/testsuite/lib/ld-lib.exp (default_ld_simple_link): Scrub TEXTREL
597 warnings from ld output.
598
599 --- bfd/elflink.c
600 +++ bfd/elflink.c
601 @@ -8652,14 +8652,12 @@
602 goto error_return;
603
604 /* Check for DT_TEXTREL (late, in case the backend removes it). */
605 - if (info->warn_shared_textrel && info->shared)
606 + o = bfd_get_section_by_name (dynobj, ".dynamic");
607 + if (info->warn_shared_textrel && o != NULL)
608 {
609 bfd_byte *dyncon, *dynconend;
610
611 /* Fix up .dynamic entries. */
612 - o = bfd_get_section_by_name (dynobj, ".dynamic");
613 - BFD_ASSERT (o != NULL);
614 -
615 dyncon = o->contents;
616 dynconend = o->contents + o->size;
617 for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
618 @@ -8702,7 +8702,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
619 if (dyn.d_tag == DT_TEXTREL)
620 {
621 info->callbacks->einfo
622 - (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
623 + (_("%P: warning: creating a DT_TEXTREL in object.\n"));
624 break;
625 }
626 }
627 --- ld/ldmain.c
628 +++ ld/ldmain.c
629 @@ -282,2 +282,3 @@ main (int argc, char **argv)
630 link_info.spare_dynamic_tags = 5;
631 + link_info.warn_shared_textrel = TRUE;
632 link_info.sharable_sections = FALSE;
633 --- ld/testsuite/lib/ld-lib.exp
634 +++ ld/testsuite/lib/ld-lib.exp
635 @@ -181,6 +181,10 @@ proc default_ld_simple_link { ld target
636 # symbol, since the default linker script might use ENTRY.
637 regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
638
639 + # Gentoo tweak:
640 + # We want to ignore TEXTREL warnings since we force enable them by default
641 + regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output
642 +
643 if [string match "" $exec_output] then {
644 return 1
645 } else {
646
647
648
649 1.1 src/patchsets/binutils/2.21.1/75_all_binutils-default-test-flags.patch
650
651 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/75_all_binutils-default-test-flags.patch?rev=1.1&view=markup
652 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/75_all_binutils-default-test-flags.patch?rev=1.1&content-type=text/plain
653
654 Index: 75_all_binutils-default-test-flags.patch
655 ===================================================================
656 many tests rely on order of symbols and the gnu hash style/relro options
657 change that. so to avoid having to constantly thrash in the test files,
658 use the normal options that everyone tests against.
659
660 --- binutils/ld/testsuite/lib/ld-lib.exp
661 +++ binutils/ld/testsuite/lib/ld-lib.exp
662 @@ -84,7 +84,7 @@
663 global HOSTING_EMU
664
665 remote_file host delete $target
666 - return [run_host_cmd_yesno "$ld" "$HOSTING_EMU -o $target -r $objects"]
667 + return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv -z norelro -o $target -r $objects"]
668 }
669
670 # Check to see if ld is being invoked with a non-endian output format
671 @@ -158,7 +158,7 @@
672
673 remote_file host delete $target
674
675 - return [run_host_cmd_yesno "$ld" "$HOSTING_EMU $flags -o $target $objs $libs"]
676 + return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv -z norelro $flags -o $target $objs $libs"]
677 }
678
679 # Link a program using ld, without including any libraries.
680 @@ -189,7 +189,7 @@
681
682 remote_file host delete $target
683
684 - set exec_output [run_host_cmd "$ld" "$ldflags $flags -o $target $objects"]
685 + set exec_output [run_host_cmd "$ld" "--hash-style=sysv -z norelro $ldflags $flags -o $target $objects"]
686 set exec_output [prune_warnings $exec_output]
687
688 # We don't care if we get a warning about a non-existent start
689
690
691
692 1.1 src/patchsets/binutils/2.21.1/76_all_only-use-new-ld-dtags.patch.disabled
693
694 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/76_all_only-use-new-ld-dtags.patch.disabled?rev=1.1&view=markup
695 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/76_all_only-use-new-ld-dtags.patch.disabled?rev=1.1&content-type=text/plain
696
697 Index: 76_all_only-use-new-ld-dtags.patch.disabled
698 ===================================================================
699 Don't generate RPATH if we're going to be generating RUNPATH.
700
701 need to ponder what ramifications this has before enabling it
702
703 --- binutils/bfd/elflink.c
704 +++ binutils/bfd/elflink.c
705 @@ -5382,11 +5382,15 @@
706
707 indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath,
708 TRUE);
709 - if (indx == (bfd_size_type) -1
710 - || !_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
711 + if (indx == (bfd_size_type) -1)
712 return FALSE;
713
714 - if (info->new_dtags)
715 + if (!info->new_dtags)
716 + {
717 + if (!_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
718 + return FALSE;
719 + }
720 + else
721 {
722 _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx);
723 if (!_bfd_elf_add_dynamic_entry (info, DT_RUNPATH, indx))
724
725
726
727 1.1 src/patchsets/binutils/2.21.1/76_all_use-new-ld-dtags.patch
728
729 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/76_all_use-new-ld-dtags.patch?rev=1.1&view=markup
730 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/76_all_use-new-ld-dtags.patch?rev=1.1&content-type=text/plain
731
732 Index: 76_all_use-new-ld-dtags.patch
733 ===================================================================
734 --- binutils/ld/ldmain.c
735 +++ binutils/ld/ldmain.c
736 @@ -296,6 +296,7 @@ main (int argc, char **argv)
737
738 link_info.allow_undefined_version = TRUE;
739 link_info.keep_memory = TRUE;
740 + link_info.new_dtags = TRUE;
741 link_info.combreloc = TRUE;
742 link_info.strip_discarded = TRUE;
743 link_info.callbacks = &link_callbacks;
744 --- binutils/ld/ld.texinfo
745 +++ binutils/ld/ld.texinfo
746 @@ -2036,8 +2036,9 @@
747 systems may not understand them. If you specify
748 @option{--enable-new-dtags}, the dynamic tags will be created as needed.
749 If you specify @option{--disable-new-dtags}, no new dynamic tags will be
750 -created. By default, the new dynamic tags are not created. Note that
751 -those options are only available for ELF systems.
752 +created. On Gentoo, by default, the new dynamic tags are created (this
753 +differs from upstream behaviour). Note that those options are only
754 +available for ELF systems.
755
756 @kindex --hash-size=@var{number}
757 @item --hash-size=@var{number}
758
759
760
761 1.1 src/patchsets/binutils/2.21.1/77_all_generate-gnu-hash.patch
762
763 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/77_all_generate-gnu-hash.patch?rev=1.1&view=markup
764 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/77_all_generate-gnu-hash.patch?rev=1.1&content-type=text/plain
765
766 Index: 77_all_generate-gnu-hash.patch
767 ===================================================================
768 --- binutils/ld/ldmain.c
769 +++ binutils/ld/ldmain.c
770 @@ -273,2 +273,5 @@ main (int argc, char **argv)
771 link_info.emit_hash = TRUE;
772 +#ifndef __mips__
773 + link_info.emit_gnu_hash = TRUE;
774 +#endif
775 link_info.callbacks = &link_callbacks;
776
777
778
779 1.1 src/patchsets/binutils/2.21.1/78_all_use-relro.patch
780
781 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/78_all_use-relro.patch?rev=1.1&view=markup
782 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/78_all_use-relro.patch?rev=1.1&content-type=text/plain
783
784 Index: 78_all_use-relro.patch
785 ===================================================================
786 background:
787 http://www.airs.com/blog/archives/189
788
789 --- binutils/ld/ldmain.c
790 +++ binutils/ld/ldmain.c
791 @@ -293,2 +293,3 @@ main (int argc, char **argv)
792 link_info.combreloc = TRUE;
793 + link_info.relro = TRUE;
794 link_info.strip_discarded = TRUE;
795
796
797
798 1.1 src/patchsets/binutils/2.21.1/91_all_libiberty-pic.patch
799
800 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/91_all_libiberty-pic.patch?rev=1.1&view=markup
801 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/91_all_libiberty-pic.patch?rev=1.1&content-type=text/plain
802
803 Index: 91_all_libiberty-pic.patch
804 ===================================================================
805 --- libiberty/Makefile.in.mps 2004-05-13 15:53:17.000000000 +0200
806 +++ libiberty/Makefile.in 2004-05-13 15:52:53.000000000 +0200
807 @@ -224,6 +224,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA
808 $(AR) $(AR_FLAGS) $(TARGETLIB) \
809 $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
810 $(RANLIB) $(TARGETLIB); \
811 + cp $(TARGETLIB) ../ ; \
812 cd ..; \
813 else true; fi
814
815
816
817
818 1.1 src/patchsets/binutils/2.21.1/README.history
819
820 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/README.history?rev=1.1&view=markup
821 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.21.1/README.history?rev=1.1&content-type=text/plain
822
823 Index: README.history
824 ===================================================================
825 1.0 27.06.2010
826 + 03_all_binutils-2.15.92.0.2-ppc64-pie.patch
827 + 08_all_binutils-RPATH_ENVVAR-smack.patch
828 + 12_all_sh-targets.patch
829 + 15_all_alpha-relax-pr12608.patch
830 + 20_all_ld-sysroot.patch
831 + 30_all_binutils-2.20-flexible-tests.patch
832 + 63_all_binutils-2.21-pt-pax-flags-20101209.patch
833 + 65_all_binutils-2.20-amd64-32bit-path.patch
834 + 66_all_binutils-2.18.50.0.2-warn-textrel.patch
835 + 75_all_binutils-default-test-flags.patch
836 + 76_all_use-new-ld-dtags.patch
837 + 77_all_generate-gnu-hash.patch
838 + 78_all_use-relro.patch
839 + 91_all_libiberty-pic.patch