summaryrefslogtreecommitdiff
path: root/bfd/elf32-s390.c
diff options
context:
space:
mode:
authorStefan Schulze Frielinghaus <stefansf@linux.ibm.com>2023-01-10 14:34:16 +0100
committerStefan Schulze Frielinghaus <stefansf@linux.ibm.com>2023-01-10 14:34:16 +0100
commitaefebe82dc89711384b85329daa48d04c1d3a45b (patch)
tree11200422b2e566a41b07e2229c51692034a179b0 /bfd/elf32-s390.c
parent18737d14799d609054994987dd75631430637a99 (diff)
downloadbinutils-gdb-aefebe82dc89711384b85329daa48d04c1d3a45b.tar.gz
IBM zSystems: Fix offset relative to static TLS
For local exec TLS relocations of the form foo@NTPOFF+x the addend was ignored. bfd/ChangeLog: * elf32-s390.c (elf_s390_relocate_section): Honor addend for R_390_TLS_LE32. * elf64-s390.c (elf_s390_relocate_section): Honor addend for R_390_TLS_LE64. ld/ChangeLog: * testsuite/ld-s390/reloctlsle-1.d: New test. * testsuite/ld-s390/reloctlsle-1.s: New test.
Diffstat (limited to 'bfd/elf32-s390.c')
-rw-r--r--bfd/elf32-s390.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 061307d6c3b..9496b1472d6 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -2706,7 +2706,7 @@ elf_s390_relocate_section (bfd *output_bfd,
/* This relocation gets optimized away by the local exec
access optimization. */
BFD_ASSERT (! unresolved_reloc);
- bfd_put_32 (output_bfd, -tpoff (info, relocation),
+ bfd_put_32 (output_bfd, -tpoff (info, relocation) + rel->r_addend,
contents + rel->r_offset);
continue;
}
@@ -2901,7 +2901,7 @@ elf_s390_relocate_section (bfd *output_bfd,
else
{
BFD_ASSERT (! unresolved_reloc);
- bfd_put_32 (output_bfd, -tpoff (info, relocation),
+ bfd_put_32 (output_bfd, -tpoff (info, relocation) + rel->r_addend,
contents + rel->r_offset);
}
continue;