public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: PowerPC64: Tidy stub type changes
Date: Tue, 28 Jun 2022 12:47:02 +0930	[thread overview]
Message-ID: <Yrpyrv9vbpqE0dr3@squeak.grove.modra.org> (raw)

It made sense before I started using separate fields for main type and
sub type to add a difference in main type to the type (thus keeping
sub type unchanged).  Not so much now.

	* elf64-ppc.c (ppc_merge_stub): Simplify stub type change.
	(ppc_size_one_stub): Likewise.

diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 04f2c146535..9491a0f9e66 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -3969,7 +3969,7 @@ ppc_merge_stub (struct ppc_link_hash_table *htab,
 
   old_type = stub_entry->type;
   if (old_type.main == ppc_stub_plt_branch)
-    old_type.main += ppc_stub_long_branch - ppc_stub_plt_branch;
+    old_type.main = ppc_stub_long_branch;
 
   if (old_type.main != stub_type.main
       || (old_type.sub != stub_type.sub
@@ -12300,7 +12300,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
     {
       /* Reset the stub type from the plt branch variant in case we now
 	 can reach with a shorter stub.  */
-      stub_entry->type.main += ppc_stub_long_branch - ppc_stub_plt_branch;
+      stub_entry->type.main = ppc_stub_long_branch;
     }
 
   if (stub_entry->type.main == ppc_stub_long_branch
@@ -12382,7 +12382,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
 	      stub_entry->group->stub_sec->flags |= SEC_RELOC;
 	    }
 
-	  stub_entry->type.main += ppc_stub_plt_branch - ppc_stub_long_branch;
+	  stub_entry->type.main = ppc_stub_plt_branch;
 	  if (!stub_entry->type.r2save)
 	    {
 	      size = 12;
@@ -12462,7 +12462,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
       /* If the branch can't reach, use a plt_branch.  */
       if (off + (1 << 25) >= (bfd_vma) (1 << 26))
 	{
-	  stub_entry->type.main += ppc_stub_plt_branch - ppc_stub_long_branch;
+	  stub_entry->type.main = ppc_stub_plt_branch;
 	  size += 4;
 	}
       else if (info->emitrelocations)

-- 
Alan Modra
Australia Development Lab, IBM

                 reply	other threads:[~2022-06-28  3:17 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=Yrpyrv9vbpqE0dr3@squeak.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).