1 diff -uNr binutils-2.17.orig/bfd/bfd-in2.h binutils-2.17/bfd/bfd-in2.h
2 --- binutils-2.17.orig/bfd/bfd-in2.h 2006-03-26 01:38:42.000000000 +0100
3 +++ binutils-2.17/bfd/bfd-in2.h 2006-10-21 13:53:23.000000000 +0200
8 +enum notice_asneeded_action {
14 extern bfd_boolean bfd_elf_record_link_assignment
15 (bfd *, struct bfd_link_info *, const char *, bfd_boolean,
17 diff -uNr binutils-2.17.orig/bfd/bfd-in.h binutils-2.17/bfd/bfd-in.h
18 --- binutils-2.17.orig/bfd/bfd-in.h 2006-03-16 13:20:15.000000000 +0100
19 +++ binutils-2.17/bfd/bfd-in.h 2006-10-21 13:53:23.000000000 +0200
24 +enum notice_asneeded_action {
30 extern bfd_boolean bfd_elf_record_link_assignment
31 (bfd *, struct bfd_link_info *, const char *, bfd_boolean,
33 diff -uNr binutils-2.17.orig/bfd/ChangeLog binutils-2.17/bfd/ChangeLog
34 --- binutils-2.17.orig/bfd/ChangeLog 2006-06-23 20:18:16.000000000 +0200
35 +++ binutils-2.17/bfd/ChangeLog 2006-10-21 13:53:23.000000000 +0200
37 +2006-08-08 Nick Clifton <nickc@redhat.com>
40 + * coffcode.h (coff_new_section_hook): Only modify the section
41 + symbol of sections which were created by the user.
43 +2006-07-19 Alan Modra <amodra@bigpond.net.au>
45 + * bfd-in.h (enum notice_asneeded_action): Define.
46 + * bfd-in2.h: Regenerate.
47 + * elflink.c (elf_link_add_object_symbols): Call linker "notice"
48 + function with NULL name for as-needed handling.
50 +2006-07-12 Matthew R. Dempsky <mrd@alkemio.org>
52 + * cpu-m68k.c (bfd_m68k_compatible): Handle CPU32.
54 +2006-06-23 Daniel Jacobowitz <dan@codesourcery.com>
56 + * Makefile.am: Clear RELEASE.
57 + * Makefile.in: Regenerated.
59 2006-06-23 Daniel Jacobowitz <dan@codesourcery.com>
61 * configure.in: Update version to 2.17.
62 diff -uNr binutils-2.17.orig/bfd/coffcode.h binutils-2.17/bfd/coffcode.h
63 --- binutils-2.17.orig/bfd/coffcode.h 2005-10-25 19:40:09.000000000 +0200
64 +++ binutils-2.17/bfd/coffcode.h 2006-10-21 13:53:24.000000000 +0200
67 coff_new_section_hook (bfd * abfd, asection * section)
69 - combined_entry_type *native;
72 section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;
75 @@ -1560,27 +1557,34 @@
76 section->alignment_power = bfd_xcoff_data_align_power (abfd);
79 - /* Allocate aux records for section symbols, to store size and
82 - @@ The 10 is a guess at a plausible maximum number of aux entries
83 - (but shouldn't be a constant). */
84 - amt = sizeof (combined_entry_type) * 10;
85 - native = bfd_zalloc (abfd, amt);
89 - /* We don't need to set up n_name, n_value, or n_scnum in the native
90 - symbol information, since they'll be overridden by the BFD symbol
91 - anyhow. However, we do need to set the type and storage class,
92 - in case this symbol winds up getting written out. The value 0
93 - for n_numaux is already correct. */
95 - native->u.syment.n_type = T_NULL;
96 - native->u.syment.n_sclass = C_STAT;
97 + /* PR binutils/2724: Only real sections have a symbol that
98 + has the coff_symbol_type structure allocated for it. */
99 + if (! bfd_is_const_section (section))
101 + combined_entry_type *native;
104 + /* Allocate aux records for section symbols, to store size and
107 + @@ The 10 is a guess at a plausible maximum number of aux entries
108 + (but shouldn't be a constant). */
109 + amt = sizeof (combined_entry_type) * 10;
110 + native = bfd_zalloc (abfd, amt);
111 + if (native == NULL)
114 - coffsymbol (section->symbol)->native = native;
115 + /* We don't need to set up n_name, n_value, or n_scnum in the native
116 + symbol information, since they'll be overridden by the BFD symbol
117 + anyhow. However, we do need to set the type and storage class,
118 + in case this symbol winds up getting written out. The value 0
119 + for n_numaux is already correct. */
120 + native->u.syment.n_type = T_NULL;
121 + native->u.syment.n_sclass = C_STAT;
123 + coffsymbol (section->symbol)->native = native;
126 coff_set_custom_section_alignment (abfd, section,
127 coff_section_alignment_table,
128 coff_section_alignment_table_size);
129 diff -uNr binutils-2.17.orig/bfd/cpu-m68k.c binutils-2.17/bfd/cpu-m68k.c
130 --- binutils-2.17.orig/bfd/cpu-m68k.c 2006-03-25 11:24:27.000000000 +0100
131 +++ binutils-2.17/bfd/cpu-m68k.c 2006-10-21 13:53:24.000000000 +0200
133 if (a->mach <= bfd_mach_m68060 && b->mach <= bfd_mach_m68060)
134 /* Merge m68k machine. */
135 return a->mach > b->mach ? a : b;
136 + else if (a->mach == bfd_mach_cpu32 && b->mach == bfd_mach_cpu32)
137 + /* CPU32 is compatible with itself. */
139 else if (a->mach >= bfd_mach_mcf_isa_a_nodiv
140 && b->mach >= bfd_mach_mcf_isa_a_nodiv)
142 diff -uNr binutils-2.17.orig/bfd/elflink.c binutils-2.17/bfd/elflink.c
143 --- binutils-2.17.orig/bfd/elflink.c 2006-05-22 17:06:36.000000000 +0200
144 +++ binutils-2.17/bfd/elflink.c 2006-10-21 13:53:24.000000000 +0200
145 @@ -3496,6 +3496,13 @@
146 if (alloc_mark == NULL)
147 goto error_free_vers;
149 + /* Make a special call to the linker "notice" function to
150 + tell it that we are about to handle an as-needed lib. */
151 + if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
156 /* Clone the symbol table and sym hashes. Remember some
157 pointers into the symbol table, and dynamic symbol count. */
158 old_hash = (char *) old_tab + tabsize;
159 @@ -4169,6 +4176,12 @@
163 + /* Make a special call to the linker "notice" function to
164 + tell it that symbols added for crefs may need to be removed. */
165 + if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
166 + notice_not_needed))
170 objalloc_free_block ((struct objalloc *) htab->root.table.memory,
172 @@ -4179,6 +4192,9 @@
176 + if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
182 diff -uNr binutils-2.17.orig/bfd/version.h binutils-2.17/bfd/version.h
183 --- binutils-2.17.orig/bfd/version.h 2006-06-23 20:14:41.000000000 +0200
184 +++ binutils-2.17/bfd/version.h 2006-10-21 13:53:24.000000000 +0200
186 -#define BFD_VERSION_DATE 20060623
187 +#define BFD_VERSION_DATE 20061021
188 #define BFD_VERSION @bfd_version@
189 #define BFD_VERSION_STRING @bfd_version_string@
190 diff -uNr binutils-2.17.orig/binutils/ChangeLog binutils-2.17/binutils/ChangeLog
191 --- binutils-2.17.orig/binutils/ChangeLog 2006-06-12 15:05:03.000000000 +0200
192 +++ binutils-2.17/binutils/ChangeLog 2006-10-21 13:53:24.000000000 +0200
194 +2006-08-15 Nick Clifton <nickc@redhat.com>
197 + * wrstabs.c (stab_tag_type): Initialize 'size'.
199 2006-06-07 Joseph S. Myers <joseph@codesourcery.com>
201 * po/Make-in (pdf, ps): New dummy targets.
202 diff -uNr binutils-2.17.orig/binutils/wrstabs.c binutils-2.17/binutils/wrstabs.c
203 --- binutils-2.17.orig/binutils/wrstabs.c 2006-03-16 13:20:16.000000000 +0100
204 +++ binutils-2.17/binutils/wrstabs.c 2006-10-21 13:53:24.000000000 +0200
205 @@ -1869,7 +1869,7 @@
207 struct stab_write_handle *info = (struct stab_write_handle *) p;
210 + unsigned int size = 0;
212 index = stab_get_struct_index (info, name, id, kind, &size);
214 diff -uNr binutils-2.17.orig/gas/ChangeLog binutils-2.17/gas/ChangeLog
215 --- binutils-2.17.orig/gas/ChangeLog 2006-06-12 15:05:03.000000000 +0200
216 +++ binutils-2.17/gas/ChangeLog 2006-10-21 13:53:24.000000000 +0200
218 +2006-07-19 Mat Hostetter <mat@lcs.mit.edu>
220 + * symbols.c (report_op_error): Fix pasto. Don't use as_bad_where
221 + when file and line unknown.
223 2006-06-07 Joseph S. Myers <joseph@codesourcery.com>
225 * po/Make-in (pdf, ps): New dummy targets.
226 diff -uNr binutils-2.17.orig/gas/symbols.c binutils-2.17/gas/symbols.c
227 --- binutils-2.17.orig/gas/symbols.c 2006-01-09 18:14:40.000000000 +0100
228 +++ binutils-2.17/gas/symbols.c 2006-10-21 13:53:24.000000000 +0200
229 @@ -928,13 +928,11 @@
230 && seg_right != undefined_section)
233 - as_bad_where (file, line,
234 - _("invalid sections for operation on `%s' and `%s' setting `%s'"),
235 - S_GET_NAME (left), S_GET_NAME (right), S_GET_NAME (symp));
236 + as_bad (_("invalid sections for operation on `%s' and `%s' setting `%s'"),
237 + S_GET_NAME (left), S_GET_NAME (right), S_GET_NAME (symp));
239 - as_bad_where (file, line,
240 - _("invalid section for operation on `%s' setting `%s'"),
241 - S_GET_NAME (left), S_GET_NAME (symp));
242 + as_bad (_("invalid section for operation on `%s' setting `%s'"),
243 + S_GET_NAME (left), S_GET_NAME (symp));
247 diff -uNr binutils-2.17.orig/ld/ChangeLog binutils-2.17/ld/ChangeLog
248 --- binutils-2.17.orig/ld/ChangeLog 2006-06-12 15:07:28.000000000 +0200
249 +++ binutils-2.17/ld/ChangeLog 2006-10-21 13:53:24.000000000 +0200
251 +2006-07-19 Alan Modra <amodra@bigpond.net.au>
253 + * ld.h (handle_asneeded_cref): Declare.
254 + * ldcref.c: Include objalloc.h.
255 + (old_table, old_tab, alloc_mark): New variables.
256 + (tabsize, entsize, refsize, old_symcount): Likewise.
257 + (add_cref): Use bfd_hash_allocate for refs.
258 + (handle_asneeded_cref): New function.
259 + * ldmain.c (notice): Call handle_asneeded_cref for NULL name.
261 +2006-07-04 Daniel Jacobowitz <dan@codesourcery.com>
264 + 2006-05-19 Alan Modra <amodra@bigpond.net.au>
265 + * ldlang.c (lang_size_sections_1): Don't check mem regions for
266 + os->ignored sections.
268 2006-06-12 Fred Fish <fnf@specifix.com>
270 * emulparams/elf32bmip.sh (OTHER_SECTIONS): Keep the
271 diff -uNr binutils-2.17.orig/ld/configure.tgt binutils-2.17/ld/configure.tgt
272 --- binutils-2.17.orig/ld/configure.tgt 2006-04-05 14:41:57.000000000 +0200
273 +++ binutils-2.17/ld/configure.tgt 2006-10-21 13:53:24.000000000 +0200
275 avr-*-*) targ_emul=avr2
276 targ_extra_emuls="avr1 avr3 avr4 avr5"
278 -bfin-*-elf) targ_emul=elf32bfin; targ_extra_emuls="elf32bfinfd" ;;
279 +bfin-*-elf | bfin-*-rtems*)
280 + targ_emul=elf32bfin; targ_extra_emuls="elf32bfinfd" ;;
281 bfin-*-uclinux*) targ_emul=elf32bfin; targ_extra_emuls="elf32bfinfd" ;;
282 cr16c-*-elf*) targ_emul=elf32cr16c
284 diff -uNr binutils-2.17.orig/ld/emulparams/h8300elf.sh binutils-2.17/ld/emulparams/h8300elf.sh
285 --- binutils-2.17.orig/ld/emulparams/h8300elf.sh 2005-12-22 18:43:34.000000000 +0100
286 +++ binutils-2.17/ld/emulparams/h8300elf.sh 2006-10-21 13:53:24.000000000 +0200
288 TINY_DATA_SECTION=".tinydata 0xff8000 :
292 + ${RELOCATING+ _tinydata = .; }
294 TINY_BSS_SECTION=".tinybss : AT (_tinydata)
296 diff -uNr binutils-2.17.orig/ld/ldcref.c binutils-2.17/ld/ldcref.c
297 --- binutils-2.17.orig/ld/ldcref.c 2006-03-16 13:20:16.000000000 +0100
298 +++ binutils-2.17/ld/ldcref.c 2006-10-21 13:53:24.000000000 +0200
302 #include "libiberty.h"
303 +#include "objalloc.h"
309 static size_t cref_symcount;
311 +/* Used to take a snapshot of the cref hash table when starting to
312 + add syms from an as-needed library. */
313 +static struct bfd_hash_entry **old_table;
314 +static unsigned int old_size;
315 +static void *old_tab;
316 +static void *alloc_mark;
317 +static size_t tabsize, entsize, refsize;
318 +static size_t old_symcount;
320 /* Create an entry in a cref hash table. */
322 static struct bfd_hash_entry *
327 - r = xmalloc (sizeof *r);
328 + r = bfd_hash_allocate (&cref_table.root, sizeof *r);
330 + einfo (_("%X%P: cref alloc failed: %E\n"));
334 @@ -182,6 +194,123 @@
338 +/* Called before loading an as-needed library to take a snapshot of
339 + the cref hash table, and after we have loaded or found that the
340 + library was not needed. */
343 +handle_asneeded_cref (bfd *abfd ATTRIBUTE_UNUSED,
344 + enum notice_asneeded_action act)
348 + if (!cref_initialized)
351 + if (act == notice_as_needed)
353 + char *old_ent, *old_ref;
355 + for (i = 0; i < cref_table.root.size; i++)
357 + struct bfd_hash_entry *p;
358 + struct cref_hash_entry *c;
359 + struct cref_ref *r;
361 + for (p = cref_table.root.table[i]; p != NULL; p = p->next)
363 + entsize += cref_table.root.entsize;
364 + c = (struct cref_hash_entry *) p;
365 + for (r = c->refs; r != NULL; r = r->next)
366 + refsize += sizeof (struct cref_hash_entry);
370 + tabsize = cref_table.root.size * sizeof (struct bfd_hash_entry *);
371 + old_tab = xmalloc (tabsize + entsize + refsize);
373 + alloc_mark = bfd_hash_allocate (&cref_table.root, 1);
374 + if (alloc_mark == NULL)
377 + memcpy (old_tab, cref_table.root.table, tabsize);
378 + old_ent = (char *) old_tab + tabsize;
379 + old_ref = (char *) old_ent + entsize;
380 + old_table = cref_table.root.table;
381 + old_size = cref_table.root.size;
382 + old_symcount = cref_symcount;
384 + for (i = 0; i < cref_table.root.size; i++)
386 + struct bfd_hash_entry *p;
387 + struct cref_hash_entry *c;
388 + struct cref_ref *r;
390 + for (p = cref_table.root.table[i]; p != NULL; p = p->next)
392 + memcpy (old_ent, p, cref_table.root.entsize);
393 + old_ent = (char *) old_ent + cref_table.root.entsize;
394 + c = (struct cref_hash_entry *) p;
395 + for (r = c->refs; r != NULL; r = r->next)
397 + memcpy (old_ref, r, sizeof (struct cref_hash_entry));
398 + old_ref = (char *) old_ref + sizeof (struct cref_hash_entry);
405 + if (act == notice_not_needed)
407 + char *old_ent, *old_ref;
409 + if (old_tab == NULL)
411 + /* The only way old_tab can be NULL is if the cref hash table
412 + had not been initialised when notice_as_needed. */
413 + bfd_hash_table_free (&cref_table.root);
414 + cref_initialized = FALSE;
418 + old_ent = (char *) old_tab + tabsize;
419 + old_ref = (char *) old_ent + entsize;
420 + cref_table.root.table = old_table;
421 + cref_table.root.size = old_size;
422 + memcpy (cref_table.root.table, old_tab, tabsize);
423 + cref_symcount = old_symcount;
425 + for (i = 0; i < cref_table.root.size; i++)
427 + struct bfd_hash_entry *p;
428 + struct cref_hash_entry *c;
429 + struct cref_ref *r;
431 + for (p = cref_table.root.table[i]; p != NULL; p = p->next)
433 + memcpy (p, old_ent, cref_table.root.entsize);
434 + old_ent = (char *) old_ent + cref_table.root.entsize;
435 + c = (struct cref_hash_entry *) p;
436 + for (r = c->refs; r != NULL; r = r->next)
438 + memcpy (r, old_ref, sizeof (struct cref_hash_entry));
439 + old_ref = (char *) old_ref + sizeof (struct cref_hash_entry);
444 + objalloc_free_block ((struct objalloc *) cref_table.root.memory,
447 + else if (act != notice_needed)
455 /* Copy the addresses of the hash table entries into an array. This
456 is called via cref_hash_traverse. We also fill in the demangled
458 diff -uNr binutils-2.17.orig/ld/ld.h binutils-2.17/ld/ld.h
459 --- binutils-2.17.orig/ld/ld.h 2005-09-30 13:42:04.000000000 +0200
460 +++ binutils-2.17/ld/ld.h 2006-10-21 13:53:24.000000000 +0200
462 /* ld.h -- general linker header file
463 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
464 - 2001, 2002, 2003, 2004, 2005
465 + 2001, 2002, 2003, 2004, 2005, 2006
466 Free Software Foundation, Inc.
468 This file is part of GLD, the Gnu Linker.
471 extern int yyparse (void);
472 extern void add_cref (const char *, bfd *, asection *, bfd_vma);
473 +extern bfd_boolean handle_asneeded_cref (bfd *, enum notice_asneeded_action);
474 extern void output_cref (FILE *);
475 extern void check_nocrossrefs (void);
476 extern void ld_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
477 diff -uNr binutils-2.17.orig/ld/ldlang.c binutils-2.17/ld/ldlang.c
478 --- binutils-2.17.orig/ld/ldlang.c 2006-06-12 15:05:04.000000000 +0200
479 +++ binutils-2.17/ld/ldlang.c 2006-10-21 13:53:24.000000000 +0200
480 @@ -4207,7 +4207,8 @@
481 /* If a loadable section is using the default memory
482 region, and some non default memory regions were
483 defined, issue an error message. */
484 - if (!IGNORE_SECTION (os->bfd_section)
486 + && !IGNORE_SECTION (os->bfd_section)
487 && ! link_info.relocatable
489 && strcmp (os->region->name,
490 diff -uNr binutils-2.17.orig/ld/ldmain.c binutils-2.17/ld/ldmain.c
491 --- binutils-2.17.orig/ld/ldmain.c 2006-04-06 20:52:45.000000000 +0200
492 +++ binutils-2.17/ld/ldmain.c 2006-10-21 13:53:24.000000000 +0200
493 @@ -1511,6 +1511,13 @@
499 + if (command_line.cref || nocrossref_list != NULL)
500 + return handle_asneeded_cref (abfd, value);
504 if (! info->notice_all
505 || (info->notice_hash != NULL
506 && bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL))
507 diff -uNr binutils-2.17.orig/ld/testsuite/ChangeLog binutils-2.17/ld/testsuite/ChangeLog
508 --- binutils-2.17.orig/ld/testsuite/ChangeLog 2006-06-12 15:44:33.000000000 +0200
509 +++ binutils-2.17/ld/testsuite/ChangeLog 2006-10-21 13:53:24.000000000 +0200
511 +2006-07-12 Richard Sandiford <richard@codesourcery.com>
513 + * ld-m68k/merge-ok-1c.d: New test.
514 + * ld-m68k/m68k.exp: Run it.
516 +2006-07-04 Daniel Jacobowitz <dan@codesourcery.com>
519 + 2006-05-19 Alan Modra <amodra@bigpond.net.au>
520 + * ld-scripts/empty-orphan.d: Update again.
522 + * ld-scripts/empty-orphan.t: Discard .reginfo.
523 + * ld-scripts/empty-orphan.d: Update.
525 2006-06-12 Daniel Jacobowitz <dan@codesourcery.com>
528 diff -uNr binutils-2.17.orig/ld/testsuite/ld-m68k/m68k.exp binutils-2.17/ld/testsuite/ld-m68k/m68k.exp
529 --- binutils-2.17.orig/ld/testsuite/ld-m68k/m68k.exp 2006-03-25 11:24:27.000000000 +0100
530 +++ binutils-2.17/ld/testsuite/ld-m68k/m68k.exp 2006-10-21 13:53:24.000000000 +0200
532 run_dump_test "merge-error-1e"
533 run_dump_test "merge-ok-1a"
534 run_dump_test "merge-ok-1b"
535 +run_dump_test "merge-ok-1c"
536 diff -uNr binutils-2.17.orig/ld/testsuite/ld-scripts/empty-orphan.d binutils-2.17/ld/testsuite/ld-scripts/empty-orphan.d
537 --- binutils-2.17.orig/ld/testsuite/ld-scripts/empty-orphan.d 2005-03-17 17:20:39.000000000 +0100
538 +++ binutils-2.17/ld/testsuite/ld-scripts/empty-orphan.d 2006-10-21 13:53:24.000000000 +0200
540 #source: empty-orphan.s
541 #ld: -T empty-orphan.t
542 -#error: no memory region specified for loadable section
545 + +LOAD +[x0-9a-f]+ [x0]+70000000 [x0]+70000000 [x0]+(2|4|8|10|20|40|80) .*
547 diff -uNr binutils-2.17.orig/ld/testsuite/ld-scripts/empty-orphan.t binutils-2.17/ld/testsuite/ld-scripts/empty-orphan.t
548 --- binutils-2.17.orig/ld/testsuite/ld-scripts/empty-orphan.t 2005-03-17 17:20:39.000000000 +0100
549 +++ binutils-2.17/ld/testsuite/ld-scripts/empty-orphan.t 2006-10-21 13:53:24.000000000 +0200
551 .text : { *(.text) } > text_mem : text_phdr
552 .data : { *(.data) } > data_mem : data_phdr
553 .bss : { *(.bss) } > data_mem : data_phdr
554 + /DISCARD/ : { *(.reginfo) }
555 /* .orphan_data is an orphan */