source: clfs-sysroot/patches/binutils-2.17-branch_update-3.patch @ 00520f6

Last change on this file since 00520f6 was 00520f6, checked in by Joe Ciccone <jciccone@…>, 17 years ago

Update patches.

  • Property mode set to 100644
File size: 22.7 KB
Line 
1Submitted By: Jim Gifford (jim at linuxfromscratch dot org)
2Date: 07-04-2007
3Initial Package Version: 2.17
4Origin: Upstream
5Upstream Status: Applied
6Description: This is a branch update for binutils-2.17, and should be
7             rechecked periodically.
8
9diff -Naur binutils-2.17.orig/bfd/bfd-in2.h binutils-2.17/bfd/bfd-in2.h
10--- binutils-2.17.orig/bfd/bfd-in2.h    2006-03-25 19:38:42.000000000 -0500
11+++ binutils-2.17/bfd/bfd-in2.h 2006-07-18 22:37:04.000000000 -0400
12@@ -643,6 +643,12 @@
13   DYN_NO_NEEDED = 8
14 };
15 
16+enum notice_asneeded_action {
17+  notice_as_needed,
18+  notice_not_needed,
19+  notice_needed
20+};
21+
22 extern bfd_boolean bfd_elf_record_link_assignment
23   (bfd *, struct bfd_link_info *, const char *, bfd_boolean,
24    bfd_boolean);
25diff -Naur binutils-2.17.orig/bfd/bfd-in.h binutils-2.17/bfd/bfd-in.h
26--- binutils-2.17.orig/bfd/bfd-in.h     2006-03-16 07:20:15.000000000 -0500
27+++ binutils-2.17/bfd/bfd-in.h  2006-07-18 22:37:04.000000000 -0400
28@@ -636,6 +636,12 @@
29   DYN_NO_NEEDED = 8
30 };
31 
32+enum notice_asneeded_action {
33+  notice_as_needed,
34+  notice_not_needed,
35+  notice_needed
36+};
37+
38 extern bfd_boolean bfd_elf_record_link_assignment
39   (bfd *, struct bfd_link_info *, const char *, bfd_boolean,
40    bfd_boolean);
41diff -Naur binutils-2.17.orig/bfd/ChangeLog binutils-2.17/bfd/ChangeLog
42--- binutils-2.17.orig/bfd/ChangeLog    2006-06-23 14:18:16.000000000 -0400
43+++ binutils-2.17/bfd/ChangeLog 2006-12-11 09:52:38.000000000 -0500
44@@ -1,3 +1,30 @@
45+2006-12-11  Eric Botcazou  <ebotcazou@adacore.com>
46+
47+       * elflink.c (bfd_elf_gc_sections): Also search for corresponding
48+       sections with .gnu.linkonce.t. prefix.
49+
50+2006-08-08  Nick Clifton  <nickc@redhat.com>
51+
52+       PR binutils/2724
53+       * coffcode.h (coff_new_section_hook): Only modify the section
54+       symbol of sections which were created by the user.
55+
56+2006-07-19  Alan Modra  <amodra@bigpond.net.au>
57+
58+       * bfd-in.h (enum notice_asneeded_action): Define.
59+       * bfd-in2.h: Regenerate.
60+       * elflink.c (elf_link_add_object_symbols): Call linker "notice"
61+       function with NULL name for as-needed handling.
62+
63+2006-07-12  Matthew R. Dempsky  <mrd@alkemio.org>
64+
65+       * cpu-m68k.c (bfd_m68k_compatible): Handle CPU32.
66+
67+2006-06-23  Daniel Jacobowitz  <dan@codesourcery.com>
68+
69+       * Makefile.am: Clear RELEASE.
70+       * Makefile.in: Regenerated.
71+
72 2006-06-23  Daniel Jacobowitz  <dan@codesourcery.com>
73 
74        * configure.in: Update version to 2.17.
75diff -Naur binutils-2.17.orig/bfd/coffcode.h binutils-2.17/bfd/coffcode.h
76--- binutils-2.17.orig/bfd/coffcode.h   2005-10-25 13:40:09.000000000 -0400
77+++ binutils-2.17/bfd/coffcode.h        2006-08-08 04:19:57.000000000 -0400
78@@ -1546,9 +1546,6 @@
79 static bfd_boolean
80 coff_new_section_hook (bfd * abfd, asection * section)
81 {
82-  combined_entry_type *native;
83-  bfd_size_type amt;
84-
85   section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;
86 
87 #ifdef RS6000COFF_C
88@@ -1560,27 +1557,34 @@
89     section->alignment_power = bfd_xcoff_data_align_power (abfd);
90 #endif
91 
92-  /* Allocate aux records for section symbols, to store size and
93-     related info.
94-
95-     @@ The 10 is a guess at a plausible maximum number of aux entries
96-     (but shouldn't be a constant).  */
97-  amt = sizeof (combined_entry_type) * 10;
98-  native = bfd_zalloc (abfd, amt);
99-  if (native == NULL)
100-    return FALSE;
101-
102-  /* We don't need to set up n_name, n_value, or n_scnum in the native
103-     symbol information, since they'll be overridden by the BFD symbol
104-     anyhow.  However, we do need to set the type and storage class,
105-     in case this symbol winds up getting written out.  The value 0
106-     for n_numaux is already correct.  */
107-
108-  native->u.syment.n_type = T_NULL;
109-  native->u.syment.n_sclass = C_STAT;
110+  /* PR binutils/2724: Only real sections have a symbol that
111+     has the coff_symbol_type structure allocated for it.  */
112+  if (! bfd_is_const_section (section))
113+    {
114+      combined_entry_type *native;
115+      bfd_size_type amt;
116+
117+      /* Allocate aux records for section symbols, to store size and
118+        related info.
119+
120+        @@ The 10 is a guess at a plausible maximum number of aux entries
121+        (but shouldn't be a constant).  */
122+      amt = sizeof (combined_entry_type) * 10;
123+      native = bfd_zalloc (abfd, amt);
124+      if (native == NULL)
125+       return FALSE;
126 
127-  coffsymbol (section->symbol)->native = native;
128+      /* We don't need to set up n_name, n_value, or n_scnum in the native
129+        symbol information, since they'll be overridden by the BFD symbol
130+        anyhow.  However, we do need to set the type and storage class,
131+        in case this symbol winds up getting written out.  The value 0
132+        for n_numaux is already correct.  */
133+      native->u.syment.n_type = T_NULL;
134+      native->u.syment.n_sclass = C_STAT;
135 
136+      coffsymbol (section->symbol)->native = native;
137+    }
138
139   coff_set_custom_section_alignment (abfd, section,
140                                     coff_section_alignment_table,
141                                     coff_section_alignment_table_size);
142diff -Naur binutils-2.17.orig/bfd/cpu-m68k.c binutils-2.17/bfd/cpu-m68k.c
143--- binutils-2.17.orig/bfd/cpu-m68k.c   2006-03-25 05:24:27.000000000 -0500
144+++ binutils-2.17/bfd/cpu-m68k.c        2006-07-12 08:55:21.000000000 -0400
145@@ -202,6 +202,9 @@
146   if (a->mach <= bfd_mach_m68060 && b->mach <= bfd_mach_m68060)
147     /* Merge m68k machine. */
148     return a->mach > b->mach ? a : b;
149+  else if (a->mach == bfd_mach_cpu32 && b->mach == bfd_mach_cpu32)
150+    /* CPU32 is compatible with itself. */
151+    return a;
152   else if (a->mach >= bfd_mach_mcf_isa_a_nodiv
153           && b->mach >= bfd_mach_mcf_isa_a_nodiv)
154     {
155diff -Naur binutils-2.17.orig/bfd/elflink.c binutils-2.17/bfd/elflink.c
156--- binutils-2.17.orig/bfd/elflink.c    2006-05-22 11:06:36.000000000 -0400
157+++ binutils-2.17/bfd/elflink.c 2006-12-11 09:52:39.000000000 -0500
158@@ -3496,6 +3496,13 @@
159       if (alloc_mark == NULL)
160        goto error_free_vers;
161 
162+      /* Make a special call to the linker "notice" function to
163+        tell it that we are about to handle an as-needed lib.  */
164+      if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
165+                                      notice_as_needed))
166+       return FALSE;
167+
168+
169       /* Clone the symbol table and sym hashes.  Remember some
170         pointers into the symbol table, and dynamic symbol count.  */
171       old_hash = (char *) old_tab + tabsize;
172@@ -4169,6 +4176,12 @@
173            }
174        }
175 
176+      /* Make a special call to the linker "notice" function to
177+        tell it that symbols added for crefs may need to be removed.  */
178+      if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
179+                                      notice_not_needed))
180+       return FALSE;
181+
182       free (old_tab);
183       objalloc_free_block ((struct objalloc *) htab->root.table.memory,
184                           alloc_mark);
185@@ -4179,6 +4192,9 @@
186 
187   if (old_tab != NULL)
188     {
189+      if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
190+                                      notice_needed))
191+       return FALSE;
192       free (old_tab);
193       old_tab = NULL;
194     }
195@@ -9239,7 +9255,8 @@
196       if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
197        continue;
198 
199-      /* Keep .gcc_except_table.* if the associated .text.* is
200+      /* Keep .gcc_except_table.* if the associated .text.* (or the
201+        associated .gnu.linkonce.t.* if .text.* doesn't exist) is
202         marked.  This isn't very nice, but the proper solution,
203         splitting .eh_frame up and using comdat doesn't pan out
204         easily due to needing special relocs to handle the
205@@ -9255,12 +9272,23 @@
206                asection *fn_text;
207 
208                len = strlen (o->name + 18) + 1;
209-               fn_name = bfd_malloc (len + 6);
210+               fn_name = bfd_malloc (len + 16);
211                if (fn_name == NULL)
212                  return FALSE;
213+
214+               /* Try the first prefix.  */
215                memcpy (fn_name, ".text.", 6);
216                memcpy (fn_name + 6, o->name + 18, len);
217                fn_text = bfd_get_section_by_name (sub, fn_name);
218+
219+               /* Try the second prefix.  */
220+               if (fn_text == NULL)
221+                 {
222+                   memcpy (fn_name, ".gnu.linkonce.t.", 16);
223+                   memcpy (fn_name + 16, o->name + 18, len);
224+                   fn_text = bfd_get_section_by_name (sub, fn_name);
225+                 }
226+
227                free (fn_name);
228                if (fn_text == NULL || !fn_text->gc_mark)
229                  continue;
230diff -Naur binutils-2.17.orig/bfd/version.h binutils-2.17/bfd/version.h
231--- binutils-2.17.orig/bfd/version.h    2006-06-23 14:14:41.000000000 -0400
232+++ binutils-2.17/bfd/version.h 2007-07-03 20:00:11.000000000 -0400
233@@ -1,3 +1,3 @@
234-#define BFD_VERSION_DATE 20060623
235+#define BFD_VERSION_DATE 20070704
236 #define BFD_VERSION @bfd_version@
237 #define BFD_VERSION_STRING @bfd_version_string@
238diff -Naur binutils-2.17.orig/binutils/ChangeLog binutils-2.17/binutils/ChangeLog
239--- binutils-2.17.orig/binutils/ChangeLog       2006-06-12 09:05:03.000000000 -0400
240+++ binutils-2.17/binutils/ChangeLog    2006-08-15 08:01:21.000000000 -0400
241@@ -1,3 +1,8 @@
242+2006-08-15  Nick Clifton  <nickc@redhat.com>
243+
244+       PR binutils/3039
245+       * wrstabs.c (stab_tag_type): Initialize 'size'.
246+
247 2006-06-07  Joseph S. Myers  <joseph@codesourcery.com>
248 
249        * po/Make-in (pdf, ps): New dummy targets.
250diff -Naur binutils-2.17.orig/binutils/rclex.c binutils-2.17/binutils/rclex.c
251--- binutils-2.17.orig/binutils/rclex.c 2006-04-16 14:36:40.000000000 -0400
252+++ binutils-2.17/binutils/rclex.c      2006-04-16 14:36:40.000000000 -0400
253@@ -1,7 +1,7 @@
254 /* A lexical scanner generated by flex */
255 
256 /* Scanner skeleton version:
257- * $Header: /cvs/src/src/binutils/Attic/rclex.c,v 1.1.16.1 2006/04/16 18:36:40 drow Exp $
258+ * $Header: /cvs/src/src/binutils/rclex.c,v 1.1.16.1 2006/04/16 18:36:40 drow Exp $
259  */
260 
261 #define FLEX_SCANNER
262diff -Naur binutils-2.17.orig/binutils/wrstabs.c binutils-2.17/binutils/wrstabs.c
263--- binutils-2.17.orig/binutils/wrstabs.c       2006-03-16 07:20:16.000000000 -0500
264+++ binutils-2.17/binutils/wrstabs.c    2006-08-15 08:01:21.000000000 -0400
265@@ -1869,7 +1869,7 @@
266 {
267   struct stab_write_handle *info = (struct stab_write_handle *) p;
268   long index;
269-  unsigned int size;
270+  unsigned int size = 0;
271 
272   index = stab_get_struct_index (info, name, id, kind, &size);
273   if (index < 0)
274diff -Naur binutils-2.17.orig/configure.in binutils-2.17/configure.in
275--- binutils-2.17.orig/configure.in     2006-06-23 14:19:53.000000000 -0400
276+++ binutils-2.17/configure.in  2006-04-06 17:49:25.000000000 -0400
277@@ -130,7 +130,7 @@
278 # know that we are building the simulator.
279 # binutils, gas and ld appear in that order because it makes sense to run
280 # "make check" in that particular order.
281-host_tools="byacc flex bison binutils gas ld fixincludes gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
282+host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
283 
284 # libgcj represents the runtime libraries only used by gcj.
285 libgcj="target-libffi \
286diff -Naur binutils-2.17.orig/etc/add-log.vi binutils-2.17/etc/add-log.vi
287--- binutils-2.17.orig/etc/add-log.vi   1969-12-31 19:00:00.000000000 -0500
288+++ binutils-2.17/etc/add-log.vi        1999-05-03 03:29:06.000000000 -0400
289@@ -0,0 +1,11 @@
290+Here is a vi macro to create entries in the recommended format for
291+GDB's ChangeLogs.
292+
293+map 1GO:r !date '+\%Y-\%m-\%d'2GA  Jason Molenda  (:r !whoamikJxA@:r !hostnameA)kJxkddjO
294        *
295k$
296+
297+It contains control and escape sequences, so don't just cut and paste it.
298+You'll need to change the "Jason Molenda" bit, of course. :-)  Put this
299+in your $HOME/.exrc and when you type control-X in move-around-mode,
300+you'll have a changelog template inserted.
301+
302+--- Jason Molenda
303diff -Naur binutils-2.17.orig/gas/ChangeLog binutils-2.17/gas/ChangeLog
304--- binutils-2.17.orig/gas/ChangeLog    2006-06-12 09:05:03.000000000 -0400
305+++ binutils-2.17/gas/ChangeLog 2006-07-18 22:06:08.000000000 -0400
306@@ -1,3 +1,8 @@
307+2006-07-19  Mat Hostetter  <mat@lcs.mit.edu>
308+
309+       * symbols.c (report_op_error): Fix pasto.  Don't use as_bad_where
310+       when file and line unknown.
311+
312 2006-06-07  Joseph S. Myers  <joseph@codesourcery.com>
313 
314        * po/Make-in (pdf, ps): New dummy targets.
315diff -Naur binutils-2.17.orig/gas/symbols.c binutils-2.17/gas/symbols.c
316--- binutils-2.17.orig/gas/symbols.c    2006-01-09 12:14:40.000000000 -0500
317+++ binutils-2.17/gas/symbols.c 2006-07-18 22:06:08.000000000 -0400
318@@ -928,13 +928,11 @@
319          && seg_right != undefined_section)
320        {
321          if (right)
322-           as_bad_where (file, line,
323-                         _("invalid sections for operation on `%s' and `%s' setting `%s'"),
324-                         S_GET_NAME (left), S_GET_NAME (right), S_GET_NAME (symp));
325+           as_bad (_("invalid sections for operation on `%s' and `%s' setting `%s'"),
326+                   S_GET_NAME (left), S_GET_NAME (right), S_GET_NAME (symp));
327          else
328-           as_bad_where (file, line,
329-                         _("invalid section for operation on `%s' setting `%s'"),
330-                         S_GET_NAME (left), S_GET_NAME (symp));
331+           as_bad (_("invalid section for operation on `%s' setting `%s'"),
332+                   S_GET_NAME (left), S_GET_NAME (symp));
333        }
334     }
335 }
336diff -Naur binutils-2.17.orig/ld/ChangeLog binutils-2.17/ld/ChangeLog
337--- binutils-2.17.orig/ld/ChangeLog     2006-06-12 09:07:28.000000000 -0400
338+++ binutils-2.17/ld/ChangeLog  2006-07-18 22:37:05.000000000 -0400
339@@ -1,3 +1,20 @@
340+2006-07-19  Alan Modra  <amodra@bigpond.net.au>
341+
342+       * ld.h (handle_asneeded_cref): Declare.
343+       * ldcref.c: Include objalloc.h.
344+       (old_table, old_tab, alloc_mark): New variables.
345+       (tabsize, entsize, refsize, old_symcount): Likewise.
346+       (add_cref): Use bfd_hash_allocate for refs.
347+       (handle_asneeded_cref): New function.
348+       * ldmain.c (notice): Call handle_asneeded_cref for NULL name.
349+
350+2006-07-04  Daniel Jacobowitz  <dan@codesourcery.com>
351+
352+       Backport:
353+       2006-05-19  Alan Modra  <amodra@bigpond.net.au>
354+       * ldlang.c (lang_size_sections_1): Don't check mem regions for
355+       os->ignored sections.
356+
357 2006-06-12  Fred Fish  <fnf@specifix.com>
358 
359        * emulparams/elf32bmip.sh (OTHER_SECTIONS): Keep the
360diff -Naur binutils-2.17.orig/ld/ldcref.c binutils-2.17/ld/ldcref.c
361--- binutils-2.17.orig/ld/ldcref.c      2006-03-16 07:20:16.000000000 -0500
362+++ binutils-2.17/ld/ldcref.c   2006-07-18 22:37:05.000000000 -0400
363@@ -27,6 +27,7 @@
364 #include "sysdep.h"
365 #include "bfdlink.h"
366 #include "libiberty.h"
367+#include "objalloc.h"
368 
369 #include "ld.h"
370 #include "ldmain.h"
371@@ -101,6 +102,15 @@
372 
373 static size_t cref_symcount;
374 
375+/* Used to take a snapshot of the cref hash table when starting to
376+   add syms from an as-needed library.  */
377+static struct bfd_hash_entry **old_table;
378+static unsigned int old_size;
379+static void *old_tab;
380+static void *alloc_mark;
381+static size_t tabsize, entsize, refsize;
382+static size_t old_symcount;
383+
384 /* Create an entry in a cref hash table.  */
385 
386 static struct bfd_hash_entry *
387@@ -165,7 +175,9 @@
388 
389   if (r == NULL)
390     {
391-      r = xmalloc (sizeof *r);
392+      r = bfd_hash_allocate (&cref_table.root, sizeof *r);
393+      if (r == NULL)
394+       einfo (_("%X%P: cref alloc failed: %E\n"));
395       r->next = h->refs;
396       h->refs = r;
397       r->abfd = abfd;
398@@ -182,6 +194,123 @@
399     r->def = TRUE;
400 }
401 
402+/* Called before loading an as-needed library to take a snapshot of
403+   the cref hash table, and after we have loaded or found that the
404+   library was not needed.  */
405+
406+bfd_boolean
407+handle_asneeded_cref (bfd *abfd ATTRIBUTE_UNUSED,
408+                     enum notice_asneeded_action act)
409+{
410+  unsigned int i;
411+
412+  if (!cref_initialized)
413+    return TRUE;
414+
415+  if (act == notice_as_needed)
416+    {
417+      char *old_ent, *old_ref;
418+
419+      for (i = 0; i < cref_table.root.size; i++)
420+       {
421+         struct bfd_hash_entry *p;
422+         struct cref_hash_entry *c;
423+         struct cref_ref *r;
424+
425+         for (p = cref_table.root.table[i]; p != NULL; p = p->next)
426+           {
427+             entsize += cref_table.root.entsize;
428+             c = (struct cref_hash_entry *) p;
429+             for (r = c->refs; r != NULL; r = r->next)
430+               refsize += sizeof (struct cref_hash_entry);
431+           }
432+       }
433+
434+      tabsize = cref_table.root.size * sizeof (struct bfd_hash_entry *);
435+      old_tab = xmalloc (tabsize + entsize + refsize);
436+
437+      alloc_mark = bfd_hash_allocate (&cref_table.root, 1);
438+      if (alloc_mark == NULL)
439+       return FALSE;
440+
441+      memcpy (old_tab, cref_table.root.table, tabsize);
442+      old_ent = (char *) old_tab + tabsize;
443+      old_ref = (char *) old_ent + entsize;
444+      old_table = cref_table.root.table;
445+      old_size = cref_table.root.size;
446+      old_symcount = cref_symcount;
447+
448+      for (i = 0; i < cref_table.root.size; i++)
449+       {
450+         struct bfd_hash_entry *p;
451+         struct cref_hash_entry *c;
452+         struct cref_ref *r;
453+
454+         for (p = cref_table.root.table[i]; p != NULL; p = p->next)
455+           {
456+             memcpy (old_ent, p, cref_table.root.entsize);
457+             old_ent = (char *) old_ent + cref_table.root.entsize;
458+             c = (struct cref_hash_entry *) p;
459+             for (r = c->refs; r != NULL; r = r->next)
460+               {
461+                 memcpy (old_ref, r, sizeof (struct cref_hash_entry));
462+                 old_ref = (char *) old_ref + sizeof (struct cref_hash_entry);
463+               }
464+           }
465+       }
466+      return TRUE;
467+    }
468+
469+  if (act == notice_not_needed)
470+    {
471+      char *old_ent, *old_ref;
472+
473+      if (old_tab == NULL)
474+       {
475+         /* The only way old_tab can be NULL is if the cref hash table
476+            had not been initialised when notice_as_needed.  */
477+         bfd_hash_table_free (&cref_table.root);
478+         cref_initialized = FALSE;
479+         return TRUE;
480+       }
481+
482+      old_ent = (char *) old_tab + tabsize;
483+      old_ref = (char *) old_ent + entsize;
484+      cref_table.root.table = old_table;
485+      cref_table.root.size = old_size;
486+      memcpy (cref_table.root.table, old_tab, tabsize);
487+      cref_symcount = old_symcount;
488+
489+      for (i = 0; i < cref_table.root.size; i++)
490+       {
491+         struct bfd_hash_entry *p;
492+         struct cref_hash_entry *c;
493+         struct cref_ref *r;
494+
495+         for (p = cref_table.root.table[i]; p != NULL; p = p->next)
496+           {
497+             memcpy (p, old_ent, cref_table.root.entsize);
498+             old_ent = (char *) old_ent + cref_table.root.entsize;
499+             c = (struct cref_hash_entry *) p;
500+             for (r = c->refs; r != NULL; r = r->next)
501+               {
502+                 memcpy (r, old_ref, sizeof (struct cref_hash_entry));
503+                 old_ref = (char *) old_ref + sizeof (struct cref_hash_entry);
504+               }
505+           }
506+       }
507+
508+      objalloc_free_block ((struct objalloc *) cref_table.root.memory,
509+                          alloc_mark);
510+    }
511+  else if (act != notice_needed)
512+    return FALSE;
513+
514+  free (old_tab);
515+  old_tab = NULL;
516+  return TRUE;
517+}
518+
519 /* Copy the addresses of the hash table entries into an array.  This
520    is called via cref_hash_traverse.  We also fill in the demangled
521    name.  */
522diff -Naur binutils-2.17.orig/ld/ld.h binutils-2.17/ld/ld.h
523--- binutils-2.17.orig/ld/ld.h  2005-09-30 07:42:04.000000000 -0400
524+++ binutils-2.17/ld/ld.h       2006-07-18 22:37:05.000000000 -0400
525@@ -1,6 +1,6 @@
526 /* ld.h -- general linker header file
527    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
528-   2001, 2002, 2003, 2004, 2005
529+   2001, 2002, 2003, 2004, 2005, 2006
530    Free Software Foundation, Inc.
531 
532    This file is part of GLD, the Gnu Linker.
533@@ -282,6 +282,7 @@
534 
535 extern int yyparse (void);
536 extern void add_cref (const char *, bfd *, asection *, bfd_vma);
537+extern bfd_boolean handle_asneeded_cref (bfd *, enum notice_asneeded_action);
538 extern void output_cref (FILE *);
539 extern void check_nocrossrefs (void);
540 extern void ld_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
541diff -Naur binutils-2.17.orig/ld/ldlang.c binutils-2.17/ld/ldlang.c
542--- binutils-2.17.orig/ld/ldlang.c      2006-06-12 09:05:04.000000000 -0400
543+++ binutils-2.17/ld/ldlang.c   2006-07-04 09:29:24.000000000 -0400
544@@ -4207,7 +4207,8 @@
545                    /* If a loadable section is using the default memory
546                       region, and some non default memory regions were
547                       defined, issue an error message.  */
548-                   if (!IGNORE_SECTION (os->bfd_section)
549+                   if (!os->ignored
550+                       && !IGNORE_SECTION (os->bfd_section)
551                        && ! link_info.relocatable
552                        && check_regions
553                        && strcmp (os->region->name,
554diff -Naur binutils-2.17.orig/ld/ldmain.c binutils-2.17/ld/ldmain.c
555--- binutils-2.17.orig/ld/ldmain.c      2006-04-06 14:52:45.000000000 -0400
556+++ binutils-2.17/ld/ldmain.c   2006-07-18 22:37:05.000000000 -0400
557@@ -1511,6 +1511,13 @@
558        asection *section,
559        bfd_vma value)
560 {
561+  if (name == NULL)
562+    {
563+      if (command_line.cref || nocrossref_list != NULL)
564+       return handle_asneeded_cref (abfd, value);
565+      return TRUE;
566+    }
567+
568   if (! info->notice_all
569       || (info->notice_hash != NULL
570          && bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL))
571diff -Naur binutils-2.17.orig/ld/testsuite/ChangeLog binutils-2.17/ld/testsuite/ChangeLog
572--- binutils-2.17.orig/ld/testsuite/ChangeLog   2006-06-12 09:44:33.000000000 -0400
573+++ binutils-2.17/ld/testsuite/ChangeLog        2006-07-12 08:55:21.000000000 -0400
574@@ -1,3 +1,17 @@
575+2006-07-12  Richard Sandiford  <richard@codesourcery.com>
576+
577+       * ld-m68k/merge-ok-1c.d: New test.
578+       * ld-m68k/m68k.exp: Run it.
579+
580+2006-07-04  Daniel Jacobowitz  <dan@codesourcery.com>
581+
582+       Backport:
583+       2006-05-19  Alan Modra  <amodra@bigpond.net.au>
584+       * ld-scripts/empty-orphan.d: Update again.
585+
586+       * ld-scripts/empty-orphan.t: Discard .reginfo.
587+       * ld-scripts/empty-orphan.d: Update.
588+
589 2006-06-12  Daniel Jacobowitz  <dan@codesourcery.com>
590 
591        Backport:
592diff -Naur binutils-2.17.orig/ld/testsuite/ld-m68k/m68k.exp binutils-2.17/ld/testsuite/ld-m68k/m68k.exp
593--- binutils-2.17.orig/ld/testsuite/ld-m68k/m68k.exp    2006-03-25 05:24:27.000000000 -0500
594+++ binutils-2.17/ld/testsuite/ld-m68k/m68k.exp 2006-07-12 08:55:21.000000000 -0400
595@@ -53,3 +53,4 @@
596 run_dump_test "merge-error-1e"
597 run_dump_test "merge-ok-1a"
598 run_dump_test "merge-ok-1b"
599+run_dump_test "merge-ok-1c"
600diff -Naur binutils-2.17.orig/ld/testsuite/ld-m68k/merge-ok-1c.d binutils-2.17/ld/testsuite/ld-m68k/merge-ok-1c.d
601--- binutils-2.17.orig/ld/testsuite/ld-m68k/merge-ok-1c.d       1969-12-31 19:00:00.000000000 -0500
602+++ binutils-2.17/ld/testsuite/ld-m68k/merge-ok-1c.d    2006-07-12 08:55:21.000000000 -0400
603@@ -0,0 +1,6 @@
604+#source: merge-error-1a.s -march=cpu32
605+#source: merge-error-1b.s -march=cpu32
606+#ld: -r
607+#objdump: -p
608+#...
609+private flags = 810000: \[cpu32\]
610diff -Naur binutils-2.17.orig/ld/testsuite/ld-scripts/empty-orphan.d binutils-2.17/ld/testsuite/ld-scripts/empty-orphan.d
611--- binutils-2.17.orig/ld/testsuite/ld-scripts/empty-orphan.d   2005-03-17 11:20:39.000000000 -0500
612+++ binutils-2.17/ld/testsuite/ld-scripts/empty-orphan.d        2006-07-04 09:29:24.000000000 -0400
613@@ -1,3 +1,6 @@
614 #source: empty-orphan.s
615 #ld: -T empty-orphan.t
616-#error: no memory region specified for loadable section
617+#readelf: -l --wide
618+#...
619+ +LOAD +[x0-9a-f]+ [x0]+70000000 [x0]+70000000 [x0]+(2|4|8|10|20|40|80) .*
620+#pass
621diff -Naur binutils-2.17.orig/ld/testsuite/ld-scripts/empty-orphan.t binutils-2.17/ld/testsuite/ld-scripts/empty-orphan.t
622--- binutils-2.17.orig/ld/testsuite/ld-scripts/empty-orphan.t   2005-03-17 11:20:39.000000000 -0500
623+++ binutils-2.17/ld/testsuite/ld-scripts/empty-orphan.t        2006-07-04 09:29:24.000000000 -0400
624@@ -17,5 +17,6 @@
625    .text : { *(.text) } > text_mem : text_phdr
626    .data : { *(.data) } > data_mem : data_phdr
627    .bss : { *(.bss) } > data_mem : data_phdr
628+   /DISCARD/ : { *(.reginfo) }
629    /* .orphan_data is an orphan */
630 }
Note: See TracBrowser for help on using the repository browser.