https://sourceware.org/bugzilla/show_bug.cgi?id=34570
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hjl.tools at gmail dot com
Status|NEW |WAITING
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Nikita Popov from comment #0)
>
> llc common-small.ll -o common-small.o -filetype=obj # native
> llvm-as common-big.ll -o common-big.o # IR
> ld.bfd -m elf_x86_64 -plugin=/usr/lib64/LLVMgold.so \
> common-big.o common-small.o -o result.o
> objdump -t result.o
>
> Results in:
>
> 0000000000401000 g O .bss 0000000000000004 a
>
> That is, the common symbol a has size 4.
>
> It appears that unlike ld.gold, ld.bfd always picks the symbol from the
> native object as the prevailing definition, even though the one in the IR
> object is larger.
Can't reproduce it with LLVM 22.1:
[hjl@gnu-tgl-3 pr34570]$ make
llvm-as -o common-big.o common-big.ll
llvm-as -o common-small.o common-small.ll
./ld -plugin=/usr/lib64/LLVMgold.so -o result.o common-big.o common-small.o
/export/build/gnu/tools-build/binutils-gitlab-test/build-x86_64-linux/ld/ld-new:
warning: cannot find entry symbol _start; defaulting to 0000000000401000
readelf -sW result.o
Symbol table '.symtab' contains 5 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _start
2: 0000000000401000 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
3: 0000000000401000 0 NOTYPE GLOBAL DEFAULT ABS _edata
4: 0000000000401000 0 NOTYPE GLOBAL DEFAULT ABS _end
[hjl@gnu-tgl-3 pr34570]$
'a' is optimized out by LLVMgold.so as expected.
--
You are receiving this mail because:
You are on the CC list for the bug.