diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2009-01-11 21:09:49 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2009-01-11 21:09:49 +0000 |
commit | 80c29487db33cf7e597402790cdf62785e7a89cb (patch) | |
tree | 04d3162299f1d83d746dff927c8ff7e8e66b9522 /bfd/elflink.c | |
parent | 5f61c20e05b3752fb9ab5b2aeea6adc8bf515db5 (diff) | |
download | gdb-80c29487db33cf7e597402790cdf62785e7a89cb.zip gdb-80c29487db33cf7e597402790cdf62785e7a89cb.tar.gz gdb-80c29487db33cf7e597402790cdf62785e7a89cb.tar.bz2 |
bfd/
* elflink.c (_bfd_elf_section_already_linked): Handle g++-3.4
relocations in `.gnu.linkonce.r.*' referencing its `.gnu.linkonce.t.*'.
ld/testsuite/
* ld-elf/linkoncerdiff.d, ld-elf/linkoncerdiff1.s,
ld-elf/linkoncerdiff2.s: New.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index 987de89..29523c4 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -12281,6 +12281,28 @@ _bfd_elf_section_already_linked (bfd *abfd, asection *sec, } } + /* Do not complain on unresolved relocations in `.gnu.linkonce.r.F' + referencing its discarded `.gnu.linkonce.t.F' counterpart - g++-3.4 + specific as g++-4.x is using COMDAT groups (without the `.gnu.linkonce' + prefix) instead. `.gnu.linkonce.r.*' were the `.rodata' part of its + matching `.gnu.linkonce.t.*'. If `.gnu.linkonce.r.F' is not discarded + but its `.gnu.linkonce.t.F' is discarded means we chose one-only + `.gnu.linkonce.t.F' section from a different bfd not requiring any + `.gnu.linkonce.r.F'. Thus `.gnu.linkonce.r.F' should be discarded. + The reverse order cannot happen as there is never a bfd with only the + `.gnu.linkonce.r.F' section. The order of sections in a bfd does not + matter as here were are looking only for cross-bfd sections. */ + + if ((flags & SEC_GROUP) == 0 && CONST_STRNEQ (name, ".gnu.linkonce.r.")) + for (l = already_linked_list->entry; l != NULL; l = l->next) + if ((l->sec->flags & SEC_GROUP) == 0 + && CONST_STRNEQ (l->sec->name, ".gnu.linkonce.t.")) + { + if (abfd != l->sec->owner) + sec->output_section = bfd_abs_section_ptr; + break; + } + /* This is the first section with this name. Record it. */ if (! bfd_section_already_linked_table_insert (already_linked_list, sec)) info->callbacks->einfo (_("%F%P: already_linked_table: %E")); |