diff options
author | Stefan Liebler <stli@linux.ibm.com> | 2022-04-28 14:30:55 +0200 |
---|---|---|
committer | Andreas Krebbel <krebbel@linux.ibm.com> | 2022-04-28 14:52:06 +0200 |
commit | d942d8db12adf4c9e5c7d9ed6496a779ece7149e (patch) | |
tree | 77e858bfe1da6acb8675137c73285fd2f5c67ab0 /bfd | |
parent | 26b1426577b5dcb32d149c64cca3e603b81948a9 (diff) | |
download | binutils-d942d8db12adf4c9e5c7d9ed6496a779ece7149e.zip binutils-d942d8db12adf4c9e5c7d9ed6496a779ece7149e.tar.gz binutils-d942d8db12adf4c9e5c7d9ed6496a779ece7149e.tar.bz2 |
s390: Add DT_JMPREL pointing to .rela.[i]plt with static-pie
In static-pie case, there are IRELATIVE-relocs in
.rela.iplt (htab->irelplt), which will later be grouped
to .rela.plt. On s390, the IRELATIVE relocations are
always located in .rela.iplt - even for non-static case.
Ensure that DT_JMPREL, DT_PLTRELA, DT_PLTRELASZ is added
to the dynamic section even if htab->srelplt->size == 0.
See _bfd_elf_add_dynamic_tags in bfd/elflink.c.
bfd/
elf64-s390.c (elf_s390_size_dynamic_sections):
Enforce DT_JMPREL via htab->elf.dt_jmprel_required.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/elf64-s390.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 00ee386..0b851f7 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -1876,7 +1876,20 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, else if (startswith (bfd_section_name (s), ".rela")) { if (s->size != 0 && s != htab->elf.srelplt) - relocs = true; + { + relocs = true; + if (s == htab->elf.irelplt) + { + /* In static-pie case, there are IRELATIVE-relocs in + .rela.iplt (htab->irelplt), which will later be grouped + to .rela.plt. On s390, the IRELATIVE relocations are + always located in .rela.iplt - even for non-static case. + Ensure that DT_JMPREL, DT_PLTRELA, DT_PLTRELASZ is added + to the dynamic section even if htab->srelplt->size == 0. + See _bfd_elf_add_dynamic_tags in bfd/elflink.c. */ + htab->elf.dt_jmprel_required = true; + } + } /* We use the reloc_count field as a counter if we need to copy relocs into the output file. */ |