OSDN Git Service

* ldlang.c (gc_section_callback): Move SEC_EXCLUDE twiddles..
authoramodra <amodra>
Sat, 29 May 2004 04:30:40 +0000 (04:30 +0000)
committeramodra <amodra>
Sat, 29 May 2004 04:30:40 +0000 (04:30 +0000)
(lang_gc_sections): .. to a LANG_FOR_EACH_INPUT_STATEMENT loop here.

ld/ChangeLog
ld/ldlang.c

index 9ce5744..00318f3 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-29  Alan Modra  <amodra@bigpond.net.au>
+
+       * ldlang.c (gc_section_callback): Move SEC_EXCLUDE twiddles..
+       (lang_gc_sections): .. to a LANG_FOR_EACH_INPUT_STATEMENT loop here.
+
 2004-05-28  Andrew Stubbs <andrew.stubbs@superh.com>
 
        * testsuite/ld-sh/arch/arch.exp: New test script.
index b471b5b..7ff8be0 100644 (file)
@@ -4272,12 +4272,6 @@ gc_section_callback (lang_wild_statement_type *ptr,
                     lang_input_statement_type *file ATTRIBUTE_UNUSED,
                     void *data ATTRIBUTE_UNUSED)
 {
-  /* SEC_EXCLUDE is ignored when doing a relocatable link, except in
-     the special case of debug info.  (See bfd/stabs.c)
-     Twiddle the flag here, to simplify later linker code.  */
-  if (link_info.relocatable && (section->flags & SEC_DEBUGGING) == 0)
-    section->flags &= ~SEC_EXCLUDE;
-
   /* If the wild pattern was marked KEEP, the member sections
      should be as well.  */
   if (ptr->keep_sections)
@@ -4338,6 +4332,20 @@ lang_gc_sections (void)
        }
     }
 
+  /* SEC_EXCLUDE is ignored when doing a relocatable link, except in
+     the special case of debug info.  (See bfd/stabs.c)
+     Twiddle the flag here, to simplify later linker code.  */
+  if (link_info.relocatable)
+    {
+      LANG_FOR_EACH_INPUT_STATEMENT (f)
+       {
+         asection *sec;
+         for (sec = f->the_bfd->sections; sec != NULL; sec = sec->next)
+           if ((sec->flags & SEC_DEBUGGING) == 0)
+             sec->flags &= ~SEC_EXCLUDE;
+       }
+    }
+
   if (command_line.gc_sections)
     bfd_gc_sections (output_bfd, &link_info);
 }