1 Star 0 Fork 63

yxx/binutils

forked from src-openEuler/binutils 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Fix-gold-linker-relocation-offset.patch 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
From 3d84bd3df6cd5741b575cb454933a3c414c4a5d5 Mon Sep 17 00:00:00 2001
From: wangding16 <[email protected]>
Date: Sun, 25 Aug 2024 16:51:53 +0800
Subject: [PATCH] Fix gold linker relocation offset
Reference: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=c441a361287ca98aa7a4ac1ff02d12d138b289dc
---
gold/aarch64.cc | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/gold/aarch64.cc b/gold/aarch64.cc
index 7f95c0cf..6004118a 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,25 @@ 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,
--
2.23.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yinxiuxiu-yolo/binutils.git
[email protected]:yinxiuxiu-yolo/binutils.git
yinxiuxiu-yolo
binutils
binutils
master

搜索帮助