开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
forked from src-openEuler/binutils
关闭
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (29)
标签 (43)
master
openEuler-22.03-LTS-SP4
openEuler-24.03-LTS
openEuler-24.03-LTS-SP2
openEuler-24.03-LTS-Next
openEuler-25.03
openEuler-25.09
openEuler-22.03-LTS-SP3
openEuler-20.03-LTS-SP4
openEuler-24.03-LTS-SP1
openEuler-22.03-LTS-SP1
openEuler-24.09
openEuler-22.03-LTS-Next
openEuler-22.03-LTS-SP2
openEuler-22.03-LTS
openEuler-20.03-LTS-SP1
openEuler-20.03-LTS-SP3
openEuler-23.09
openEuler-23.03
openEuler-20.03-LTS-Next
openEuler-25.09-release
openEuler-20.03-LTS-SP4-update-20250919
openEuler-22.03-LTS-SP3-update-20250919
openEuler-22.03-LTS-SP4-update-20250919
openEuler-24.03-LTS-update-20250912
openEuler-20.03-LTS-SP4-update-20250905
openEuler-22.03-LTS-SP3-update-20250905
openEuler-22.03-LTS-SP4-update-20250905
openEuler-24.03-LTS-SP1-update-20250905
openEuler-24.03-LTS-SP2-update-20250801
openEuler-24.03-LTS-SP2-release
openEuler-20.03-LTS-SP4-update-20250530
openEuler-22.03-LTS-SP3-update-20250530
openEuler-22.03-LTS-SP4-update-20250530
openEuler-24.03-LTS-update-20250530
openEuler-24.03-LTS-SP1-update-20250530
openEuler-25.03-release
openEuler-24.03-LTS-SP1-update-20250214
openEuler-20.03-LTS-SP4-update-20250214
openEuler-24.03-LTS-update-20250208
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
项目仓库所选许可证以仓库主分支所使用许可证为准
master
分支 (29)
标签 (43)
master
openEuler-22.03-LTS-SP4
openEuler-24.03-LTS
openEuler-24.03-LTS-SP2
openEuler-24.03-LTS-Next
openEuler-25.03
openEuler-25.09
openEuler-22.03-LTS-SP3
openEuler-20.03-LTS-SP4
openEuler-24.03-LTS-SP1
openEuler-22.03-LTS-SP1
openEuler-24.09
openEuler-22.03-LTS-Next
openEuler-22.03-LTS-SP2
openEuler-22.03-LTS
openEuler-20.03-LTS-SP1
openEuler-20.03-LTS-SP3
openEuler-23.09
openEuler-23.03
openEuler-20.03-LTS-Next
openEuler-25.09-release
openEuler-20.03-LTS-SP4-update-20250919
openEuler-22.03-LTS-SP3-update-20250919
openEuler-22.03-LTS-SP4-update-20250919
openEuler-24.03-LTS-update-20250912
openEuler-20.03-LTS-SP4-update-20250905
openEuler-22.03-LTS-SP3-update-20250905
openEuler-22.03-LTS-SP4-update-20250905
openEuler-24.03-LTS-SP1-update-20250905
openEuler-24.03-LTS-SP2-update-20250801
openEuler-24.03-LTS-SP2-release
openEuler-20.03-LTS-SP4-update-20250530
openEuler-22.03-LTS-SP3-update-20250530
openEuler-22.03-LTS-SP4-update-20250530
openEuler-24.03-LTS-update-20250530
openEuler-24.03-LTS-SP1-update-20250530
openEuler-25.03-release
openEuler-24.03-LTS-SP1-update-20250214
openEuler-20.03-LTS-SP4-update-20250214
openEuler-24.03-LTS-update-20250208
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (29)
标签 (43)
master
openEuler-22.03-LTS-SP4
openEuler-24.03-LTS
openEuler-24.03-LTS-SP2
openEuler-24.03-LTS-Next
openEuler-25.03
openEuler-25.09
openEuler-22.03-LTS-SP3
openEuler-20.03-LTS-SP4
openEuler-24.03-LTS-SP1
openEuler-22.03-LTS-SP1
openEuler-24.09
openEuler-22.03-LTS-Next
openEuler-22.03-LTS-SP2
openEuler-22.03-LTS
openEuler-20.03-LTS-SP1
openEuler-20.03-LTS-SP3
openEuler-23.09
openEuler-23.03
openEuler-20.03-LTS-Next
openEuler-25.09-release
openEuler-20.03-LTS-SP4-update-20250919
openEuler-22.03-LTS-SP3-update-20250919
openEuler-22.03-LTS-SP4-update-20250919
openEuler-24.03-LTS-update-20250912
openEuler-20.03-LTS-SP4-update-20250905
openEuler-22.03-LTS-SP3-update-20250905
openEuler-22.03-LTS-SP4-update-20250905
openEuler-24.03-LTS-SP1-update-20250905
openEuler-24.03-LTS-SP2-update-20250801
openEuler-24.03-LTS-SP2-release
openEuler-20.03-LTS-SP4-update-20250530
openEuler-22.03-LTS-SP3-update-20250530
openEuler-22.03-LTS-SP4-update-20250530
openEuler-24.03-LTS-update-20250530
openEuler-24.03-LTS-SP1-update-20250530
openEuler-25.03-release
openEuler-24.03-LTS-SP1-update-20250214
openEuler-20.03-LTS-SP4-update-20250214
openEuler-24.03-LTS-update-20250208
binutils
/
LoongArch-Not-alloc-dynamic-relocs-if...
binutils
/
LoongArch-Not-alloc-dynamic-relocs-if...
LoongArch-Not-alloc-dynamic-relocs-if-symbol-is-abso.patch 4.40 KB
一键复制 编辑 原始数据 按行查看 历史
ywgrit 提交于 2024年10月31日 14:15 +08:00 . backport master to 2.41
From d7c082ef88547077b24d3b27144daf4ce4e442f4 Mon Sep 17 00:00:00 2001
From: Jinyang He <hejinyang@loongson.cn>
Date: Mon, 8 Jul 2024 11:27:52 +0800
Subject: [PATCH 101/123] LoongArch: Not alloc dynamic relocs if symbol is
absolute
The absolute symbol should be resolved to const when link to dso or exe.
Alloc dynamic relocs will cause extra space and R_LARCH_NONE finally.
---
bfd/elfnn-loongarch.c | 14 +++++++-------
ld/testsuite/ld-loongarch-elf/abssym.s | 3 +++
ld/testsuite/ld-loongarch-elf/abssym_pie.d | 6 ++++++
ld/testsuite/ld-loongarch-elf/abssym_shared.d | 6 ++++++
ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp | 2 ++
5 files changed, 24 insertions(+), 7 deletions(-)
create mode 100644 ld/testsuite/ld-loongarch-elf/abssym.s
create mode 100644 ld/testsuite/ld-loongarch-elf/abssym_pie.d
create mode 100644 ld/testsuite/ld-loongarch-elf/abssym_shared.d
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index d11189b4..af4d8baa 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -899,6 +899,7 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
unsigned int r_type;
unsigned int r_symndx;
struct elf_link_hash_entry *h;
+ bool is_abs_symbol = false;
Elf_Internal_Sym *isym = NULL;
r_symndx = ELFNN_R_SYM (rel->r_info);
@@ -917,6 +918,7 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (isym == NULL)
return false;
+ is_abs_symbol = isym->st_shndx == SHN_ABS;
if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
{
h = elfNN_loongarch_get_local_sym_hash (htab, abfd, rel, true);
@@ -935,6 +937,7 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ is_abs_symbol = bfd_is_abs_symbol (&h->root);
}
/* It is referenced by a non-shared object. */
@@ -1142,13 +1145,6 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
&& bfd_link_pic (info)
&& (sec->flags & SEC_ALLOC) != 0)
{
- bool is_abs_symbol = false;
-
- if (r_symndx < symtab_hdr->sh_info)
- is_abs_symbol = isym->st_shndx == SHN_ABS;
- else
- is_abs_symbol = bfd_is_abs_symbol (&h->root);
-
if (!is_abs_symbol)
{
_bfd_error_handler
@@ -1165,6 +1161,10 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_LARCH_JUMP_SLOT:
case R_LARCH_64:
+ /* Resolved to const. */
+ if (is_abs_symbol)
+ break;
+
need_dynreloc = 1;
/* If resolved symbol is defined in this object,
diff --git a/ld/testsuite/ld-loongarch-elf/abssym.s b/ld/testsuite/ld-loongarch-elf/abssym.s
new file mode 100644
index 00000000..3eacc766
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/abssym.s
@@ -0,0 +1,3 @@
+.section .data,"aw"
+.quad _size8
+.word _size4
diff --git a/ld/testsuite/ld-loongarch-elf/abssym_pie.d b/ld/testsuite/ld-loongarch-elf/abssym_pie.d
new file mode 100644
index 00000000..dfc3e35b
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/abssym_pie.d
@@ -0,0 +1,6 @@
+#source: abssym.s
+#ld: -pie -e 0 --defsym _size8=0 --defsym _size4=0
+#readelf: -r
+#...
+There are no relocations in this file.
+#...
diff --git a/ld/testsuite/ld-loongarch-elf/abssym_shared.d b/ld/testsuite/ld-loongarch-elf/abssym_shared.d
new file mode 100644
index 00000000..2db7e890
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/abssym_shared.d
@@ -0,0 +1,6 @@
+#source: abssym.s
+#ld: -shared --defsym _size8=0 --defsym _size4=0
+#readelf: -r
+#...
+There are no relocations in this file.
+#...
diff --git a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
index 2be67651..032b9bad 100644
--- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
+++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
@@ -141,6 +141,7 @@ if [istarget "loongarch64-*-*"] {
run_dump_test "relr-discard-shared"
run_dump_test "relr-got-shared"
run_dump_test "relr-text-shared"
+ run_dump_test "abssym_shared"
}
if [check_pie_support] {
@@ -149,6 +150,7 @@ if [istarget "loongarch64-*-*"] {
run_dump_test "relr-discard-pie"
run_dump_test "relr-got-pie"
run_dump_test "relr-text-pie"
+ run_dump_test "abssym_pie"
}
run_dump_test "max_imm_b16"
--
2.33.0
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/y0314/binutils.git
git@gitee.com:y0314/binutils.git
y0314
binutils
binutils
master
点此查找更多帮助

搜索帮助

仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /