This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] fix linker relaxation for local dynamic to local exec for s390*
- From: Martin Schwidefsky <schwidefsky at de dot ibm dot com>
- To: binutils at sourceware dot org
- Date: Thu, 22 Dec 2011 16:03:37 +0100
- Subject: [PATCH] fix linker relaxation for local dynamic to local exec for s390*
Hi,
the fix from 2006 for the linker relaxation for local dynamic to local
exec introduced a subtle problem in regard to debugging info.
The old code applied the relaxation for R_390_TLS_LDO32/R_390_TLS_LDO64
only for code sections. That does not work for s390 as the offsets will
be in the (read-only) data section. The current code does not check at
all and will do the relaxation for all sections. That is incorrect for
the case of a DTPOFF in a debugging section. The patch below avoids
the relaxation in case the SEC_DEBUGGING section flag is set.
Patch has been commited to the cvs.
--
blue skies,
Martin.
ChangeLog:
2011-12-22 Martin Schwidefsky <schwidefsky@de.ibm.com>
* elf32-s390.c (elf_s390_relocate_section): Add check for debugging
section in LD to LE linker relaxation for R_390_TLS_LDO32.
* elf64-s390.c (elf_s390_relocate_section): Likewise for
R_390_TLS_LDO64.
---
diff -urpN src/bfd/elf32-s390.c src-s390/bfd/elf32-s390.c
--- src/bfd/elf32-s390.c 2011-10-13 16:53:48.098436739 +0200
+++ src-s390/bfd/elf32-s390.c 2011-10-13 17:25:56.213313390 +0200
@@ -2862,7 +2862,7 @@ elf_s390_relocate_section (output_bfd, i
continue;
case R_390_TLS_LDO32:
- if (info->shared)
+ if (info->shared || (input_section->flags & SEC_DEBUGGING))
relocation -= dtpoff_base (info);
else
/* When converting LDO to LE, we must negate. */
diff -urpN src/bfd/elf64-s390.c src-s390/bfd/elf64-s390.c
--- src/bfd/elf64-s390.c 2011-10-13 16:53:48.730443005 +0200
+++ src-s390/bfd/elf64-s390.c 2011-10-13 17:26:33.213670966 +0200
@@ -2861,7 +2861,7 @@ elf_s390_relocate_section (bfd *output_b
continue;
case R_390_TLS_LDO64:
- if (info->shared)
+ if (info->shared || (input_section->flags & SEC_DEBUGGING))
relocation -= dtpoff_base (info);
else
/* When converting LDO to LE, we must negate. */