public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb/binutils-2_40-branch] [GOLD] powerpc DT_RELACOUNT
Date: Fri, 23 Jun 2023 11:36:53 +0000 (GMT)	[thread overview]
Message-ID: <20230623113653.5593B3858CD1@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7ad52a2357f1d6eb886f548bdb4dae7e15d5f827

commit 7ad52a2357f1d6eb886f548bdb4dae7e15d5f827
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Jun 23 08:48:38 2023 +0930

    [GOLD] powerpc DT_RELACOUNT
    
    DT_RELACOUNT was calculated incorrectly, and relative relocs not
    sorted as they should be to the start of .rela.dyn, due to adding one
    particular class of dynamic reloc using the wrong "add" method.
    
            * powerpc.cc (Target_powerpc::Scan::global): Add relative
            dyn relocs for ADDR64 and similar using add_global_relative.
    
    (cherry picked from commit 027614abf11de9e79a335df4e1f9a788b7ab0063)

Diff:
---
 gold/powerpc.cc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index aa2d9a18787..0c15e1b3721 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -9005,9 +9005,14 @@ Target_powerpc<size, big_endian>::Scan::global(
 		  = target->rela_dyn_section(symtab, layout, is_ifunc);
 		unsigned int dynrel = (is_ifunc ? elfcpp::R_POWERPC_IRELATIVE
 				       : elfcpp::R_POWERPC_RELATIVE);
-		rela_dyn->add_symbolless_global_addend(
+		// Use the "add" method that marks the reloc as being
+		// relative.  This is proper here and in other places
+		// that add IRELATIVE relocs because those relocs go
+		// into a separate section that isn't sorted, so it
+		// doesn't matter that they are marked is_relative.
+		rela_dyn->add_global_relative(
 		    gsym, dynrel, output_section, object, data_shndx,
-		    reloc.get_r_offset(), reloc.get_r_addend());
+		    reloc.get_r_offset(), reloc.get_r_addend(), false);
 	      }
 	    else
 	      {

                 reply	other threads:[~2023-06-23 11:36 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=20230623113653.5593B3858CD1@sourceware.org \
    --to=amodra@sourceware.org \
    --cc=bfd-cvs@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).