diff options
author | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-06-03 16:41:01 +0200 |
---|---|---|
committer | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-06-22 13:06:44 +0200 |
commit | 2dacf3e9c87ef61f1e3172227cc91bf04b4baa7e (patch) | |
tree | c5d4da6ada7ffd73ac82b679bea9d6e1e946724e | |
parent | cbbdd101141a3c855b20c902f4fd33172fbae227 (diff) | |
download | gdb-2dacf3e9c87ef61f1e3172227cc91bf04b4baa7e.zip gdb-2dacf3e9c87ef61f1e3172227cc91bf04b4baa7e.tar.gz gdb-2dacf3e9c87ef61f1e3172227cc91bf04b4baa7e.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.c | 24 |
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; |