* [PATCH] Handle Initial-Exec to Local-Exec for x32
@ 2015-01-06 21:00 H.J. Lu
2015-01-06 21:18 ` Cary Coutant
0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2015-01-06 21:00 UTC (permalink / raw)
To: binutils; +Cc: Cary Coutant
Hi,
This patch handls Handle Initial-Exec to Local-Exec for x32. OK
to install?
Thanks.
H.J.
---
PR gold/17809
* x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
x32.
---
gold/ChangeLog | 6 ++++++
gold/x86_64.cc | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 496d9a7..af56066 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gold/17809
+ * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
+ x32.
+
2015-01-02 Alan Modra <amodra@gmail.com>
* version.cc (print_version): Just print current year.
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index b45eb3b..c368b03 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -4100,6 +4100,8 @@ Target_x86_64<size>::Relocate::tls_ie_to_le(
// movq
if (op1 == 0x4c)
view[-3] = 0x49;
+ else if (size == 32 && op1 == 0x44)
+ view[-3] = 0x41;
view[-2] = 0xc7;
view[-1] = 0xc0 | reg;
}
@@ -4108,6 +4110,8 @@ Target_x86_64<size>::Relocate::tls_ie_to_le(
// Special handling for %rsp.
if (op1 == 0x4c)
view[-3] = 0x49;
+ else if (size == 32 && op1 == 0x44)
+ view[-3] = 0x41;
view[-2] = 0x81;
view[-1] = 0xc0 | reg;
}
@@ -4116,6 +4120,8 @@ Target_x86_64<size>::Relocate::tls_ie_to_le(
// addq
if (op1 == 0x4c)
view[-3] = 0x4d;
+ else if (size == 32 && op1 == 0x44)
+ view[-3] = 0x45;
view[-2] = 0x8d;
view[-1] = 0x80 | reg | (reg << 3);
}
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Handle Initial-Exec to Local-Exec for x32
2015-01-06 21:00 [PATCH] Handle Initial-Exec to Local-Exec for x32 H.J. Lu
@ 2015-01-06 21:18 ` Cary Coutant
2015-01-06 21:40 ` H.J. Lu
0 siblings, 1 reply; 6+ messages in thread
From: Cary Coutant @ 2015-01-06 21:18 UTC (permalink / raw)
To: H.J. Lu; +Cc: Binutils
> This patch handls Handle Initial-Exec to Local-Exec for x32. OK
> to install?
>
> PR gold/17809
> * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
> x32.
This is OK. Thanks!
When I run the test case from the PR through gold, I get a "TLS
relocation out of range" error for the first instruction, since it
doesn't have a REX prefix, and we'd otherwise try to look at .text -
1. How did you get around that? Do we need to support TLS relocations
on instructions without a REX prefix?
Where is the TLS ABI for x32 documented?
-cary
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Handle Initial-Exec to Local-Exec for x32
2015-01-06 21:18 ` Cary Coutant
@ 2015-01-06 21:40 ` H.J. Lu
2015-01-06 21:47 ` Cary Coutant
2015-01-07 22:16 ` Cary Coutant
0 siblings, 2 replies; 6+ messages in thread
From: H.J. Lu @ 2015-01-06 21:40 UTC (permalink / raw)
To: Cary Coutant; +Cc: Binutils
On Tue, Jan 6, 2015 at 1:18 PM, Cary Coutant <ccoutant@google.com> wrote:
>> This patch handls Handle Initial-Exec to Local-Exec for x32. OK
>> to install?
>>
>> PR gold/17809
>> * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
>> x32.
>
> This is OK. Thanks!
Is it OK for 2.25 branch?
> When I run the test case from the PR through gold, I get a "TLS
> relocation out of range" error for the first instruction, since it
> doesn't have a REX prefix, and we'd otherwise try to look at .text -
> 1. How did you get around that? Do we need to support TLS relocations
You need to install binutils with fix for
https://sourceware.org/bugzilla/show_bug.cgi?id=17482
> on instructions without a REX prefix?
Well, it is
https://sourceware.org/bugzilla/show_bug.cgi?id=17795
>
> -cary
> Where is the TLS ABI for x32 documented?
It is at
https://github.com/hjl-tools/x86-64-psABI/tree/hjl/x32/master
--
H.J.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Handle Initial-Exec to Local-Exec for x32
2015-01-06 21:40 ` H.J. Lu
@ 2015-01-06 21:47 ` Cary Coutant
2015-01-07 22:16 ` Cary Coutant
1 sibling, 0 replies; 6+ messages in thread
From: Cary Coutant @ 2015-01-06 21:47 UTC (permalink / raw)
To: H.J. Lu; +Cc: Binutils
>>> PR gold/17809
>>> * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
>>> x32.
>>
>> This is OK. Thanks!
>
> Is it OK for 2.25 branch?
OK with me.
-cary
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Handle Initial-Exec to Local-Exec for x32
2015-01-06 21:40 ` H.J. Lu
2015-01-06 21:47 ` Cary Coutant
@ 2015-01-07 22:16 ` Cary Coutant
2015-01-07 23:16 ` H.J. Lu
1 sibling, 1 reply; 6+ messages in thread
From: Cary Coutant @ 2015-01-07 22:16 UTC (permalink / raw)
To: H.J. Lu; +Cc: Binutils
>> Do we need to support TLS relocations
>> on instructions without a REX prefix?
>
> Well, it is
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=17795
Yeah -- I just wasn't yet sure whether you agreed with me.
-cary
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Handle Initial-Exec to Local-Exec for x32
2015-01-07 22:16 ` Cary Coutant
@ 2015-01-07 23:16 ` H.J. Lu
0 siblings, 0 replies; 6+ messages in thread
From: H.J. Lu @ 2015-01-07 23:16 UTC (permalink / raw)
To: Cary Coutant; +Cc: Binutils
On Wed, Jan 7, 2015 at 2:16 PM, Cary Coutant <ccoutant@google.com> wrote:
>>> Do we need to support TLS relocations
>>> on instructions without a REX prefix?
>>
>> Well, it is
>>
>> https://sourceware.org/bugzilla/show_bug.cgi?id=17795
>
> Yeah -- I just wasn't yet sure whether you agreed with me.
>
I agree with you on this. Sorry that I didn't make it clear before.
--
H.J.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-01-07 23:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-06 21:00 [PATCH] Handle Initial-Exec to Local-Exec for x32 H.J. Lu
2015-01-06 21:18 ` Cary Coutant
2015-01-06 21:40 ` H.J. Lu
2015-01-06 21:47 ` Cary Coutant
2015-01-07 22:16 ` Cary Coutant
2015-01-07 23:16 ` H.J. Lu
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).