[ARM] set DF_STATIC_TLS when emitting IE relocs

Message ID 20140512171919.GB21081@redacted.bos.redhat.com
State New
Headers show

Commit Message

Kyle McMartin May 12, 2014, 5:19 p.m.
Similarly to the AArch64 patch, set DF_STATIC_TLS for consistency with
other architectures when we emit IE relocs in a shared library.

2014-05-12  Kyle McMartin <kyle@redhat.com>

    * elf32-arm.c (elf32_arm_check_relocs): Set DF_STATIC_TLS when emitting
      initial-exec relocs when not linking an executable.
---
 bfd/elf32-arm.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Nick Clifton June 17, 2014, 11:07 a.m. | #1
Hi Kyle,

> 2014-05-12  Kyle McMartin <kyle@redhat.com>
>
>      * elf32-arm.c (elf32_arm_check_relocs): Set DF_STATIC_TLS when emitting
>        initial-exec relocs when not linking an executable.

Approved - please apply.

Cheers
   Nick
Kyle McMartin June 22, 2014, 1:09 p.m. | #2
On Sun, Jun 22, 2014 at 07:04:17AM +0200, Hans-Peter Nilsson wrote:
> > From: Nicholas Clifton <nickc@redhat.com>
> > Date: Tue, 17 Jun 2014 13:07:13 +0200
> 
> > > 2014-05-12  Kyle McMartin <kyle@redhat.com>
> > >
> > >      * elf32-arm.c (elf32_arm_check_relocs): Set DF_STATIC_TLS when emitting
> > >        initial-exec relocs when not linking an executable.
> > 
> > Approved - please apply.
> 
> This patch caused my autotester for arm-eabi to complain:
> 
> Running /tmp/hpautotest-binutils/bsrc/src/ld/testsuite/ld-arm/arm-elf.exp ...
> FAIL: TLS gnu GD to IE shared relaxation
> 
> Looks like the regexps have to be tweaked.
> 
> I see it fails for arm-linux-gnueabi too, which is a bit
> surprising, as I'd have guess that's the target for which you
> ran the test-suite (you didn't say).
> 

Hrm, I didn't see this, but the version I likely tested on was quite a
bit older than head. Will fix this up. Sorry about that.

regards, Kyle

Patch hide | download patch | download mbox

diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 526d4f8..d5dcc83 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -12705,6 +12705,9 @@  elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
 		default: tls_type = GOT_NORMAL; break;
 		}
 
+	      if (!info->executable && (tls_type & GOT_TLS_IE))
+		info->flags |= DF_STATIC_TLS;
+
 	      if (h != NULL)
 		{
 		  h->got.refcount++;