aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Koƛcielnicki <koriakin@0x04.net>2016-06-03 16:41:01 +0200
committerMarcin Koƛcielnicki <koriakin@0x04.net>2016-06-08 14:07:29 +0200
commit0249c0828027b6e1ea2001ead8fd2b4db8b1a9ba (patch)
treeebe566888341e967677a769e7d0f32bd8b3bc67e
parent85dd6069e6baac2596d6e9f200d4761eea2169de (diff)
downloadfsf-binutils-gdb-0249c0828027b6e1ea2001ead8fd2b4db8b1a9ba.zip
fsf-binutils-gdb-0249c0828027b6e1ea2001ead8fd2b4db8b1a9ba.tar.gz
fsf-binutils-gdb-0249c0828027b6e1ea2001ead8fd2b4db8b1a9ba.tar.bz2
bfd/elf64-s390: Prepare for _GLOBAL_OFFSET_TABLE_ != DT_PLTGOT
This will be used for got relro support.
-rw-r--r--bfd/elf64-s390.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index a39e1c9..f3282d8 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -2467,9 +2467,10 @@ elf_s390_relocate_section (bfd *output_bfd,
{
plt_index = h->plt.offset / PLT_ENTRY_SIZE;
relocation = (plt_index * GOT_ENTRY_SIZE +
- htab->elf.igotplt->output_offset);
- if (r_type == R_390_GOTPLTENT)
- relocation += htab->elf.igotplt->output_section->vma;
+ htab->elf.igotplt->output_offset +
+ htab->elf.igotplt->output_section->vma);
+ if (r_type != R_390_GOTPLTENT)
+ relocation -= htab->elf.sgot->output_section->vma;
}
else
{
@@ -2480,9 +2481,11 @@ elf_s390_relocate_section (bfd *output_bfd,
/* Offset in GOT is PLT index plus GOT headers(3)
times 8, addr & GOT addr. */
- relocation = (plt_index + 3) * GOT_ENTRY_SIZE;
- if (r_type == R_390_GOTPLTENT)
- relocation += htab->elf.sgot->output_section->vma;
+ relocation = (plt_index + 3) * GOT_ENTRY_SIZE +
+ htab->elf.sgotplt->output_offset +
+ htab->elf.sgotplt->output_section->vma;
+ if (r_type != R_390_GOTPLTENT)
+ relocation -= htab->elf.sgot->output_section->vma;
}
unresolved_reloc = FALSE;
break;
@@ -2631,15 +2634,16 @@ elf_s390_relocate_section (bfd *output_bfd,
if (off >= (bfd_vma) -2)
abort ();
- relocation = base_got->output_offset + off;
+ relocation = base_got->output_offset + off +
+ base_got->output_section->vma;
/* For @GOTENT the relocation is against the offset between
the instruction and the symbols entry in the GOT and not
between the start of the GOT and the symbols entry. We
add the vma of the GOT to get the correct value. */
- if ( r_type == R_390_GOTENT
- || r_type == R_390_GOTPLTENT)
- relocation += base_got->output_section->vma;
+ if ( r_type != R_390_GOTENT
+ && r_type != R_390_GOTPLTENT)
+ relocation -= htab->elf.sgot->output_section->vma;
break;