aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2004-05-29 04:30:41 +0000
committerAlan Modra <amodra@gmail.com>2004-05-29 04:30:41 +0000
commit9ca57817d355fd086e08866295f8ce7381af3ac9 (patch)
tree969a3dafb0df605c774e2d0d9bfa096a79435d45 /ld/ldlang.c
parent90e01f8635b2f086f3aa13222289458630571f12 (diff)
downloadgdb-9ca57817d355fd086e08866295f8ce7381af3ac9.zip
gdb-9ca57817d355fd086e08866295f8ce7381af3ac9.tar.gz
gdb-9ca57817d355fd086e08866295f8ce7381af3ac9.tar.bz2
* ldlang.c (gc_section_callback): Move SEC_EXCLUDE twiddles..
(lang_gc_sections): .. to a LANG_FOR_EACH_INPUT_STATEMENT loop here.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index b471b5b..7ff8be0 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -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);
}