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.18.50.0.3: 03_all_binutils-2.15.92.0.2-ppc64-pie.patch 04_all_binutils-2.15.92.0.2-place-orphan.patch 08_all_binutils-RPATH_ENVVAR-smack.patch 12_all_sh-targets.patch 13_all_mips-gnu-hash-support.patch 42_all_012_check_ldrunpath_length.patch 63_all_binutils-2.18-pt-pax-flags-20070828.patch 65_all_binutils-2.18-amd64-32bit-path.patch 66_all_binutils-2.18.50.0.2-warn-textrel.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: Sun, 04 Nov 2007 20:05:53
Message-Id: E1Iolj8-0003w8-Ra@stork.gentoo.org
1 vapier 07/11/04 20:05:46
2
3 Added: 03_all_binutils-2.15.92.0.2-ppc64-pie.patch
4 04_all_binutils-2.15.92.0.2-place-orphan.patch
5 08_all_binutils-RPATH_ENVVAR-smack.patch
6 12_all_sh-targets.patch
7 13_all_mips-gnu-hash-support.patch
8 42_all_012_check_ldrunpath_length.patch
9 63_all_binutils-2.18-pt-pax-flags-20070828.patch
10 65_all_binutils-2.18-amd64-32bit-path.patch
11 66_all_binutils-2.18.50.0.2-warn-textrel.patch
12 76_all_only-use-new-ld-dtags.patch.disabled
13 76_all_use-new-ld-dtags.patch
14 77_all_generate-gnu-hash.patch
15 78_all_use-relro.patch 91_all_libiberty-pic.patch
16 README.history
17 Log:
18 initial 2.18.50.0.3 patchset import based on last 2.18.50.0.2 patchset
19
20 Revision Changes Path
21 1.1 src/patchsets/binutils/2.18.50.0.3/03_all_binutils-2.15.92.0.2-ppc64-pie.patch
22
23 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/03_all_binutils-2.15.92.0.2-ppc64-pie.patch?rev=1.1&view=markup
24 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/03_all_binutils-2.15.92.0.2-ppc64-pie.patch?rev=1.1&content-type=text/plain
25
26 Index: 03_all_binutils-2.15.92.0.2-ppc64-pie.patch
27 ===================================================================
28 --- bfd/elf64-ppc.c.jj 2004-09-27 16:46:06.000000000 -0400
29 +++ bfd/elf64-ppc.c 2004-10-04 09:09:50.000000000 -0400
30 @@ -9681,7 +9681,12 @@ ppc64_elf_relocate_section (bfd *output_
31 else if (!SYMBOL_REFERENCES_LOCAL (info, &h->elf)
32 && !is_opd
33 && r_type != R_PPC64_TOC)
34 - outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
35 + {
36 + outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
37 + if (h->elf.dynindx == -1
38 + && h->elf.root.type == bfd_link_hash_undefweak)
39 + memset (&outrel, 0, sizeof outrel);
40 + }
41 else
42 {
43 /* This symbol is local, or marked to become local,
44
45
46
47 1.1 src/patchsets/binutils/2.18.50.0.3/04_all_binutils-2.15.92.0.2-place-orphan.patch
48
49 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/04_all_binutils-2.15.92.0.2-place-orphan.patch?rev=1.1&view=markup
50 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/04_all_binutils-2.15.92.0.2-place-orphan.patch?rev=1.1&content-type=text/plain
51
52 Index: 04_all_binutils-2.15.92.0.2-place-orphan.patch
53 ===================================================================
54 2003-08-05 Jakub Jelinek <jakub@××××××.com>
55
56 * emulparams/elf64ppc.sh (OTHER_GOT_RELOC_SECTIONS): Add .rela.opd.
57
58 --- ld/emulparams/elf64ppc.sh.jj 2003-07-28 10:24:45.000000000 -0400
59 +++ ld/emulparams/elf64ppc.sh 2003-08-05 08:35:58.000000000 -0400
60 @@ -28,7 +28,8 @@ else
61 .toc 0 : { *(.toc) }"
62 fi
63 OTHER_GOT_RELOC_SECTIONS="
64 - .rela.toc ${RELOCATING-0} : { *(.rela.toc) }"
65 + .rela.toc ${RELOCATING-0} : { *(.rela.toc) }
66 + .rela.opd ${RELOCATING-0} : { *(.rela.opd) }"
67 OTHER_READWRITE_SECTIONS="
68 .toc1 ${RELOCATING-0}${RELOCATING+ALIGN(8)} : { *(.toc1) }
69 .opd ${RELOCATING-0}${RELOCATING+ALIGN(8)} : { KEEP (*(.opd)) }"
70
71
72
73 1.1 src/patchsets/binutils/2.18.50.0.3/08_all_binutils-RPATH_ENVVAR-smack.patch
74
75 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/08_all_binutils-RPATH_ENVVAR-smack.patch?rev=1.1&view=markup
76 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/08_all_binutils-RPATH_ENVVAR-smack.patch?rev=1.1&content-type=text/plain
77
78 Index: 08_all_binutils-RPATH_ENVVAR-smack.patch
79 ===================================================================
80 http://sourceware.org/ml/binutils/2007-07/msg00401.html
81 http://sourceware.org/bugzilla/show_bug.cgi?id=4970
82
83 --- configure
84 +++ configure
85 @@ -5355,6 +5355,7 @@
86 *-*-darwin* | *-*-rhapsody* ) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;;
87 *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
88 esac
89 +RPATH_ENVVAR="cant_touch_this_nah_nah_nah"
90
91 # Record target_configdirs and the configure arguments for target and
92 # build configuration in Makefile.
93
94
95
96 1.1 src/patchsets/binutils/2.18.50.0.3/12_all_sh-targets.patch
97
98 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/12_all_sh-targets.patch?rev=1.1&view=markup
99 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/12_all_sh-targets.patch?rev=1.1&content-type=text/plain
100
101 Index: 12_all_sh-targets.patch
102 ===================================================================
103 r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines
104
105 Likewise, binutils has no idea about any of these new targets either, so we
106 fix that up too.. now we're able to actually build a real toolchain for
107 sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
108 inept targets than that one, really. Go look, I promise).
109
110 --- binutils-2.16.90.0.2-dist/configure
111 +++ binutils-2.16.90.0.2/configure
112 @@ -1207,7 +1207,7 @@
113 am33_2.0-*-linux*)
114 noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
115 ;;
116 - sh-*-linux*)
117 + sh*-*-linux*)
118 noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
119 ;;
120 sh*-*-pe|mips*-*-pe|*arm-wince-pe)
121 @@ -1495,7 +1495,7 @@
122 romp-*-*)
123 noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
124 ;;
125 - sh-*-* | sh64-*-*)
126 + sh*-*-* | sh64-*-*)
127 case "${host}" in
128 i[3456789]86-*-vsta) ;; # don't add gprof back in
129 i[3456789]86-*-go32*) ;; # don't add gprof back in
130 --- binutils-2.16.90.0.2-dist/configure.ac
131 +++ binutils-2.16.90.0.2/configure.ac
132 @@ -424,7 +424,7 @@
133 am33_2.0-*-linux*)
134 noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
135 ;;
136 - sh-*-linux*)
137 + sh*-*-linux*)
138 noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
139 ;;
140 sh*-*-pe|mips*-*-pe|*arm-wince-pe)
141 @@ -712,7 +712,7 @@
142 romp-*-*)
143 noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
144 ;;
145 - sh-*-* | sh64-*-*)
146 + sh*-*-* | sh64-*-*)
147 case "${host}" in
148 i[[3456789]]86-*-vsta) ;; # don't add gprof back in
149 i[[3456789]]86-*-go32*) ;; # don't add gprof back in
150
151
152
153 1.1 src/patchsets/binutils/2.18.50.0.3/13_all_mips-gnu-hash-support.patch
154
155 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/13_all_mips-gnu-hash-support.patch?rev=1.1&view=markup
156 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/13_all_mips-gnu-hash-support.patch?rev=1.1&content-type=text/plain
157
158 Index: 13_all_mips-gnu-hash-support.patch
159 ===================================================================
160 add experimental support for GNU_HASH on mips
161
162 http://sourceware.org/ml/binutils/2007-08/msg00387.html
163
164 --- binutils-2.18/bfd/elfxx-mips.c
165 +++ binutils-2.18/bfd/elfxx-mips.c
166 @@ -497,6 +497,8 @@ static struct mips_got_entry *mips_elf_c
167 bfd_vma, unsigned long, struct mips_elf_link_hash_entry *, int);
168 static bfd_boolean mips_elf_sort_hash_table_f
169 (struct mips_elf_link_hash_entry *, void *);
170 +static bfd_boolean mips_elf_sort_gnu_hash_table_f
171 + (struct mips_elf_link_hash_entry *, void *);
172 static bfd_vma mips_elf_high
173 (bfd_vma);
174 static bfd_boolean mips16_stub_section_p
175 @@ -2819,6 +2821,64 @@ mips_elf_sort_hash_table_f (struct mips_
176 return TRUE;
177 }
178
179 +/* No sorting of dynindx is done here, since it is done by gun hash
180 + routine. Just track the lowest entry. */
181 +static bfd_boolean
182 +mips_elf_sort_gnu_hash_table (struct bfd_link_info *info)
183 +{
184 + struct mips_elf_hash_sort_data hsd;
185 + struct mips_got_info *g;
186 + bfd *dynobj;
187 +
188 + dynobj = elf_hash_table (info)->dynobj;
189 +
190 + g = mips_elf_got_info (dynobj, NULL);
191 +
192 + hsd.low = NULL;
193 + mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *)
194 + elf_hash_table (info)),
195 + mips_elf_sort_gnu_hash_table_f,
196 + &hsd);
197 + /* Now we know which dynamic symbole has the lowest dynamic symbol
198 + table index in the GOT. */
199 + g->global_gotsym = hsd.low;
200 +
201 + return TRUE;
202 +}
203 +
204 +static bfd_boolean
205 +mips_elf_sort_gnu_hash_table_f (struct mips_elf_link_hash_entry *h, void *data)
206 +{
207 + struct mips_elf_hash_sort_data *hsd = data;
208 +
209 + if (h->root.root.type == bfd_link_hash_warning)
210 + h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
211 +
212 + /* Symbols without dynamic symbol table entries aren't interesting
213 + at all */
214 + if (h->root.dynindx == -1)
215 + return TRUE;
216 +
217 + /* For gnu hash, symbols that don't need got is forced to have got entry.
218 + This is redundant, but since gnu hash restricts the .dynsym order and
219 + symbols that don't need got is *not* placed on upper part of external
220 + part of got, it is forced to have got entry.
221 + Track the lowest entry. */
222 + if (hsd->low == NULL)
223 + hsd->low = (struct elf_link_hash_entry *)h;
224 + else if (hsd->low->dynindx > h->root.dynindx)
225 + hsd->low = (struct elf_link_hash_entry *)h;
226 +
227 + /* Mark symbols that really needs GOT entry.
228 + Global symbols that don't need GOT entries get -1.
229 + We mark entry that really need GOT to st_other member.
230 + Also refer to glibc's mips/dl-machine.h */
231 + if (h->root.got.offset != MINUS_ONE)
232 + h->root.other |= STO_MIPS_GNUHASH;
233 +
234 + return TRUE;
235 +}
236 +
237 /* If H is a symbol that needs a global GOT entry, but has a dynamic
238 symbol table index lower than any we've seen to date, record it for
239 posterity. */
240 @@ -3532,8 +3592,12 @@ mips_elf_multi_got (bfd *abfd, struct bf
241 set_got_offset_arg.value = 1;
242 htab_traverse (g->got_entries, mips_elf_set_global_got_offset,
243 &set_got_offset_arg);
244 - if (! mips_elf_sort_hash_table (info, 1))
245 - return FALSE;
246 + if (info->emit_hash)
247 + if (! mips_elf_sort_hash_table (info, 1))
248 + return FALSE;
249 + if (info->emit_gnu_hash)
250 + if (! mips_elf_sort_gnu_hash_table (info))
251 + return FALSE;
252
253 /* Now go through the GOTs assigning them offset ranges.
254 [assigned_gotno, local_gotno[ will be set to the range of local
255 @@ -7248,11 +7312,19 @@ _bfd_mips_elf_always_size_sections (bfd
256 higher. Therefore, it make sense to put those symbols
257 that need GOT entries at the end of the symbol table. We
258 do that here. */
259 - if (! mips_elf_sort_hash_table (info, 1))
260 - return FALSE;
261 + if (info->emit_hash)
262 + if (! mips_elf_sort_hash_table (info, 1))
263 + return FALSE;
264 + if (info->emit_gnu_hash)
265 + if (! mips_elf_sort_gnu_hash_table (info))
266 + return FALSE;
267
268 - if (g->global_gotsym != NULL)
269 + if (g->global_gotsym != NULL) {
270 i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx;
271 + if (info->emit_gnu_hash) {
272 + i += g->global_gotsym->dynindx;
273 + }
274 + }
275 else
276 /* If there are no global symbols, or none requiring
277 relocations, then GLOBAL_GOTSYM will be NULL. */
278 @@ -7484,6 +7556,18 @@ _bfd_mips_elf_size_dynamic_sections (bfd
279 needed_relocs += arg.needed;
280 }
281
282 + /* -export-dynamic might have increased the symbol. For gnu hash
283 + to keep 1:1 entry with dynsym and got, increase additional sym
284 + to got entry. */
285 + if (info->emit_gnu_hash)
286 + {
287 + int increase;
288 + increase = elf_hash_table (info)->dynsymcount - g->global_gotno;
289 + s->size += increase * MIPS_ELF_GOT_SIZE (output_bfd);
290 + g->global_gotno += increase;
291 + mips_elf_resolve_final_got_entries (g);
292 + }
293 +
294 if (needed_relocs)
295 mips_elf_allocate_dynamic_relocations (dynobj, info,
296 needed_relocs);
297 @@ -10296,8 +10380,12 @@ _bfd_mips_elf_final_link (bfd *abfd, str
298 section above. */
299
300 dynsecsymcount = count_section_dynsyms (abfd, info);
301 - if (! mips_elf_sort_hash_table (info, dynsecsymcount + 1))
302 - return FALSE;
303 + if (info->emit_hash)
304 + if (! mips_elf_sort_hash_table (info, dynsecsymcount + 1))
305 + return FALSE;
306 + if (info->emit_gnu_hash)
307 + if (! mips_elf_sort_gnu_hash_table (info))
308 + return FALSE;
309
310 /* Make sure we didn't grow the global .got region. */
311 dynobj = elf_hash_table (info)->dynobj;
312 --- binutils-2.18/binutils/readelf.c
313 +++ binutils-2.18/binutils/readelf.c
314 @@ -6934,6 +6934,7 @@ get_mips_symbol_other (unsigned int othe
315 {
316 case STO_OPTIONAL: return "OPTIONAL";
317 case STO_MIPS16: return "MIPS16";
318 + case STO_MIPS_GNUHASH: return "GNUHASH";
319 default: return NULL;
320 }
321 }
322 --- binutils-2.18/include/elf/mips.h
323 +++ binutils-2.18/include/elf/mips.h
324 @@ -727,6 +727,9 @@ extern void bfd_mips_elf32_swap_reginfo_
325 is optional - if, at final link time, it cannot be found, no
326 error message should be produced. */
327 #define STO_OPTIONAL (1 << 2)
328 +/* This bit is used to mark symbol that needs GOT entry when
329 + gnu hash is specified as hash style. */
330 +#define STO_MIPS_GNUHASH (1 << 3)
331 /* A macro to examine the STO_OPTIONAL bit. */
332 #define ELF_MIPS_IS_OPTIONAL(other) ((other) & STO_OPTIONAL)
333
334 --- binutils-2.18/ld/emultempl/mipself.em
335 +++ binutils-2.18/ld/emultempl/mipself.em
336 @@ -25,12 +25,18 @@ mips_after_parse (void)
337 /* .gnu.hash and the MIPS ABI require .dynsym to be sorted in different
338 ways. .gnu.hash needs symbols to be grouped by hash code whereas the
339 MIPS ABI requires a mapping between the GOT and the symbol table. */
340 - if (link_info.emit_gnu_hash)
341 + /* This constraint is solved by re-ordering GOT section, GOT is now
342 + sorted in 1:1 with gnu hash, which is also 1:1 mapping with .dynsym */
343 + if (link_info.emit_gnu_hash && 0)
344 {
345 einfo ("%X%P: .gnu.hash is incompatible with the MIPS ABI\n");
346 link_info.emit_hash = TRUE;
347 link_info.emit_gnu_hash = FALSE;
348 }
349 + /* In current MIPS gnu hash method, both is not an option. force it
350 + to gnu hash if both is selected. */
351 + if (link_info.emit_gnu_hash && link_info.emit_hash)
352 + link_info.emit_hash = FALSE;
353 after_parse_default ();
354 }
355 EOF
356
357
358
359 1.1 src/patchsets/binutils/2.18.50.0.3/42_all_012_check_ldrunpath_length.patch
360
361 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/42_all_012_check_ldrunpath_length.patch?rev=1.1&view=markup
362 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/42_all_012_check_ldrunpath_length.patch?rev=1.1&content-type=text/plain
363
364 Index: 42_all_012_check_ldrunpath_length.patch
365 ===================================================================
366 #!/bin/sh -e
367 ## 012_check_ldrunpath_length.dpatch by Chris Chimelis <chris@××××××.org>
368 ##
369 ## All lines beginning with `## DP:' are a description of the patch.
370 ## DP: Only generate an RPATH entry if LD_RUN_PATH is not empty, for
371 ## DP: cases where -rpath isn't specified. (#151024)
372
373 if [ $# -ne 1 ]; then
374 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
375 exit 1
376 fi
377
378 [ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
379 patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
380
381 case "$1" in
382 -patch) patch $patch_opts -p1 < $0;;
383 -unpatch) patch $patch_opts -p1 -R < $0;;
384 *)
385 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
386 exit 1;;
387 esac
388
389 exit 0
390
391 @DPATCH@
392 diff -urNad /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em binutils-2.15/ld/emultempl/elf32.em
393 --- /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em 2004-05-21 23:12:58.000000000 +0100
394 +++ binutils-2.15/ld/emultempl/elf32.em 2004-05-21 23:12:59.000000000 +0100
395 @@ -692,6 +692,8 @@
396 && command_line.rpath == NULL)
397 {
398 lib_path = (const char *) getenv ("LD_RUN_PATH");
399 + if ((lib_path) && (strlen (lib_path) == 0))
400 + lib_path = NULL;
401 if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
402 force))
403 break;
404 @@ -871,6 +873,8 @@
405 rpath = command_line.rpath;
406 if (rpath == NULL)
407 rpath = (const char *) getenv ("LD_RUN_PATH");
408 + if ((rpath) && (strlen (rpath) == 0))
409 + rpath = NULL;
410 if (! (bfd_elf_size_dynamic_sections
411 (output_bfd, command_line.soname, rpath,
412 command_line.filter_shlib,
413
414
415
416 1.1 src/patchsets/binutils/2.18.50.0.3/63_all_binutils-2.18-pt-pax-flags-20070828.patch
417
418 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/63_all_binutils-2.18-pt-pax-flags-20070828.patch?rev=1.1&view=markup
419 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/63_all_binutils-2.18-pt-pax-flags-20070828.patch?rev=1.1&content-type=text/plain
420
421 Index: 63_all_binutils-2.18-pt-pax-flags-20070828.patch
422 ===================================================================
423 --- binutils-2.18/bfd/elf-bfd.h
424 +++ binutils-2.18/bfd/elf-bfd.h
425 @@ -1431,6 +1431,9 @@ struct elf_obj_tdata
426 /* Should the PT_GNU_RELRO segment be emitted? */
427 bfd_boolean relro;
428
429 + /* Segment flags for the PT_PAX_FLAGS segment. */
430 + unsigned int pax_flags;
431 +
432 /* Symbol version definitions in external objects. */
433 Elf_Internal_Verdef *verdef;
434
435 --- binutils-2.18/bfd/elf.c
436 +++ binutils-2.18/bfd/elf.c
437 @@ -1085,6 +1085,7 @@ get_segment_type (unsigned int p_type)
438 case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
439 case PT_GNU_STACK: pt = "STACK"; break;
440 case PT_GNU_RELRO: pt = "RELRO"; break;
441 + case PT_PAX_FLAGS: pt = "PAX_FLAGS"; break;
442 default: pt = NULL; break;
443 }
444 return pt;
445 @@ -2361,6 +2362,9 @@ bfd_section_from_phdr (bfd *abfd, Elf_In
446 case PT_GNU_RELRO:
447 return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro");
448
449 + case PT_PAX_FLAGS:
450 + return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "pax_flags");
451 +
452 default:
453 /* Check for any processor-specific program segment types. */
454 bed = get_elf_backend_data (abfd);
455 @@ -3341,6 +3345,11 @@ get_program_header_size (bfd *abfd, stru
456 ++segs;
457 }
458
459 + {
460 + /* We need a PT_PAX_FLAGS segment. */
461 + ++segs;
462 + }
463 +
464 for (s = abfd->sections; s != NULL; s = s->next)
465 {
466 if ((s->flags & SEC_LOAD) != 0
467 @@ -3868,6 +3877,20 @@ _bfd_elf_map_sections_to_segments (bfd *
468 pm = &m->next;
469 }
470
471 + {
472 + amt = sizeof (struct elf_segment_map);
473 + m = bfd_zalloc (abfd, amt);
474 + if (m == NULL)
475 + goto error_return;
476 + m->next = NULL;
477 + m->p_type = PT_PAX_FLAGS;
478 + m->p_flags = elf_tdata (abfd)->pax_flags;
479 + m->p_flags_valid = 1;
480 +
481 + *pm = m;
482 + pm = &m->next;
483 + }
484 +
485 free (sections);
486 elf_tdata (abfd)->segment_map = mfirst;
487 }
488 @@ -5010,7 +5033,8 @@ rewrite_elf_program_header (bfd *ibfd, b
489 6. PT_TLS segment includes only SHF_TLS sections.
490 7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments.
491 8. PT_DYNAMIC should not contain empty sections at the beginning
492 - (with the possible exception of .dynamic). */
493 + (with the possible exception of .dynamic).
494 + 9. PT_PAX_FLAGS segments does not include any sections. */
495 #define IS_SECTION_IN_INPUT_SEGMENT(section, segment, bed) \
496 ((((segment->p_paddr \
497 ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \
498 @@ -5018,6 +5042,7 @@ rewrite_elf_program_header (bfd *ibfd, b
499 && (section->flags & SEC_ALLOC) != 0) \
500 || IS_COREFILE_NOTE (segment, section)) \
501 && segment->p_type != PT_GNU_STACK \
502 + && segment->p_type != PT_PAX_FLAGS \
503 && (segment->p_type != PT_TLS \
504 || (section->flags & SEC_THREAD_LOCAL)) \
505 && (segment->p_type == PT_LOAD \
506 --- binutils-2.18/bfd/elflink.c
507 +++ binutils-2.18/bfd/elflink.c
508 @@ -5328,16 +5328,30 @@ bfd_elf_size_dynamic_sections (bfd *outp
509 return TRUE;
510
511 bed = get_elf_backend_data (output_bfd);
512 + elf_tdata (output_bfd)->pax_flags = PF_NORANDEXEC;
513 +
514 + if (info->execheap)
515 + elf_tdata (output_bfd)->pax_flags |= PF_NOMPROTECT;
516 + else if (info->noexecheap)
517 + elf_tdata (output_bfd)->pax_flags |= PF_MPROTECT;
518 +
519 if (info->execstack)
520 - elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
521 + {
522 + elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
523 + elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
524 + }
525 else if (info->noexecstack)
526 - elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
527 + {
528 + elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
529 + elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
530 + }
531 else
532 {
533 bfd *inputobj;
534 asection *notesec = NULL;
535 int exec = 0;
536
537 + elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
538 for (inputobj = info->input_bfds;
539 inputobj;
540 inputobj = inputobj->link_next)
541 @@ -5350,7 +5364,11 @@ bfd_elf_size_dynamic_sections (bfd *outp
542 if (s)
543 {
544 if (s->flags & SEC_CODE)
545 - exec = PF_X;
546 + {
547 + elf_tdata (output_bfd)->pax_flags &= ~PF_NOEMUTRAMP;
548 + elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
549 + exec = PF_X;
550 + }
551 notesec = s;
552 }
553 else if (bed->default_execstack)
554 --- binutils-2.18/binutils/readelf.c
555 +++ binutils-2.18/binutils/readelf.c
556 @@ -2469,6 +2469,7 @@ get_segment_type (unsigned long p_type)
557 return "GNU_EH_FRAME";
558 case PT_GNU_STACK: return "GNU_STACK";
559 case PT_GNU_RELRO: return "GNU_RELRO";
560 + case PT_PAX_FLAGS: return "PAX_FLAGS";
561
562 default:
563 if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
564 --- binutils-2.18/include/bfdlink.h
565 +++ binutils-2.18/include/bfdlink.h
566 @@ -321,6 +321,14 @@ struct bfd_link_info
567 /* TRUE if PT_GNU_RELRO segment should be created. */
568 unsigned int relro: 1;
569
570 + /* TRUE if PT_PAX_FLAGS segment should be created with PF_NOMPROTECT
571 + flags. */
572 + unsigned int execheap: 1;
573 +
574 + /* TRUE if PT_PAX_FLAGS segment should be created with PF_MPROTECT
575 + flags. */
576 + unsigned int noexecheap: 1;
577 +
578 /* TRUE if we should warn when adding a DT_TEXTREL to a shared object. */
579 unsigned int warn_shared_textrel: 1;
580
581 --- binutils-2.18/include/elf/common.h
582 +++ binutils-2.18/include/elf/common.h
583 @@ -309,6 +309,7 @@
584 #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */
585 #define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */
586 #define PT_GNU_SHR (PT_LOOS + 0x474e554) /* Sharable segment */
587 +#define PT_PAX_FLAGS (PT_LOOS + 0x5041580) /* PaX flags */
588
589 /* Program segment permissions, in program header p_flags field. */
590
591 @@ -319,6 +320,21 @@
592 #define PF_MASKOS 0x0FF00000 /* New value, Oct 4, 1999 Draft */
593 #define PF_MASKPROC 0xF0000000 /* Processor-specific reserved bits */
594
595 +/* Flags to control PaX behavior. */
596 +
597 +#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
598 +#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
599 +#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
600 +#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
601 +#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
602 +#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
603 +#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
604 +#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
605 +#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
606 +#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
607 +#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
608 +#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
609 +
610 /* Values for section header, sh_type field. */
611
612 #define SHT_NULL 0 /* Section header table entry unused */
613 --- binutils-2.18/ld/emultempl/elf32.em
614 +++ binutils-2.18/ld/emultempl/elf32.em
615 @@ -2132,6 +2132,16 @@ fragment <<EOF
616 link_info.noexecstack = TRUE;
617 link_info.execstack = FALSE;
618 }
619 + else if (strcmp (optarg, "execheap") == 0)
620 + {
621 + link_info.execheap = TRUE;
622 + link_info.noexecheap = FALSE;
623 + }
624 + else if (strcmp (optarg, "noexecheap") == 0)
625 + {
626 + link_info.noexecheap = TRUE;
627 + link_info.execheap = FALSE;
628 + }
629 EOF
630
631 if test -n "$COMMONPAGESIZE"; then
632 @@ -2205,6 +2215,8 @@ fragment <<EOF
633 -z defs Report unresolved symbols in object files.\n"));
634 fprintf (file, _("\
635 -z execstack Mark executable as requiring executable stack\n"));
636 + fprintf (file, _("\
637 + -z execheap\t\tMark executable as requiring executable heap\n"));
638 fprintf (file, _("\
639 -z initfirst Mark DSO to be initialized first at runtime\n"));
640 fprintf (file, _("\
641 @@ -2217,6 +2228,8 @@ fragment <<EOF
642 -z nodump Mark DSO not available to dldump\n"));
643 fprintf (file, _("\
644 -z noexecstack Mark executable as not requiring executable stack\n"));
645 + fprintf (file, _("\
646 + -z noexecheap\tMark executable as not requiring executable heap\n"));
647 EOF
648
649 if test -n "$COMMONPAGESIZE"; then
650 --- binutils-2.18/ld/ldgram.y
651 +++ binutils-2.18/ld/ldgram.y
652 @@ -1099,6 +1099,8 @@ phdr_type:
653 $$ = exp_intop (0x6474e550);
654 else if (strcmp (s, "PT_GNU_STACK") == 0)
655 $$ = exp_intop (0x6474e551);
656 + else if (strcmp (s, "PT_PAX_FLAGS") == 0)
657 + $$ = exp_intop (0x65041580);
658 else
659 {
660 einfo (_("\
661
662
663
664 1.1 src/patchsets/binutils/2.18.50.0.3/65_all_binutils-2.18-amd64-32bit-path.patch
665
666 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/65_all_binutils-2.18-amd64-32bit-path.patch?rev=1.1&view=markup
667 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/65_all_binutils-2.18-amd64-32bit-path.patch?rev=1.1&content-type=text/plain
668
669 Index: 65_all_binutils-2.18-amd64-32bit-path.patch
670 ===================================================================
671 --- binutils/ld/emulparams/elf_i386.sh
672 +++ binutils/ld/emulparams/elf_i386.sh
673 @@ -13,3 +13,13 @@
674 NO_SMALL_DATA=yes
675 SEPARATE_GOTPLT=12
676 SHARABLE_SECTIONS=yes
677 +
678 +# In Gentoo, we install 32bit libs into /lib32 in an
679 +# ABI setup with amd64/x86
680 +case "$target" in
681 + x86_64*-linux*)
682 + case "$EMULATION_NAME" in
683 + *i386*) LIBPATH_SUFFIX=32 ;;
684 + esac
685 + ;;
686 +esac
687
688
689
690 1.1 src/patchsets/binutils/2.18.50.0.3/66_all_binutils-2.18.50.0.2-warn-textrel.patch
691
692 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/66_all_binutils-2.18.50.0.2-warn-textrel.patch?rev=1.1&view=markup
693 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/66_all_binutils-2.18.50.0.2-warn-textrel.patch?rev=1.1&content-type=text/plain
694
695 Index: 66_all_binutils-2.18.50.0.2-warn-textrel.patch
696 ===================================================================
697 textrels are bad for forcing copy-on-write (this affects everyone),
698 and for security/runtime code generation, this affects security ppl.
699 But in either case, it doesn't matter who needs textrels, it's
700 the very fact that they're needed at all.
701
702 2006-06-10 Ned Ludd <solar@g.o>, Mike Frysinger <vapier@g.o>
703
704 * bfd/elflink.c (bfd_elf_final_link): Check all objects for TEXTRELs.
705 * ld/ldmain.c (main): Change textrel warning default to true.
706 * ld/testsuite/lib/ld-lib.exp (default_ld_simple_link): Scrub TEXTREL
707 warnings from ld output.
708
709 --- bfd/elflink.c
710 +++ bfd/elflink.c
711 @@ -8652,14 +8652,12 @@
712 goto error_return;
713
714 /* Check for DT_TEXTREL (late, in case the backend removes it). */
715 - if (info->warn_shared_textrel && info->shared)
716 + o = bfd_get_section_by_name (dynobj, ".dynamic");
717 + if (info->warn_shared_textrel && o != NULL)
718 {
719 bfd_byte *dyncon, *dynconend;
720
721 /* Fix up .dynamic entries. */
722 - o = bfd_get_section_by_name (dynobj, ".dynamic");
723 - BFD_ASSERT (o != NULL);
724 -
725 dyncon = o->contents;
726 dynconend = o->contents + o->size;
727 for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
728 @@ -8702,7 +8702,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
729 if (dyn.d_tag == DT_TEXTREL)
730 {
731 info->callbacks->einfo
732 - (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
733 + (_("%P: warning: creating a DT_TEXTREL in object.\n"));
734 break;
735 }
736 }
737 --- ld/ldmain.c
738 +++ ld/ldmain.c
739 @@ -282,2 +282,3 @@ main (int argc, char **argv)
740 link_info.spare_dynamic_tags = 5;
741 + link_info.warn_shared_textrel = TRUE;
742 link_info.sharable_sections = FALSE;
743 --- ld/testsuite/lib/ld-lib.exp
744 +++ ld/testsuite/lib/ld-lib.exp
745 @@ -181,6 +181,10 @@ proc default_ld_simple_link { ld target
746 # symbol, since the default linker script might use ENTRY.
747 regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
748
749 + # Gentoo tweak:
750 + # We want to ignore TEXTREL warnings since we force enable them by default
751 + regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output
752 +
753 if [string match "" $exec_output] then {
754 return 1
755 } else {
756
757
758
759 1.1 src/patchsets/binutils/2.18.50.0.3/76_all_only-use-new-ld-dtags.patch.disabled
760
761 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/76_all_only-use-new-ld-dtags.patch.disabled?rev=1.1&view=markup
762 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/76_all_only-use-new-ld-dtags.patch.disabled?rev=1.1&content-type=text/plain
763
764 Index: 76_all_only-use-new-ld-dtags.patch.disabled
765 ===================================================================
766 Don't generate RPATH if we're going to be generating RUNPATH.
767
768 need to ponder what ramifications this has before enabling it
769
770 --- binutils/bfd/elflink.c
771 +++ binutils/bfd/elflink.c
772 @@ -5382,11 +5382,15 @@
773
774 indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath,
775 TRUE);
776 - if (indx == (bfd_size_type) -1
777 - || !_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
778 + if (indx == (bfd_size_type) -1)
779 return FALSE;
780
781 - if (info->new_dtags)
782 + if (!info->new_dtags)
783 + {
784 + if (!_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
785 + return FALSE;
786 + }
787 + else
788 {
789 _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx);
790 if (!_bfd_elf_add_dynamic_entry (info, DT_RUNPATH, indx))
791
792
793
794 1.1 src/patchsets/binutils/2.18.50.0.3/76_all_use-new-ld-dtags.patch
795
796 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/76_all_use-new-ld-dtags.patch?rev=1.1&view=markup
797 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/76_all_use-new-ld-dtags.patch?rev=1.1&content-type=text/plain
798
799 Index: 76_all_use-new-ld-dtags.patch
800 ===================================================================
801 --- binutils/ld/ldmain.c
802 +++ binutils/ld/ldmain.c
803 @@ -296,6 +296,7 @@ main (int argc, char **argv)
804
805 link_info.allow_undefined_version = TRUE;
806 link_info.keep_memory = TRUE;
807 + link_info.new_dtags = TRUE;
808 link_info.combreloc = TRUE;
809 link_info.strip_discarded = TRUE;
810 link_info.callbacks = &link_callbacks;
811
812
813
814 1.1 src/patchsets/binutils/2.18.50.0.3/77_all_generate-gnu-hash.patch
815
816 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/77_all_generate-gnu-hash.patch?rev=1.1&view=markup
817 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/77_all_generate-gnu-hash.patch?rev=1.1&content-type=text/plain
818
819 Index: 77_all_generate-gnu-hash.patch
820 ===================================================================
821 --- binutils/ld/ldmain.c
822 +++ binutils/ld/ldmain.c
823 @@ -273,2 +273,3 @@ main (int argc, char **argv)
824 link_info.emit_hash = TRUE;
825 + link_info.emit_gnu_hash = TRUE;
826 link_info.callbacks = &link_callbacks;
827
828
829
830 1.1 src/patchsets/binutils/2.18.50.0.3/78_all_use-relro.patch
831
832 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/78_all_use-relro.patch?rev=1.1&view=markup
833 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/78_all_use-relro.patch?rev=1.1&content-type=text/plain
834
835 Index: 78_all_use-relro.patch
836 ===================================================================
837 --- binutils/ld/ldmain.c
838 +++ binutils/ld/ldmain.c
839 @@ -293,2 +293,3 @@ main (int argc, char **argv)
840 link_info.combreloc = TRUE;
841 + link_info.relro = TRUE;
842 link_info.strip_discarded = TRUE;
843
844
845
846 1.1 src/patchsets/binutils/2.18.50.0.3/91_all_libiberty-pic.patch
847
848 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/91_all_libiberty-pic.patch?rev=1.1&view=markup
849 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/91_all_libiberty-pic.patch?rev=1.1&content-type=text/plain
850
851 Index: 91_all_libiberty-pic.patch
852 ===================================================================
853 --- libiberty/Makefile.in.mps 2004-05-13 15:53:17.000000000 +0200
854 +++ libiberty/Makefile.in 2004-05-13 15:52:53.000000000 +0200
855 @@ -224,6 +224,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA
856 $(AR) $(AR_FLAGS) $(TARGETLIB) \
857 $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
858 $(RANLIB) $(TARGETLIB); \
859 + cp $(TARGETLIB) ../ ; \
860 cd ..; \
861 else true; fi
862
863
864
865
866 1.1 src/patchsets/binutils/2.18.50.0.3/README.history
867
868 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/README.history?rev=1.1&view=markup
869 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/binutils/2.18.50.0.3/README.history?rev=1.1&content-type=text/plain
870
871 Index: README.history
872 ===================================================================
873 1.0 04.11.2007
874 + 03_all_binutils-2.15.92.0.2-ppc64-pie.patch
875 + 04_all_binutils-2.15.92.0.2-place-orphan.patch
876 + 08_all_binutils-RPATH_ENVVAR-smack.patch
877 + 12_all_sh-targets.patch
878 + 13_all_mips-gnu-hash-support.patch
879 + 42_all_012_check_ldrunpath_length.patch
880 + 63_all_binutils-2.18-pt-pax-flags-20070828.patch
881 + 65_all_binutils-2.18-amd64-32bit-path.patch
882 + 66_all_binutils-2.18.50.0.2-warn-textrel.patch
883 + 76_all_use-new-ld-dtags.patch
884 + 77_all_generate-gnu-hash.patch
885 + 78_all_use-relro.patch
886 + 91_all_libiberty-pic.patch
887
888
889
890 --
891 gentoo-commits@g.o mailing list