2005-04-11 H.J. Lu <hongjiu.lu@intel.com>
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 11 Apr 2005 22:21:23 +0000 (22:21 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 11 Apr 2005 22:21:23 +0000 (22:21 +0000)
* linker.c (_bfd_generic_link_output_symbols): Also check if
the output section of an input section has been removed from
the output file.

* section.c (bfd_section_list_remove): Clear the next field
of the removed section.
(bfd_section_removed_from_list): New.
* bfd-in2.h: Regenerated.

bfd/ChangeLog
bfd/bfd-in2.h
bfd/linker.c
bfd/section.c

index 7accdd9b0ede1a7e694950748a4e6fcac839c0b7..365b7d931a942d38175ff7814668375fac5984ef 100644 (file)
@@ -1,3 +1,14 @@
+2005-04-11  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * linker.c (_bfd_generic_link_output_symbols): Also check if
+       the output section of an input section has been removed from
+       the output file.
+
+       * section.c (bfd_section_list_remove): Clear the next field
+       of the removed section.
+       (bfd_section_removed_from_list): New.
+       * bfd-in2.h: Regenerated.
+
 2005-04-11  David S. Miller  <davem@davemloft.net>
 
        * elf32-sparc.c (elf32_sparc_relocate_section,
index 626642045b28364dd443cdbb7a456de88849b76b..bed224d34be5a1e57eba6e020b2c2901a25c55de 100644 (file)
@@ -1445,6 +1445,8 @@ extern const struct bfd_symbol * const bfd_ind_symbol;
       *_ps = _s->next;                                 \
       if (_s->next == NULL)                            \
         (ABFD)->section_tail = _ps;                    \
+      else                                             \
+        _s->next = NULL;                               \
     }                                                  \
   while (0)
 #define bfd_section_list_insert(ABFD, PS, S) \
@@ -1458,6 +1460,8 @@ extern const struct bfd_symbol * const bfd_ind_symbol;
         (ABFD)->section_tail = &_s->next;              \
     }                                                  \
   while (0)
+#define bfd_section_removed_from_list(ABFD, S) \
+  ((S)->next == NULL && &(S)->next != (ABFD)->section_tail)
 
 void bfd_section_list_clear (bfd *);
 
index f940d321bd056b567c979fb553cf60dd517ff3cc..89630c0e2f0301402e3db740e8cf210b923fbef0 100644 (file)
@@ -2363,12 +2363,14 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
        abort ();
 
       /* If this symbol is in a section which is not being included
-        in the output file, then we don't want to output the symbol.
-
-        Gross.  .bss and similar sections won't have the linker_mark
-        field set.  */
-      if ((sym->section->flags & SEC_HAS_CONTENTS) != 0
-         && ! sym->section->linker_mark)
+        in the output file, then we don't want to output the
+        symbol.  .bss and similar sections won't have the linker_mark
+        field set.  We also check if its output section has been
+        removed from the output file.  */
+      if (((sym->section->flags & SEC_HAS_CONTENTS) != 0
+          && ! sym->section->linker_mark)
+         || bfd_section_removed_from_list (output_bfd,
+                                           sym->section->output_section))
        output = FALSE;
 
       if (output)
index 49a87035b7442cf7b801d5ce556597332317efab..914d1825007e47a622a9f74034e9933694b553cd 100644 (file)
@@ -546,6 +546,8 @@ CODE_FRAGMENT
 .      *_ps = _s->next;                                        \
 .      if (_s->next == NULL)                           \
 .        (ABFD)->section_tail = _ps;                   \
+.      else                                            \
+.        _s->next = NULL;                              \
 .    }                                                 \
 .  while (0)
 .#define bfd_section_list_insert(ABFD, PS, S) \
@@ -559,6 +561,8 @@ CODE_FRAGMENT
 .        (ABFD)->section_tail = &_s->next;             \
 .    }                                                 \
 .  while (0)
+.#define bfd_section_removed_from_list(ABFD, S)        \
+.  ((S)->next == NULL && &(S)->next != (ABFD)->section_tail)
 .
 */
 
This page took 0.033755 seconds and 4 git commands to generate.