Closed
Description
After 1981b1b, LLD converts symbols in discarded sections into undef symbols. This happens even if there are no references to the symbol from non-discarded sections.
This change breaks building the Linux kernel with LLD in some configurations (CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y
) and does not match the behavior of previous LLD versions or the behavior of the BFD linker.
To reproduce the issue:
test.c:
__attribute__((__section__(".discard"))) __attribute__((unused)) char __pcpu_unique_foo;
module.lds:
SECTIONS {
/DISCARD/ : {
*(.discard)
}
}
Then run:
clang test.c -c
ld.lld -r -T module.lds test.o -o test
objdump -t test
This will produce:
0000000000000000 O *UND* 0000000000000000 __pcpu_unique_foo
While previously it did not.
Metadata
Metadata
Assignees
Type
Projects
Status
Done