aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-sh.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-08-24 10:52:19 +0930
committerAlan Modra <amodra@gmail.com>2023-08-24 15:54:39 +0930
commitfb9b7fbf17f50fcfabf6e3d7d06a93e1f17c52b7 (patch)
treebbb1b44838dd32de708ae59886cddda29e7121d6 /bfd/elf32-sh.c
parent8eb7b3a7dbc24de0c9c938f00f2387351045cbdf (diff)
downloadbinutils-fb9b7fbf17f50fcfabf6e3d7d06a93e1f17c52b7.zip
binutils-fb9b7fbf17f50fcfabf6e3d7d06a93e1f17c52b7.tar.gz
binutils-fb9b7fbf17f50fcfabf6e3d7d06a93e1f17c52b7.tar.bz2
nds32, sh, kvx: DT_JMPREL/DT_PLTRELSZ
As commit fa4f2d46f9 did for x86, there a few other targets that wrongly use the output section rather than the dynamic section for DT_JMPREL and others. * elfnn-kvx.c (elfNN_kvx_finish_dynamic_sections): Use input section for DT_JMPREL. * elf32-sh.c (sh_elf_finish_dynamic_sections): Use input section for DT_JMPREL and DT_PLTRELSZ. * elf32-nds32.c (nds32_elf_finish_dynamic_sections): Likewise, and for DT_PLTGOT and when adjusting DT_RELA.
Diffstat (limited to 'bfd/elf32-sh.c')
-rw-r--r--bfd/elf32-sh.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index cba3529..817efb5 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -6291,15 +6291,13 @@ sh_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
break;
case DT_JMPREL:
- s = htab->root.srelplt->output_section;
- BFD_ASSERT (s != NULL);
- dyn.d_un.d_ptr = s->vma;
+ s = htab->root.srelplt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_PLTRELSZ:
- s = htab->root.srelplt->output_section;
- BFD_ASSERT (s != NULL);
+ s = htab->root.srelplt;
dyn.d_un.d_val = s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;