代码拉取完成,页面将自动刷新
From 268391acb9fa956bad24533e2cc0d1459dea1b3d Mon Sep 17 00:00:00 2001
From: ticat_fp <[email protected]>
Date: Mon, 26 Feb 2024 11:11:35 +0800
Subject: [PATCH] LoongArch: Modify inconsistent behavior of ld with
--unresolved-symbols=ignore-all
Remove duplicated check when producing executable files that reference external symbols
defined in other files. RELOC_FOR_GLOBAL_SYMBOL will check it.
Testcase is:
resolv.c:
int main(int argc, char *argv[]) {
return argc;
}
t.c:
extern const struct my_struct ms1;
static const struct my_struct *ms = &ms1;
t.h:
typedef struct my_struct {
char *str;
int i;
} my_struct;
Compiling and linking command with:
gcc t.c -c ; gcc resolv.c -c
gcc resolv.o t.o -o resolv -Wl,--unresolved-symbols=ignore-all
Got error as:
~/install/usr/bin/ld: t.o:(.data.rel+0x0): undefined reference to `ms1'
collect2: error: ld returned 1 exit status
---
bfd/elfnn-loongarch.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index 1b5009e13b2..e96e0f53608 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -2868,14 +2868,7 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
else if (resolved_dynly)
{
if (h->dynindx == -1)
- {
- if (h->root.type == bfd_link_hash_undefined)
- (*info->callbacks->undefined_symbol)
- (info, name, input_bfd, input_section,
- rel->r_offset, true);
-
- outrel.r_info = ELFNN_R_INFO (0, r_type);
- }
+ outrel.r_info = ELFNN_R_INFO (0, r_type);
else
outrel.r_info = ELFNN_R_INFO (h->dynindx, r_type);
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。