diff options
author | Paul Brook <paul@codesourcery.com> | 2004-12-01 23:23:12 +0000 |
---|---|---|
committer | Paul Brook <paul@codesourcery.com> | 2004-12-01 23:23:12 +0000 |
commit | 529fcb958524a45f737111d1a42787fdee4d7c66 (patch) | |
tree | f38bc24abfe37a22a22ec1bc211564c4a6214fd8 | |
parent | 24b4912d646cbc0d98ac21645a48fae56e122f55 (diff) | |
download | gdb-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.
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elflink.c | 6 | ||||
-rw-r--r-- | ld/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/group.ld | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/group1.d | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/group1a.s | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/group1b.s | 6 |
7 files changed, 40 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6a1d301..dc0d933 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2004-12-01 Paul Brook <paul@codesourcery.com> + + * elflink.c (elf_link_add_object_symbols): Make symbols from discarded + sections undefined. + 2004-11-30 Paul Brook <paul@codesourcery.com> * elf32-arm.c (struct elf32_arm_link_hash_table): Remove 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; } diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 05f91c9..d927189 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-12-01 Paul Brook <paul@codesourcery.com> + + * ld-elf/group1.d: New test. + * ld-elf/group.ld, ld-elf/group1a.s, ld-elf/group1b.s: New test. + 2004-12-01 Daniel Jacobowitz <dan@codesourcery.com> * ld-selective/selective.exp: Use -print-libgcc-file-name for diff --git a/ld/testsuite/ld-elf/group.ld b/ld/testsuite/ld-elf/group.ld new file mode 100644 index 0000000..d6b27d0 --- /dev/null +++ b/ld/testsuite/ld-elf/group.ld @@ -0,0 +1,5 @@ +SECTIONS +{ + . = 0x1000; + .text : { *(.text) } +} diff --git a/ld/testsuite/ld-elf/group1.d b/ld/testsuite/ld-elf/group1.d new file mode 100644 index 0000000..d2f1b58 --- /dev/null +++ b/ld/testsuite/ld-elf/group1.d @@ -0,0 +1,9 @@ +#source: group1a.s +#source: group1b.s +#ld: -T group.ld +#readelf: -s +Symbol table '.symtab' contains .* entries: +#... + .*: 00001000 0 NOTYPE WEAK DEFAULT . foo + .*: 00000000 0 NOTYPE GLOBAL DEFAULT UND bar +#... diff --git a/ld/testsuite/ld-elf/group1a.s b/ld/testsuite/ld-elf/group1a.s new file mode 100644 index 0000000..296e76e --- /dev/null +++ b/ld/testsuite/ld-elf/group1a.s @@ -0,0 +1,4 @@ + .section .text,"axG",%progbits,foo_group,comdat + .weak foo +foo: + .word 0 diff --git a/ld/testsuite/ld-elf/group1b.s b/ld/testsuite/ld-elf/group1b.s new file mode 100644 index 0000000..b66cba9 --- /dev/null +++ b/ld/testsuite/ld-elf/group1b.s @@ -0,0 +1,6 @@ + .section .text,"axG",%progbits,foo_group,comdat + .global foo + .global bar +foo: + .word 0 +bar: |