aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorStefan Schulze Frielinghaus <stefansf@linux.ibm.com>2023-01-10 14:51:47 +0100
committerStefan Schulze Frielinghaus <stefansf@linux.ibm.com>2023-01-10 14:51:47 +0100
commit38775ca9a73f0586ae096e596f0fd13d2d6dbdd4 (patch)
treee71480deac4eccb72bfe1e173f233cb42d386a0a /bfd
parentddf8d80aef899b250949277c688476bb5f90f75d (diff)
downloadgdb-38775ca9a73f0586ae096e596f0fd13d2d6dbdd4.zip
gdb-38775ca9a73f0586ae096e596f0fd13d2d6dbdd4.tar.gz
gdb-38775ca9a73f0586ae096e596f0fd13d2d6dbdd4.tar.bz2
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. (cherry picked from commit aefebe82dc89711384b85329daa48d04c1d3a45b)
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elf32-s390.c4
-rw-r--r--bfd/elf64-s390.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 061307d..9496b14 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;
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 5279660..bcf5903 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -2714,7 +2714,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_64 (output_bfd, -tpoff (info, relocation),
+ bfd_put_64 (output_bfd, -tpoff (info, relocation) + rel->r_addend,
contents + rel->r_offset);
continue;
}
@@ -2907,7 +2907,7 @@ elf_s390_relocate_section (bfd *output_bfd,
else
{
BFD_ASSERT (! unresolved_reloc);
- bfd_put_64 (output_bfd, -tpoff (info, relocation),
+ bfd_put_64 (output_bfd, -tpoff (info, relocation) + rel->r_addend,
contents + rel->r_offset);
}
continue;