1 Star 0 Fork 66

lixing.loongson.cn/binutils_euler

forked from src-openEuler/binutils 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
LoongArch-LoongArch64-allows-relocations-to-use-64-b.patch 2.27 KB
一键复制 编辑 原始数据 按行查看 历史
油屋 提交于 2024-10-31 14:15 +08:00 . backport master to 2.41
From 87c63c08d6171b556f86c14fded00ab8b4aaa73b Mon Sep 17 00:00:00 2001
From: Lulu Cai <cailulu@loongson.cn>
Date: Wed, 7 Aug 2024 18:04:26 +0800
Subject: [PATCH 110/123] LoongArch: LoongArch64 allows relocations to use
64-bit addends
Relocations using 64-bit addends allow larger constant offset address
calculations to be fused.
---
gas/config/tc-loongarch.c | 3 +++
gas/testsuite/gas/loongarch/large_addend.d | 12 ++++++++++++
gas/testsuite/gas/loongarch/large_addend.s | 8 ++++++++
3 files changed, 23 insertions(+)
create mode 100644 gas/testsuite/gas/loongarch/large_addend.d
create mode 100644 gas/testsuite/gas/loongarch/large_addend.s
diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c
index 72815233..16355cac 100644
--- a/gas/config/tc-loongarch.c
+++ b/gas/config/tc-loongarch.c
@@ -1221,6 +1221,9 @@ append_fixp_and_insn (struct loongarch_cl_insn *ip)
bfd_get_reloc_size (howto),
&reloc_info[i].value, FALSE, r_type);
}
+ /* Allow LoongArch 64 to use 64-bit addends. */
+ if (LARCH_opts.ase_lp64)
+ ip->fixp[i]->fx_no_overflow = 1;
}
}
diff --git a/gas/testsuite/gas/loongarch/large_addend.d b/gas/testsuite/gas/loongarch/large_addend.d
new file mode 100644
index 00000000..18eb33a3
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/large_addend.d
@@ -0,0 +1,12 @@
+#as:
+#objdump: -r
+#skip: loongarch32-*-*
+
+.*: file format elf64-loongarch
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET TYPE VALUE
+0000000000000000 R_LARCH_PCALA_HI20 _start\+0x7fffabcd12345678
+0000000000000004 R_LARCH_PCALA_LO12 _start\+0x7fffabcd12345678
+0000000000000008 R_LARCH_PCALA64_LO20 _start\+0x7fffabcd12345678
+000000000000000c R_LARCH_PCALA64_HI12 _start\+0x7fffabcd12345678
diff --git a/gas/testsuite/gas/loongarch/large_addend.s b/gas/testsuite/gas/loongarch/large_addend.s
new file mode 100644
index 00000000..7db90525
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/large_addend.s
@@ -0,0 +1,8 @@
+ .text
+ .global _start
+_start:
+ pcalau12i $a0, %pc_hi20(_start+0x7fffabcd12345678)
+ addi.d $a1, $zero, %pc_lo12(_start+0x7fffabcd12345678)
+ lu32i.d $a1, %pc64_lo20(_start+0x7fffabcd12345678)
+ lu52i.d $a1, $a1, %pc64_hi12(_start+0x7fffabcd12345678)
+ add.d $a0, $a1, $a0
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lixing-loongson-cn/binutils_euler.git
git@gitee.com:lixing-loongson-cn/binutils_euler.git
lixing-loongson-cn
binutils_euler
binutils_euler
master

搜索帮助

371d5123 14472233 46e8bd33 14472233