aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-s390.c
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.vnet.ibm.com>2016-06-07 16:45:15 +0200
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>2016-06-07 16:47:10 +0200
commit161db2790500827b74ef835ebe515dce04021316 (patch)
tree1c29a0c7865c5be502dc3ff90409ebf6d6063700 /bfd/elf64-s390.c
parent14b57c7c6a53c747a8819fed3da858eae4195a0e (diff)
downloadgdb-161db2790500827b74ef835ebe515dce04021316.zip
gdb-161db2790500827b74ef835ebe515dce04021316.tar.gz
gdb-161db2790500827b74ef835ebe515dce04021316.tar.bz2
Fix PLT first entry GOT operand calculation.
Embedding the .plt section in another revealed a bug in the way the larl operand of the first magic plt entry is being calculated. Fixed with the attached patch. bfd/ChangeLog: * elf64-s390.c (elf_s390_finish_dynamic_sections): Subtract plt section offset when calculation the larl operand in the first PLT entry. ld/ChangeLog: * testsuite/ld-s390/pltoffset-1.dd: New test. * testsuite/ld-s390/pltoffset-1.ld: New test. * testsuite/ld-s390/pltoffset-1.s: New test. * testsuite/ld-s390/s390.exp: Run new test.
Diffstat (limited to 'bfd/elf64-s390.c')
-rw-r--r--bfd/elf64-s390.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index b14b479..9160068 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3782,9 +3782,10 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
PLT_FIRST_ENTRY_SIZE);
/* Fixup relative address to start of GOT */
bfd_put_32 (output_bfd,
- (htab->elf.sgotplt->output_section->vma +
- htab->elf.sgotplt->output_offset
- - htab->elf.splt->output_section->vma - 6)/2,
+ (htab->elf.sgotplt->output_section->vma
+ + htab->elf.sgotplt->output_offset
+ - htab->elf.splt->output_section->vma
+ - htab->elf.splt->output_offset - 6)/2,
htab->elf.splt->contents + 8);
}
if (elf_section_data (htab->elf.splt->output_section) != NULL)