aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1997-02-06 22:02:51 +0000
committerIan Lance Taylor <ian@airs.com>1997-02-06 22:02:51 +0000
commit258b1f5d18105cada68ce457610e1e4614a568d6 (patch)
tree9d32f1ece7da405b994101e8ba9f018de9e7e6c9 /bfd
parent6927c24d3c0b54a98e939a3201a46d726b782e89 (diff)
downloadgdb-258b1f5d18105cada68ce457610e1e4614a568d6.zip
gdb-258b1f5d18105cada68ce457610e1e4614a568d6.tar.gz
gdb-258b1f5d18105cada68ce457610e1e4614a568d6.tar.bz2
* elflink.h (elf_link_input_bfd): Discard local symbols that are
attached to sections which are not being included in the link.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elflink.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 86352f0..dd5b4db 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -2881,9 +2881,20 @@ elf_link_input_bfd (finfo, input_bfd)
if (finfo->info->discard == discard_all)
continue;
+ /* If this symbol is defined in a section which we are
+ discarding, we don't need to keep it. For the benefit of the
+ MIPS ELF linker, we check SEC_EXCLUDE as well as linker_mark. */
+ if (isym->st_shndx > 0
+ && isym->st_shndx < SHN_LORESERVE
+ && isec != NULL
+ && (! isec->linker_mark
+ || (! finfo->info->relocateable
+ && (isec->flags & SEC_EXCLUDE) != 0)))
+ continue;
+
/* Get the name of the symbol. */
name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link,
- isym->st_name);
+ isym->st_name);
if (name == NULL)
return false;