public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: [GOLD] PowerPC64 __tls_get_addr_opt stub
Date: Thu, 24 Sep 2020 08:12:06 +0930	[thread overview]
Message-ID: <20200923224205.GI5452@bubble.grove.modra.org> (raw)

This stub doesn't have the r2 store at the beginning.

	* powerpc.cc (Target_powerpc::Relocate::relocate): Don't skip
	first insn of __tls_get_addr_opt stub.

diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index e35cbcf6c0..1020fa42f9 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -10401,21 +10401,24 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
 		    value += ent->tocoff_;
 		  if (size == 64
 		      && ent->r2save_
-		      && r_type == elfcpp::R_PPC64_REL24_NOTOC)
+		      && !(gsym != NULL
+			   && target->is_tls_get_addr_opt(gsym)))
 		    {
-		      if (!(target->power10_stubs()
-			    && target->power10_stubs_auto()))
-			value += 4;
-		    }
-		  else if (size == 64
-			   && ent->r2save_
-			   && relnum < reloc_count - 1)
-		    {
-		      Reltype next_rela(preloc + reloc_size);
-		      if (elfcpp::elf_r_type<size>(next_rela.get_r_info())
-			  == elfcpp::R_PPC64_TOCSAVE
-			  && next_rela.get_r_offset() == rela.get_r_offset() + 4)
-			value += 4;
+		      if (r_type == elfcpp::R_PPC64_REL24_NOTOC)
+			{
+			  if (!(target->power10_stubs()
+				&& target->power10_stubs_auto()))
+			    value += 4;
+			}
+		      else if (relnum < reloc_count - 1)
+			{
+			  Reltype next_rela(preloc + reloc_size);
+			  if (elfcpp::elf_r_type<size>(next_rela.get_r_info())
+			      == elfcpp::R_PPC64_TOCSAVE
+			      && (next_rela.get_r_offset()
+				  == rela.get_r_offset() + 4))
+			    value += 4;
+			}
 		    }
 		  localentry0 = ent->localentry0_;
 		  has_stub_value = true;

-- 
Alan Modra
Australia Development Lab, IBM

                 reply	other threads:[~2020-09-23 22:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200923224205.GI5452@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    /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).