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 2/5] Content for TLS_IE_GOT not written to .got.
Date: Wed, 24 Aug 2016 14:55:00 -0000 [thread overview]
Message-ID: <EB86EB452ADE4B44B294F7149B8A2777022063A5@DE02WEMBXB.internal.synopsys.com> (raw)
In-Reply-To: <f84003d6-6da9-66c1-0664-ece45f6435c9@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 500 bytes --]
Hi Nick,
Indeed, a test case makes sense.
Please find a new patch attached.
Cheers,
Cupertino
On 08/19/2016 09:43 AM, Nick Clifton wrote:
> Hi Cupertino,
>
>> When no dynamic relocation was generated the .got content would not be
>> updated for the TLS_IE_GOT relocation addresses.
> I think that this particular patch ought to be accompanied by a testcase
> to make sure that it continues to work. Could you see if you rustle one
> up please ?
>
>
> Cheers
> Nick
>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-Content-for-TLS_IE_GOT-not-written-to-.got.patch --]
[-- Type: text/x-patch; name="0002-Content-for-TLS_IE_GOT-not-written-to-.got.patch", Size: 3498 bytes --]
From 7af0a7dffd4d396214b1ffa28a5923dafd7e4154 Mon Sep 17 00:00:00 2001
From: Cupertino Miranda <cmiranda@synopsys.com>
Date: Tue, 12 Jul 2016 16:31:40 +0200
Subject: [PATCH 2/5] Content for TLS_IE_GOT not written to .got.
When no dynamic relocation was generated the .got content would not be
updated for the TLS_IE_GOT relocation addresses.
bfd/ChangeLog:
Cupertino Miranda <cmiranda@synopsys.com>
arc-got.h (relocate_fix_got_relocs_for_got_info): Fixed addresses in
debug comments. Fixed address in .got related to TLS_IE_GOT dynamic
relocation.
ld/ChangeLog:
Cupertino Miranda <cmiranda@synopsys.com>
testsuite/ld-arc/tls_ie-01.s: Added to verify associated fix.
testsuite/ld-arc/tls_ie-01.d: Likewise
---
bfd/arc-got.h | 24 +++++++++++++++++-------
ld/testsuite/ld-arc/tls_ie-01.d | 9 +++++++++
ld/testsuite/ld-arc/tls_ie-01.s | 10 ++++++++++
3 files changed, 36 insertions(+), 7 deletions(-)
create mode 100644 ld/testsuite/ld-arc/tls_ie-01.d
create mode 100644 ld/testsuite/ld-arc/tls_ie-01.s
diff --git a/bfd/arc-got.h b/bfd/arc-got.h
index 7c3cfd9..9ac0295 100644
--- a/bfd/arc-got.h
+++ b/bfd/arc-got.h
@@ -334,13 +334,15 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
? 4 : 0));
ARC_DEBUG ("arc_info: FIXED -> %s value = %#lx "
- "@ %p, for symbol %s\n",
+ "@ %lx, for symbol %s\n",
(entry->type == GOT_TLS_GD ? "GOT_TLS_GD" :
"GOT_TLS_IE"),
(long) (sym_value - sec_vma),
- htab->sgot->contents + entry->offset
- + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
- ? 4 : 0),
+ (long) (htab->sgot->output_section->vma
+ + htab->sgot->output_offset->vma
+ + entry->offset
+ + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
+ ? 4 : 0)),
symbol_name);
}
break;
@@ -351,14 +353,22 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
bfd_vma ATTRIBUTE_UNUSED sec_vma
= tls_sec->output_section->vma;
+ bfd_put_32 (output_bfd,
+ sym_value - sec_vma,
+ htab->sgot->contents + entry->offset
+ + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
+ ? 4 : 0));
+
ARC_DEBUG ("arc_info: FIXED -> %s value = %#lx "
"@ %p, for symbol %s\n",
(entry->type == GOT_TLS_GD ? "GOT_TLS_GD" :
"GOT_TLS_IE"),
(long) (sym_value - sec_vma),
- htab->sgot->contents + entry->offset
- + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
- ? 4 : 0),
+ (long) (htab->sgot->output_section->vma
+ + htab->sgot->output_offset->vma
+ + entry->offset
+ + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
+ ? 4 : 0)),
symbol_name);
}
break;
diff --git a/ld/testsuite/ld-arc/tls_ie-01.d b/ld/testsuite/ld-arc/tls_ie-01.d
new file mode 100644
index 0000000..8d53ef5
--- /dev/null
+++ b/ld/testsuite/ld-arc/tls_ie-01.d
@@ -0,0 +1,9 @@
+#source: tls_ie-01.s
+#as: -mcpu=arc700
+#ld:
+#objdump: -s -j .got
+
+[^:]+: file format elf32-littlearc
+
+Contents of section \.got:
+ [0-9a-f]+ 00000000 04000000 .+
diff --git a/ld/testsuite/ld-arc/tls_ie-01.s b/ld/testsuite/ld-arc/tls_ie-01.s
new file mode 100644
index 0000000..74f40ed
--- /dev/null
+++ b/ld/testsuite/ld-arc/tls_ie-01.s
@@ -0,0 +1,10 @@
+ .tls_common foo,4,4
+ .tls_common bar,4,4
+
+ .text
+ .align 4
+
+ .global __start
+__start:
+ ld r14, [pcl, @foo@tlsie]
+ ld r15, [pcl, @bar@tlsie]
--
2.9.0
next prev parent reply other threads:[~2016-08-24 14:55 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 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-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 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
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 [this message]
2016-08-25 10:59 ` 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-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=EB86EB452ADE4B44B294F7149B8A2777022063A5@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).