aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-s390.c
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2003-11-20 09:54:07 +0000
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2003-11-20 09:54:07 +0000
commit90ced0dda19963b5a4f79acb8a0fe8e0fe77e70c (patch)
tree88fdc6d526ffeca3c44035c2171f7721b7d9f3a9 /bfd/elf64-s390.c
parent600e9c9985ff6c233bc416452af578c309e30fbe (diff)
downloadgdb-90ced0dda19963b5a4f79acb8a0fe8e0fe77e70c.zip
gdb-90ced0dda19963b5a4f79acb8a0fe8e0fe77e70c.tar.gz
gdb-90ced0dda19963b5a4f79acb8a0fe8e0fe77e70c.tar.bz2
* elf32-s390.c (elf_s390_relocate_section): Don't recalculate symbol
section for reloc output and subtract the output section's address from the addend when converting a relocation into one against a section symbol. * elf64-s390.c (elf_s390_relocate_section): Likewise.
Diffstat (limited to 'bfd/elf64-s390.c')
-rw-r--r--bfd/elf64-s390.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 8b521be..e14a0fc 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -2606,26 +2606,17 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
/* This symbol is local, or marked to become local. */
+ outrel.r_addend = relocation + rel->r_addend;
if (r_type == R_390_64)
{
relocate = TRUE;
outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
- outrel.r_addend = relocation + rel->r_addend;
}
else
{
long sindx;
- if (h == NULL)
- sec = local_sections[r_symndx];
- else
- {
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || (h->root.type
- == bfd_link_hash_defweak));
- sec = h->root.u.def.section;
- }
- if (sec != NULL && bfd_is_abs_section (sec))
+ if (bfd_is_abs_section (sec))
sindx = 0;
else if (sec == NULL || sec->owner == NULL)
{
@@ -2639,9 +2630,16 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
osec = sec->output_section;
sindx = elf_section_data (osec)->dynindx;
BFD_ASSERT (sindx > 0);
+
+ /* We are turning this relocation into one
+ against a section symbol, so subtract out
+ the output section's address but not the
+ offset of the input section in the output
+ section. */
+
+ outrel.r_addend -= osec->vma;
}
outrel.r_info = ELF64_R_INFO (sindx, r_type);
- outrel.r_addend = relocation + rel->r_addend;
}
}