From e00d879a2e9169759518dd419d19f1b3dcb6f709 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Fri, 19 Sep 2014 12:44:54 +0200 Subject: [PATCH] S/390: Don't replace R_390_TLS_LE32/64 with R_390_TLS_TPOFF for PIE. bfd: 2014-09-19 Andreas Krebbel * elf32-s390.c: Don't replace R_390_TLS_LE32 with R_390_TLS_TPOFF for PIE. * elf64-s390.c: Don't replace R_390_TLS_LE64 with R_390_TLS_TPOFF for PIE. --- bfd/ChangeLog | 7 +++++++ bfd/elf32-s390.c | 8 +++++++- bfd/elf64-s390.c | 8 +++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b2e61408861..12797b5825f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2014-09-19 Andreas Krebbel + + * elf32-s390.c: Don't replace R_390_TLS_LE32 with R_390_TLS_TPOFF + for PIE. + * elf64-s390.c: Don't replace R_390_TLS_LE64 with R_390_TLS_TPOFF + for PIE. + 2014-09-18 Jan Kratochvil PR gdb/17407 diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 11c726fc7e8..ebcb028b86b 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -1250,6 +1250,12 @@ elf_s390_check_relocs (bfd *abfd, /* Fall through. */ case R_390_TLS_LE32: + /* For static linking and executables this reloc will be + calculated at linktime otherwise a TLS_TPOFF runtime + reloc will be generated. */ + if (r_type == R_390_TLS_LE32 && info->pie) + break; + if (!info->shared) break; info->flags |= DF_STATIC_TLS; @@ -3104,7 +3110,7 @@ elf_s390_relocate_section (bfd *output_bfd, break; case R_390_TLS_LE32: - if (info->shared) + if (info->shared && !info->pie) { /* Linking a shared library with non-fpic code requires a R_390_TLS_TPOFF relocation. */ diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index d7b2f084bc6..b2f1aa59fd6 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -1183,6 +1183,12 @@ elf_s390_check_relocs (bfd *abfd, /* Fall through */ case R_390_TLS_LE64: + /* For static linking and executables this reloc will be + calculated at linktime otherwise a TLS_TPOFF runtime + reloc will be generated. */ + if (r_type == R_390_TLS_LE64 && info->pie) + break; + if (!info->shared) break; info->flags |= DF_STATIC_TLS; @@ -3074,7 +3080,7 @@ elf_s390_relocate_section (bfd *output_bfd, break; case R_390_TLS_LE64: - if (info->shared) + if (info->shared && !info->pie) { /* Linking a shared library with non-fpic code requires a R_390_TLS_TPOFF relocation. */ -- 2.30.2