summaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2012-03-23 09:27:40 +0000
committerAlan Modra <amodra@bigpond.net.au>2012-03-23 09:27:40 +0000
commit8efd1781af338ecd687515ff6a34d3ab1fe044ed (patch)
tree42f28d1c81a6ba78aba1bfc9ec258aecbe926cd9 /bfd/elflink.c
parent20a90f314c776b2f708361bbacee0ad0ab7dcbb1 (diff)
downloadbinutils-redhat-8efd1781af338ecd687515ff6a34d3ab1fe044ed.tar.gz
* 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.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 7f9ec609b5..3236911744 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);
}
}