public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Cupertino Miranda <Cupertino.Miranda@synopsys.com>
To: Nick Clifton <nickc@redhat.com>,
	Cupertino Miranda	<Cupertino.Miranda@synopsys.com>,
	"binutils@sourceware.org"	<binutils@sourceware.org>
Cc: "Francois.Bedard@synopsys.com" <Francois.Bedard@synopsys.com>,
	"Claudiu.Zissulescu@synopsys.com"
	<Claudiu.Zissulescu@synopsys.com>
Subject: Re: [PATCH 5/5] Dynamic TLS GOT entries would not be relocated.
Date: Wed, 24 Aug 2016 14:56:00 -0000	[thread overview]
Message-ID: <EB86EB452ADE4B44B294F7149B8A2777022063D2@DE02WEMBXB.internal.synopsys.com> (raw)
In-Reply-To: <928a3aab-56ea-88e7-ac42-ad4d7a07e4c8@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 387 bytes --]

Hi,

Indeed description should have been more verbose/existent.
Please find a new patch with new description and testcase.

Cheers,
Cupertino

On 08/19/2016 09:54 AM, Nick Clifton wrote:
> Hi Cupertino,
>
>> bfd/ChangeLog:
>>
>> Cupertino Miranda  <cmiranda@synopsys.com>
>>
>> 	elf32-arc.c (elf_arc_relocate_section): Changed.
> Why ?
>
>
> Cheers
>   Nick
>
>


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0005-Dynamic-TLS-GOT-entries-would-not-be-relocated.patch --]
[-- Type: text/x-patch; name="0005-Dynamic-TLS-GOT-entries-would-not-be-relocated.patch", Size: 2351 bytes --]

From 1e84cd9dedf83b5771ca38257740226add64b011 Mon Sep 17 00:00:00 2001
From: Cupertino Miranda <cmiranda@synopsys.com>
Date: Thu, 21 Jul 2016 15:32:35 +0200
Subject: [PATCH 5/5] Dynamic TLS GOT entries would not be relocated.

Forgot to set should_relocate to TRUE in case of GOT and TLS relocations of
undefined symbols for shared libraries.
In dynamic libraries if symbol is not known the instruction relocation would
not be resolved to point to the respective .got entry.
A test was created to detect similar future mistakes.

bfd/ChangeLog:

Cupertino Miranda  <cmiranda@synopsys.com>

	elf32-arc.c (elf_arc_relocate_section): Changed. Set should_relocate to
						TRUE for GOT and TLS relocs.

ld/ChangeLog:

Cupertino Miranda  <cmiranda@synopsys.com>

	ld/testsuite/ld-arc/tls_gd-01.s: Added a testcase for this patch.
	ld/testsuite/ld-arc/tls_gd-01.d: Likewise.
---
 bfd/elf32-arc.c                 |  2 ++
 ld/testsuite/ld-arc/tls_gd-01.d | 13 +++++++++++++
 ld/testsuite/ld-arc/tls_gd-01.s |  7 +++++++
 3 files changed, 22 insertions(+)
 create mode 100644 ld/testsuite/ld-arc/tls_gd-01.d
 create mode 100644 ld/testsuite/ld-arc/tls_gd-01.s

diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index e4b2d09..6ebe5bf 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -1374,6 +1374,8 @@ elf_arc_relocate_section (bfd *		          output_bfd,
       if ((is_reloc_for_GOT (howto)
 	   || is_reloc_for_TLS (howto)))
 	{
+	  reloc_data.should_relocate = TRUE;
+
 	  struct got_entry **list
 	    = get_got_entry_list_for_symbol (output_bfd, r_symndx, h);
 
diff --git a/ld/testsuite/ld-arc/tls_gd-01.d b/ld/testsuite/ld-arc/tls_gd-01.d
new file mode 100644
index 0000000..f7027af
--- /dev/null
+++ b/ld/testsuite/ld-arc/tls_gd-01.d
@@ -0,0 +1,13 @@
+#source: tls_gd-01.s
+#as: -mcpu=arc700
+#ld: -shared
+#objdump: -d
+
+[^:]+:     file format elf32-littlearc
+
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <__start>:
+ [0-9a-f]+:	2700 7f80 0000 2080 	add	r0,pcl,0x2080
+ [0-9a-f]+:	2700 7f80 0000 2080 	add	r0,pcl,0x2080
diff --git a/ld/testsuite/ld-arc/tls_gd-01.s b/ld/testsuite/ld-arc/tls_gd-01.s
new file mode 100644
index 0000000..a217a13
--- /dev/null
+++ b/ld/testsuite/ld-arc/tls_gd-01.s
@@ -0,0 +1,7 @@
+	.text
+	.align 4
+
+        .global __start
+__start:
+	add r0, pcl, @baz@tlsgd      
+	add r0, pcl, @bar@tlsgd      
-- 
2.9.0


  reply	other threads:[~2016-08-24 14:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-16 15:51 [PATCH 0/5] Fixes / improvements to ARC BFD target support Cupertino Miranda
2016-08-16 15:51 ` [PATCH 5/5] Dynamic TLS GOT entries would not be relocated Cupertino Miranda
2016-08-19  7:54   ` Nick Clifton
2016-08-24 14:56     ` Cupertino Miranda [this message]
2016-08-25 11:03       ` Nick Clifton
2016-08-16 15:51 ` [PATCH 2/5] Content for TLS_IE_GOT not written to .got Cupertino Miranda
2016-08-19  7:43   ` Nick Clifton
2016-08-24 14:55     ` Cupertino Miranda
2016-08-25 10:59       ` Nick Clifton
2016-08-16 15:51 ` [PATCH 4/5] Fixed -init, -fini linker options Cupertino Miranda
2016-08-19  7:54   ` Nick Clifton
2016-08-16 15:51 ` [PATCH 1/5] Fixes to legacy relocations Cupertino Miranda
2016-08-19  7:41   ` Nick Clifton
2016-08-16 15:51 ` [PATCH 3/5] Several fixes related to ARC PIE support Cupertino Miranda
2016-08-19  7:53   ` Nick Clifton
2016-08-24 14:55     ` Cupertino Miranda
2016-08-25 11:06       ` Nick Clifton
2016-08-19  7:40 ` [PATCH 0/5] Fixes / improvements to ARC BFD target support Nick Clifton
2016-08-24 14:53   ` Cupertino Miranda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EB86EB452ADE4B44B294F7149B8A2777022063D2@DE02WEMBXB.internal.synopsys.com \
    --to=cupertino.miranda@synopsys.com \
    --cc=Claudiu.Zissulescu@synopsys.com \
    --cc=Francois.Bedard@synopsys.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).