Closed
Description
cat > 1.c << \!
int foo = 10;
!
cat > script.t << \!
SECTIONS {
PROVIDE(f4 = 0x1000);
PROVIDE(f3 = f4);
PROVIDE(f2 = f3);
PROVIDE(f2 = f3);
PROVIDE(f1 = f2);
PROVIDE(foo = f1);
}
!
clang -target riscv32 -c 1.c
ld.lld 1.o -T script.t
$ ld.lld --version
LLD 18.0.0 (compatible with GNU linkers)
$llvm-readelf -s a.out
Symbol table '.symtab' contains 10 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 FILE LOCAL DEFAULT ABS 1.c
2: 00000000 0 NOTYPE LOCAL DEFAULT 2 $d.0
3: 00000000 0 NOTYPE LOCAL DEFAULT 3 $d.1
4: 00000000 0 NOTYPE LOCAL DEFAULT ABS $d.2
5: 00000000 4 OBJECT GLOBAL DEFAULT 2 foo
6: 00001000 0 NOTYPE GLOBAL DEFAULT ABS f4
7: 00001000 0 NOTYPE GLOBAL DEFAULT ABS f3
8: 00001000 0 NOTYPE GLOBAL DEFAULT ABS f2
9: 00001000 0 NOTYPE GLOBAL DEFAULT ABS f1
Is this is a known issue why GNU linker script PROVIDE directive works this way with lld ?