From: "H.J. Lu" <hjl.tools@gmail.com>
To: Cary Coutant <ccoutant@gmail.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [gold commit] PR 20216: Fix extraneous complaints about missing expected TLS relocation
Date: Wed, 17 Aug 2016 14:54:00 -0000 [thread overview]
Message-ID: <CAMe9rOqdxBufp-tmipbsUVP5hHC3dsGDMsi_XXuZfcLic0JqUg@mail.gmail.com> (raw)
In-Reply-To: <CAJimCsESW-uHRCkj3kHGJT81ZiQAc4MoLSoyPH9ozPnVzNXGWA@mail.gmail.com>
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.
prev parent reply other threads:[~2016-08-17 14:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-10 17:59 Cary Coutant
2016-08-10 18:14 ` Cary Coutant
2016-08-17 14:54 ` H.J. Lu [this message]
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=CAMe9rOqdxBufp-tmipbsUVP5hHC3dsGDMsi_XXuZfcLic0JqUg@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=binutils@sourceware.org \
--cc=ccoutant@gmail.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).