* amd64obsd-tdep.c (amd64obsd_sigtramp_p): Adjust for new
[deliverable/binutils-gdb.git] / ld / ldlang.c
index b471b5b9bbc76f6d4f83942bbc8f5e1e515fc75d..7ff8be0dcb888641507070fc815251bfa9a3dd2c 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);
 }
This page took 0.022904 seconds and 4 git commands to generate.