GNU Binutils with patches for OS216
Revisión | 0249c0828027b6e1ea2001ead8fd2b4db8b1a9ba (tree) |
---|---|
Tiempo | 2016-06-08 21:07:29 |
Autor | Marcin Kościelnicki <koriakin@0x04...> |
Commiter | Marcin Kościelnicki |
bfd/elf64-s390: Prepare for _GLOBAL_OFFSET_TABLE_ != DT_PLTGOT
This will be used for got relro support.
@@ -2467,9 +2467,10 @@ elf_s390_relocate_section (bfd *output_bfd, | ||
2467 | 2467 | { |
2468 | 2468 | plt_index = h->plt.offset / PLT_ENTRY_SIZE; |
2469 | 2469 | 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; | |
2473 | 2474 | } |
2474 | 2475 | else |
2475 | 2476 | { |
@@ -2480,9 +2481,11 @@ elf_s390_relocate_section (bfd *output_bfd, | ||
2480 | 2481 | |
2481 | 2482 | /* Offset in GOT is PLT index plus GOT headers(3) |
2482 | 2483 | 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; | |
2486 | 2489 | } |
2487 | 2490 | unresolved_reloc = FALSE; |
2488 | 2491 | break; |
@@ -2631,15 +2634,16 @@ elf_s390_relocate_section (bfd *output_bfd, | ||
2631 | 2634 | if (off >= (bfd_vma) -2) |
2632 | 2635 | abort (); |
2633 | 2636 | |
2634 | - relocation = base_got->output_offset + off; | |
2637 | + relocation = base_got->output_offset + off + | |
2638 | + base_got->output_section->vma; | |
2635 | 2639 | |
2636 | 2640 | /* For @GOTENT the relocation is against the offset between |
2637 | 2641 | the instruction and the symbols entry in the GOT and not |
2638 | 2642 | between the start of the GOT and the symbols entry. We |
2639 | 2643 | 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; | |
2643 | 2647 | |
2644 | 2648 | break; |
2645 | 2649 |