]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
LoongArch: Modify inconsistent behavior of ld with --unresolved-symbols=ignore-all
authorticat_fp <fanpeng@loongson.cn>
Mon, 26 Feb 2024 03:11:35 +0000 (11:11 +0800)
committerliuzhensong <liuzhensong@loongson.cn>
Tue, 27 Feb 2024 06:22:23 +0000 (14:22 +0800)
commit268391acb9fa956bad24533e2cc0d1459dea1b3d
treedf3d788a1617f27cd1f5e652e7f6be0b5934081b
parentfb266c9083b42d6287b2fe93a82ffe663d8f4640
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