* ldlang.c (lang_size_sections_1): Skip removed output sections.
authorRichard Sandiford <rdsandiford@googlemail.com>
Mon, 10 Jun 2002 16:12:04 +0000 (16:12 +0000)
committerRichard Sandiford <rdsandiford@googlemail.com>
Mon, 10 Jun 2002 16:12:04 +0000 (16:12 +0000)
ld/ChangeLog
ld/ldlang.c

index 09204f27ee44a1b31cdd917cbd60272a68b56639..f1701025b485dfc0a3d7c927facaa62c568e23c9 100644 (file)
@@ -1,3 +1,7 @@
+2002-06-10  Richard Sandiford  <rsandifo@redhat.com>
+
+       * ldlang.c (lang_size_sections_1): Skip removed output sections.
+
 2002-06-08  Alan Modra  <amodra@bigpond.net.au>
 
        * ldexp.c: Replace CONST with const.
index 6346a747b13e3328e243ad039c1f7c7f15f0966a..abe38345fccf070701ae56193538f773534ea41d 100644 (file)
@@ -2907,6 +2907,14 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax)
              /* This section was never actually created.  */
              break;
 
+           /* The section might have been removed after its statement was
+              added.  For example, ldemul_before_allocation can remove
+              dynamic sections if they turn out not to be needed.  */
+           if (!link_info.relocateable
+               && (bfd_get_section_flags (output_bfd, os->bfd_section)
+                   & SEC_EXCLUDE) != 0)
+             break;
+
            /* If this is a COFF shared library section, use the size and
               address from the input section.  FIXME: This is COFF
               specific; it would be cleaner if there were some other way