Came across this issue when linking bitcode object files generated by rustc
.
The object files have the following attribute attributes #0 = { ... "probe-stack"="__rust_probestack" ...}
. __rust_probestack
is a function for stack protection, and it is only generated during IR lowering, https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/X86/X86FrameLowering.cpp#L1136C43-L1136C43
lld does not see the symbol during thin-link but after LTO, the symbol shows up in the native object and needs to be resolved, but the object file that defines it is not picked by LTO.
In general, any symbol that is not seen from bitcode but shows up in native object can trigger this issue. There are several ways to work around this from user side, like making it undefined (“-u __rust_probestack”), or moving the object file that defines the symbol out of lazy/thin archive. But I wonder if there is a way to address this from compiler side?