* [gold commit] PR 20216: Fix extraneous complaints about missing expected TLS relocation
@ 2016-08-10 17:59 Cary Coutant
2016-08-10 18:14 ` Cary Coutant
2016-08-17 14:54 ` H.J. Lu
0 siblings, 2 replies; 3+ messages in thread
From: Cary Coutant @ 2016-08-10 17:59 UTC (permalink / raw)
To: Binutils
With some versions of gas, the call to tls_get_addr uses a GOTPCREL
relocation instead of a GOTPCRELX relocation. We should allow for that
when skip_call_tls_get_addr_ is true. We should also build the test
objects with the in-tree assembler.
This patch also fixes some cascading error messages caused by not
resetting the skip_call_tls_get_addr_ flag after printing the error.
-cary
2016-08-10 Cary Coutant <ccoutant@gmail.com>
gold/
PR gold/20216
* x86_64.cc (Target_x86_64::Relocate::relocate): Add check for
R_X86_64_GOTPCREL. Reset skip_call_tls_get_addr_ after printing
error message.
* testsuite/Makefile.am (pr20216_gd.o): Add -Bgcctestdir/.
(pr20216_ld.o): Likewise.
* testsuite/Makefile.in: Regenerate.
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index 39f9e9e..739458c 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -1193,10 +1193,10 @@ pr20216b.so: pr20216_def.o gcctestdir/ld
$(LINK) -Bgcctestdir/ -shared pr20216_def.o
pr20216_gd.o: pr20216_gd.S
- $(COMPILE) -c -o $@ $<
+ $(COMPILE) -Bgcctestdir/ -c -o $@ $<
pr20216_ld.o: pr20216_ld.S
- $(COMPILE) -c -o $@ $<
+ $(COMPILE) -Bgcctestdir/ -c -o $@ $<
endif DEFAULT_TARGET_X86_64_OR_X32
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index 6aa489a..8d494ea 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -3505,6 +3505,7 @@ Target_x86_64<size>::Relocate::relocate(
if (this->skip_call_tls_get_addr_)
{
if ((r_type != elfcpp::R_X86_64_PLT32
+ && r_type != elfcpp::R_X86_64_GOTPCREL
&& r_type != elfcpp::R_X86_64_GOTPCRELX
&& r_type != elfcpp::R_X86_64_PLT32_BND
&& r_type != elfcpp::R_X86_64_PC32_BND
@@ -3514,6 +3515,7 @@ Target_x86_64<size>::Relocate::relocate(
{
gold_error_at_location(relinfo, relnum, rela.get_r_offset(),
_("missing expected TLS relocation"));
+ this->skip_call_tls_get_addr_ = false;
}
else
{
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gold commit] PR 20216: Fix extraneous complaints about missing expected TLS relocation
2016-08-10 17:59 [gold commit] PR 20216: Fix extraneous complaints about missing expected TLS relocation Cary Coutant
@ 2016-08-10 18:14 ` Cary Coutant
2016-08-17 14:54 ` H.J. Lu
1 sibling, 0 replies; 3+ messages in thread
From: Cary Coutant @ 2016-08-10 18:14 UTC (permalink / raw)
To: Binutils
> gold/
> PR gold/20216
> * x86_64.cc (Target_x86_64::Relocate::relocate): Add check for
> R_X86_64_GOTPCREL. Reset skip_call_tls_get_addr_ after printing
> error message.
> * testsuite/Makefile.am (pr20216_gd.o): Add -Bgcctestdir/.
> (pr20216_ld.o): Likewise.
> * testsuite/Makefile.in: Regenerate.
I've backported this to the 2.27 branch.
-cary
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gold commit] PR 20216: Fix extraneous complaints about missing expected TLS relocation
2016-08-10 17:59 [gold commit] PR 20216: Fix extraneous complaints about missing expected TLS relocation Cary Coutant
2016-08-10 18:14 ` Cary Coutant
@ 2016-08-17 14:54 ` H.J. Lu
1 sibling, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2016-08-17 14:54 UTC (permalink / raw)
To: Cary Coutant; +Cc: Binutils
On Wed, Aug 10, 2016 at 10:59 AM, Cary Coutant <ccoutant@gmail.com> wrote:
> With some versions of gas, the call to tls_get_addr uses a GOTPCREL
> relocation instead of a GOTPCRELX relocation. We should allow for that
> when skip_call_tls_get_addr_ is true. We should also build the test
> objects with the in-tree assembler.
>
> This patch also fixes some cascading error messages caused by not
> resetting the skip_call_tls_get_addr_ flag after printing the error.
>
> -cary
>
>
> 2016-08-10 Cary Coutant <ccoutant@gmail.com>
>
> gold/
> PR gold/20216
> * x86_64.cc (Target_x86_64::Relocate::relocate): Add check for
> R_X86_64_GOTPCREL. Reset skip_call_tls_get_addr_ after printing
> error message.
> * testsuite/Makefile.am (pr20216_gd.o): Add -Bgcctestdir/.
> (pr20216_ld.o): Likewise.
> * testsuite/Makefile.in: Regenerate.
>
> diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
> index 39f9e9e..739458c 100644
> --- a/gold/testsuite/Makefile.am
> +++ b/gold/testsuite/Makefile.am
> @@ -1193,10 +1193,10 @@ pr20216b.so: pr20216_def.o gcctestdir/ld
> $(LINK) -Bgcctestdir/ -shared pr20216_def.o
>
> pr20216_gd.o: pr20216_gd.S
> - $(COMPILE) -c -o $@ $<
> + $(COMPILE) -Bgcctestdir/ -c -o $@ $<
>
> pr20216_ld.o: pr20216_ld.S
> - $(COMPILE) -c -o $@ $<
> + $(COMPILE) -Bgcctestdir/ -c -o $@ $<
>
> endif DEFAULT_TARGET_X86_64_OR_X32
>
> diff --git a/gold/x86_64.cc b/gold/x86_64.cc
> index 6aa489a..8d494ea 100644
> --- a/gold/x86_64.cc
> +++ b/gold/x86_64.cc
> @@ -3505,6 +3505,7 @@ Target_x86_64<size>::Relocate::relocate(
> if (this->skip_call_tls_get_addr_)
> {
> if ((r_type != elfcpp::R_X86_64_PLT32
> + && r_type != elfcpp::R_X86_64_GOTPCREL
There are
// Convert
// callq *foo@GOTPCRELX(%rip) to
// addr32 callq foo
// and jmpq *foo@GOTPCRELX(%rip) to
// jmpq foo
// nop
template<class View_type>
static inline bool
can_convert_callq_to_direct(const Symbol* gsym, unsigned int r_type,
size_t r_offset, View_type* view)
{
gold_assert(gsym != NULL);
// We cannot do the conversion unless it's a GOTPCRELX relocation.
if (r_type != elfcpp::R_X86_64_GOTPCRELX)
return false;
I don't think checking R_X86_64_GOTPCREL is needed. GCC
generates x86-64 TLS code sequences without PLT only if
R_X86_64_GOTPCRELX is supported.
> && r_type != elfcpp::R_X86_64_GOTPCRELX
> && r_type != elfcpp::R_X86_64_PLT32_BND
> && r_type != elfcpp::R_X86_64_PC32_BND
> @@ -3514,6 +3515,7 @@ Target_x86_64<size>::Relocate::relocate(
> {
> gold_error_at_location(relinfo, relnum, rela.get_r_offset(),
> _("missing expected TLS relocation"));
> + this->skip_call_tls_get_addr_ = false;
> }
> else
> {
--
H.J.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-17 14:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-10 17:59 [gold commit] PR 20216: Fix extraneous complaints about missing expected TLS relocation Cary Coutant
2016-08-10 18:14 ` Cary Coutant
2016-08-17 14:54 ` 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).