Gentoo Archives: gentoo-commits

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