diff options
author | Alan Modra <amodra@gmail.com> | 2012-03-23 09:27:43 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2012-03-23 09:27:43 +0000 |
commit | 051d833a41cabf1bcc879756756901deb6b1c448 (patch) | |
tree | 2cb969716e76459261953767f3ea4df56e29462d /bfd/elflink.c | |
parent | 62599110be4d6baae772ce8022801f06137495b9 (diff) | |
download | gdb-051d833a41cabf1bcc879756756901deb6b1c448.zip gdb-051d833a41cabf1bcc879756756901deb6b1c448.tar.gz gdb-051d833a41cabf1bcc879756756901deb6b1c448.tar.bz2 |
* linker.c (_bfd_nearby_section): New function, split out from..
(fix_syms): ..here.
* bfd-in.h (_bfd_nearby_section): Declare.
* bfd-in2.h: Regenerate.
* elflink.c (elf_link_input_bfd): Don't use text_index_section or
data_index_section with ld -q or ld -r output relocs against
stripped output sections. Instead use _bfd_nearby_section.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index 7f9ec60..3236911 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -9747,23 +9747,12 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) r_symndx = osec->target_index; if (r_symndx == STN_UNDEF) { - struct elf_link_hash_table *htab; - asection *oi; - - htab = elf_hash_table (finfo->info); - oi = htab->text_index_section; - if ((osec->flags & SEC_READONLY) == 0 - && htab->data_index_section != NULL) - oi = htab->data_index_section; - - if (oi != NULL) - { - irela->r_addend += osec->vma - oi->vma; - r_symndx = oi->target_index; - } + irela->r_addend += osec->vma; + osec = _bfd_nearby_section (output_bfd, osec, + osec->vma); + irela->r_addend -= osec->vma; + r_symndx = osec->target_index; } - - BFD_ASSERT (r_symndx != STN_UNDEF); } } |