* elflink.c (elf_link_input_bfd): Don't use linker_mark and
authorAlan Modra <amodra@gmail.com>
Mon, 24 Oct 2005 11:24:31 +0000 (11:24 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 24 Oct 2005 11:24:31 +0000 (11:24 +0000)
SEC_EXCLUDE to test for sections dropped from output.  Instead,
use bfd_section_removed_from_list on normal sections.  Don't
attempt to handle symbols with unknown reserved section indices.
* linker.c (_bfd_generic_link_output_symbols): Don't use
linker_mark to test for symbols belonging to dropped sections.
Do allow absolute symbols.

bfd/ChangeLog
bfd/elflink.c
bfd/linker.c

index 231e6daf8ab8ab42e62fb383406a977addbcc36f..fcb1fbc049e66284a02186a1531dabffa93a2a5d 100644 (file)
@@ -1,3 +1,13 @@
+2005-10-24  Alan Modra  <amodra@bigpond.net.au>
+
+       * elflink.c (elf_link_input_bfd): Don't use linker_mark and
+       SEC_EXCLUDE to test for sections dropped from output.  Instead,
+       use bfd_section_removed_from_list on normal sections.  Don't
+       attempt to handle symbols with unknown reserved section indices.
+       * linker.c (_bfd_generic_link_output_symbols): Don't use
+       linker_mark to test for symbols belonging to dropped sections.
+       Do allow absolute symbols.
+
 2005-10-24  Alan Modra  <amodra@bigpond.net.au>
 
        * elf32-i370.c (i370_elf_fake_sections): Don't set SHF_EXCLUDE on
index 61676d619f6276824a4a0a7a35475ce577ba6746..e122aea38d6f08b051ee32b14caf060d58aca565 100644 (file)
@@ -6827,8 +6827,10 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
        isec = bfd_com_section_ptr;
       else
        {
-         /* Who knows?  */
-         isec = NULL;
+         /* Don't attempt to output symbols with st_shnx in the
+            reserved range other than SHN_ABS and SHN_COMMON.  */
+         *ppsection = NULL;
+         continue;
        }
 
       *ppsection = isec;
@@ -6859,20 +6861,12 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
        continue;
 
       /* If this symbol is defined in a section which we are
-        discarding, we don't need to keep it, but note that
-        linker_mark is only reliable for sections that have contents.
-        For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE
-        as well as linker_mark.  */
-      if ((isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
+        discarding, we don't need to keep it.  */
+      if (isym->st_shndx != SHN_UNDEF
+         && (isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
          && (isec == NULL
-             || (! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0)
-             || (! finfo->info->relocatable
-                 && (isec->flags & SEC_EXCLUDE) != 0)))
-       continue;
-
-      /* If the section is not in the output BFD's section list, it is not
-        being output.  */
-      if (bfd_section_removed_from_list (output_bfd, isec->output_section))
+             || bfd_section_removed_from_list (output_bfd,
+                                               isec->output_section)))
        continue;
 
       /* Get the name of the symbol.  */
index 0bfdfb23706c530ee985490928d4a2ce242ae0b9..9e6199b835a5b40b682e751126f7a6fa0517b982 100644 (file)
@@ -2364,12 +2364,9 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
 
       /* 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.  .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,
+        symbol.  */
+      if (!bfd_is_abs_section (sym->section)
+         && bfd_section_removed_from_list (output_bfd,
                                            sym->section->output_section))
        output = FALSE;