public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Fix emit-relocs for aarch64 gold
@ 2023-11-16 10:34 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-11-16 10:34 UTC (permalink / raw)
  To: bfd-cvs

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

commit c441a361287ca98aa7a4ac1ff02d12d138b289dc
Author: Vladislav Khmelevsky <och95@yandex.ru>
Date:   Sun Apr 23 21:30:21 2023 +0400

    Fix emit-relocs for aarch64 gold
    
    Fix relocation offsets values for the relaxed input sections the same
    way it was fixed for the sections in PR21430.

Diff:
---
 gold/aarch64.cc | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gold/aarch64.cc b/gold/aarch64.cc
index 7f95c0cf13b..8589df1a0a0 100644
--- a/gold/aarch64.cc
+++ b/gold/aarch64.cc
@@ -2916,6 +2916,7 @@ class Target_aarch64 : public Sized_target<size, big_endian>
 			Section_id_hash> AArch64_input_section_map;
   typedef AArch64_insn_utilities<big_endian> Insn_utilities;
   const static int TCB_SIZE = size / 8 * 2;
+  static const Address invalid_address = static_cast<Address>(-1);
 
   Target_aarch64(const Target::Target_info* info = &aarch64_info)
     : Sized_target<size, big_endian>(info),
@@ -8286,6 +8287,27 @@ Target_aarch64<size, big_endian>::relocate_relocs(
 
   gold_assert(sh_type == elfcpp::SHT_RELA);
 
+  if (offset_in_output_section == this->invalid_address)
+    {
+      const Output_relaxed_input_section *poris
+	= output_section->find_relaxed_input_section(relinfo->object,
+						     relinfo->data_shndx);
+      if (poris != NULL)
+	{
+	  Address section_address = poris->address();
+	  section_size_type section_size = poris->data_size();
+
+	  gold_assert(section_address >= view_address
+		      && (section_address + section_size
+			  <= view_address + view_size));
+
+	  off_t offset = section_address - view_address;
+	  view += offset;
+	  view_address += offset;
+	  view_size = section_size;
+	}
+    }
+
   gold::relocate_relocs<size, big_endian, Classify_reloc>(
     relinfo,
     prelocs,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-16 10:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-16 10:34 [binutils-gdb] Fix emit-relocs for aarch64 gold Alan Modra

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).