* ldlang.c (wild_doit): Discard debugging sections if we are
authorIan Lance Taylor <ian@airs.com>
Mon, 22 Apr 1996 16:22:52 +0000 (16:22 +0000)
committerIan Lance Taylor <ian@airs.com>
Mon, 22 Apr 1996 16:22:52 +0000 (16:22 +0000)
stripping debugging information.

ld/ChangeLog
ld/ldlang.c

index 06af26a1524888dc7e7b5a8a5044ecc3c4ab7bcf..e30a0afceb45a718d84f4159eade47f7b777b7e5 100644 (file)
@@ -1,5 +1,8 @@
 Mon Apr 22 12:07:32 1996  Ian Lance Taylor  <ian@cygnus.com>
 
+       * ldlang.c (wild_doit): Discard debugging sections if we are
+       stripping debugging information.
+
        * emulparams/z8002.sh (ARCH): Set to z8002, not z8k.
 
 Tue Apr 16 16:38:32 1996  Ian Lance Taylor  <ian@cygnus.com>
index c3dc4e9040fccf74bb63dbfdd949c84885522000..3288fe1bce0146ee4b24d51708472f7457712286 100644 (file)
@@ -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)