aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2004-12-01 23:23:12 +0000
committerPaul Brook <paul@codesourcery.com>2004-12-01 23:23:12 +0000
commit529fcb958524a45f737111d1a42787fdee4d7c66 (patch)
treef38bc24abfe37a22a22ec1bc211564c4a6214fd8 /bfd/elflink.c
parent24b4912d646cbc0d98ac21645a48fae56e122f55 (diff)
downloadgdb-529fcb958524a45f737111d1a42787fdee4d7c66.zip
gdb-529fcb958524a45f737111d1a42787fdee4d7c66.tar.gz
gdb-529fcb958524a45f737111d1a42787fdee4d7c66.tar.bz2
2004-12-01 Paul Brook <paul@codesourcery.com>
bfd/ * elflink.c (elf_link_add_object_symbols): Make symbols from discarded sections undefined. ld/testsuite/ * ld-elf/group1.d: New test. * ld-elf/group.ld, ld-elf/group1a.s, ld-elf/group1b.s: New test.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index b095312..6e87596 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -3425,6 +3425,12 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
if (sec == NULL)
sec = bfd_abs_section_ptr;
+ else if (sec->kept_section)
+ {
+ /* Symbols from discarded section are undefined. */
+ sec = bfd_und_section_ptr;
+ isym->st_shndx = SHN_UNDEF;
+ }
else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
value -= sec->vma;
}