aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-04-22 16:22:52 +0000
committerIan Lance Taylor <ian@airs.com>1996-04-22 16:22:52 +0000
commit6429ad7e580714a00df46baeb57fd5b91bc38df1 (patch)
treec4506281e42d2f2b0c792a8e057aed9d6c78f6ee /ld/ldlang.c
parent14706a96af05526f389cc4a071fbe6ed489f5af4 (diff)
downloadgdb-6429ad7e580714a00df46baeb57fd5b91bc38df1.zip
gdb-6429ad7e580714a00df46baeb57fd5b91bc38df1.tar.gz
gdb-6429ad7e580714a00df46baeb57fd5b91bc38df1.tar.bz2
* ldlang.c (wild_doit): Discard debugging sections if we are
stripping debugging information.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index c3dc4e9..3288fe1 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -726,14 +726,17 @@ wild_doit (ptr, section, output, file)
lang_output_section_statement_type *output;
lang_input_statement_type *file;
{
+ flagword flags;
boolean discard;
+ flags = bfd_get_section_flags (section->owner, section);
+
discard = false;
/* If we are doing a final link, discard sections marked with
SEC_EXCLUDE. */
if (! link_info.relocateable
- && (bfd_get_section_flags (section->owner, section) & SEC_EXCLUDE) != 0)
+ && (flags & SEC_EXCLUDE) != 0)
discard = true;
/* Discard input sections which are assigned to a section named
@@ -741,6 +744,12 @@ wild_doit (ptr, section, output, file)
if (strcmp (output->name, DISCARD_SECTION_NAME) == 0)
discard = true;
+ /* Discard debugging sections if we are stripping debugging
+ information. */
+ if ((link_info.strip == strip_debugger || link_info.strip == strip_all)
+ && (flags & SEC_DEBUGGING) != 0)
+ discard = true;
+
if (discard)
{
if (section->output_section == NULL)