aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 636dc7f..72545c2 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -4718,10 +4718,20 @@ lang_gc_sections (void)
}
}
- if (command_line.gc_sections)
+ if (link_info.gc_sections)
bfd_gc_sections (output_bfd, &link_info);
}
+static void
+lang_mark_used_section (void)
+{
+ unsigned int gc_sections = link_info.gc_sections;
+
+ link_info.gc_sections = 0;
+ bfd_gc_sections (output_bfd, &link_info);
+ link_info.gc_sections = gc_sections;
+}
+
void
lang_process (void)
{
@@ -4883,7 +4893,7 @@ lang_process (void)
lang_check_section_addresses ();
/* Final stuffs. */
-
+ lang_mark_used_section ();
ldemul_finish ();
lang_finish ();
}