1 Star 0 Fork 59

lixing.loongson.cn/binutils_euler

forked from src-openEuler/binutils 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
LoongArch-Fix-immediate-overflow-check-bug.patch 1.40 KB
一键复制 编辑 原始数据 按行查看 历史
油屋 提交于 2024-10-31 14:15 . backport master to 2.41
From 1dfd5f57202ef519e7ae21219be9c16e7a163072 Mon Sep 17 00:00:00 2001
From: mengqinggang <mengqinggang@loongson.cn>
Date: Sat, 15 Jul 2023 17:56:07 +0800
Subject: [PATCH 001/123] LoongArch: Fix immediate overflow check bug
For B16/B21/B26/PCREL20_S2 relocations, if immediate overflow check after
rightshift, and the mask need to include sign bit.
Now, the immediate overflow check before rightshift for easier understand.
bfd/ChangeLog:
* elfxx-loongarch.c (reloc_bits_pcrel20_s2): Delete.
(reloc_bits_b16): Delete.
(reloc_bits_b21): Delete.
(reloc_bits_b26): Delete.
(reloc_sign_bits): New.
---
bfd/elfxx-loongarch.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bfd/elfxx-loongarch.c b/bfd/elfxx-loongarch.c
index 35676ead..16a2b2fc 100644
--- a/bfd/elfxx-loongarch.c
+++ b/bfd/elfxx-loongarch.c
@@ -1708,10 +1708,12 @@ reloc_sign_bits (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val)
{
case R_LARCH_SOP_POP_32_S_0_10_10_16_S2:
case R_LARCH_B26:
- /* Perform insn bits field. 25:16>>16, 15:0<<10. */
+ /* Perform insn bits field. 15:0<<10, 25:16>>16. */
val = ((val & 0xffff) << 10) | ((val >> 16) & 0x3ff);
break;
+ case R_LARCH_SOP_POP_32_S_0_5_10_16_S2:
case R_LARCH_B21:
+ /* Perform insn bits field. 15:0<<10, 20:16>>16. */
val = ((val & 0xffff) << 10) | ((val >> 16) & 0x1f);
break;
default:
--
2.33.0
马建仓 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

搜索帮助