• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisión0249c0828027b6e1ea2001ead8fd2b4db8b1a9ba (tree)
Tiempo2016-06-08 21:07:29
AutorMarcin Kościelnicki <koriakin@0x04...>
CommiterMarcin Kościelnicki

Log Message

bfd/elf64-s390: Prepare for _GLOBAL_OFFSET_TABLE_ != DT_PLTGOT

This will be used for got relro support.

Cambiar Resumen

Diferencia incremental

--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -2467,9 +2467,10 @@ elf_s390_relocate_section (bfd *output_bfd,
24672467 {
24682468 plt_index = h->plt.offset / PLT_ENTRY_SIZE;
24692469 relocation = (plt_index * GOT_ENTRY_SIZE +
2470- htab->elf.igotplt->output_offset);
2471- if (r_type == R_390_GOTPLTENT)
2472- relocation += htab->elf.igotplt->output_section->vma;
2470+ htab->elf.igotplt->output_offset +
2471+ htab->elf.igotplt->output_section->vma);
2472+ if (r_type != R_390_GOTPLTENT)
2473+ relocation -= htab->elf.sgot->output_section->vma;
24732474 }
24742475 else
24752476 {
@@ -2480,9 +2481,11 @@ elf_s390_relocate_section (bfd *output_bfd,
24802481
24812482 /* Offset in GOT is PLT index plus GOT headers(3)
24822483 times 8, addr & GOT addr. */
2483- relocation = (plt_index + 3) * GOT_ENTRY_SIZE;
2484- if (r_type == R_390_GOTPLTENT)
2485- relocation += htab->elf.sgot->output_section->vma;
2484+ relocation = (plt_index + 3) * GOT_ENTRY_SIZE +
2485+ htab->elf.sgotplt->output_offset +
2486+ htab->elf.sgotplt->output_section->vma;
2487+ if (r_type != R_390_GOTPLTENT)
2488+ relocation -= htab->elf.sgot->output_section->vma;
24862489 }
24872490 unresolved_reloc = FALSE;
24882491 break;
@@ -2631,15 +2634,16 @@ elf_s390_relocate_section (bfd *output_bfd,
26312634 if (off >= (bfd_vma) -2)
26322635 abort ();
26332636
2634- relocation = base_got->output_offset + off;
2637+ relocation = base_got->output_offset + off +
2638+ base_got->output_section->vma;
26352639
26362640 /* For @GOTENT the relocation is against the offset between
26372641 the instruction and the symbols entry in the GOT and not
26382642 between the start of the GOT and the symbols entry. We
26392643 add the vma of the GOT to get the correct value. */
2640- if ( r_type == R_390_GOTENT
2641- || r_type == R_390_GOTPLTENT)
2642- relocation += base_got->output_section->vma;
2644+ if ( r_type != R_390_GOTENT
2645+ && r_type != R_390_GOTPLTENT)
2646+ relocation -= htab->elf.sgot->output_section->vma;
26432647
26442648 break;
26452649