public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: [GOLD] PR30536, ppc64el gold linker produces unusable clang-16 binary
Date: Wed, 21 Jun 2023 23:07:48 +0930	[thread overview]
Message-ID: <ZJL9LBr/Zuvjc+Yv@squeak.grove.modra.org> (raw)

In commit 0961e631575b, the fix for PR30217, make_lplt_section and
make_brlt_section were changed to use rela_dyn_ rather than their own
separate dynamic reloc sections.  This fails miserably whenever brlt_
is needed for long branches, due to needing to iterate sizing and thus
reset brlt_ sizes.

	PR 30536
	PR 30217
	* powerpc.cc (Target_powerpc::make_brlt_section): Don't use
	rela_dyn_.

diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index a847dadf900..aa2d9a18787 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -4632,7 +4632,15 @@ Target_powerpc<size, big_endian>::make_brlt_section(Layout* layout)
 	{
 	  // When PIC we can't fill in .branch_lt but must initialise at
 	  // runtime via dynamic relocations.
-	  brlt_rel = this->rela_dyn_section(layout);
+	  this->rela_dyn_section(layout);
+	  // FIXME: This reloc section won't have its relative relocs
+	  // sorted properly among the other relative relocs in rela_dyn_
+	  // but it must be a separate section due to needing to call
+	  // reset_data_size().
+	  brlt_rel = new Reloc_section(false);
+	  if (this->rela_dyn_->output_section())
+	    this->rela_dyn_->output_section()
+	      ->add_output_section_data(brlt_rel);
 	}
       this->brlt_section_
 	= new Output_data_brlt_powerpc<size, big_endian>(this, brlt_rel);

-- 
Alan Modra
Australia Development Lab, IBM

                 reply	other threads:[~2023-06-21 13:37 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=ZJL9LBr/Zuvjc+Yv@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).