Open Quuxplusone opened 5 years ago
I don't think it's dead stripping, I think it's just misuse of comdats interacting badly with inlining, which happens when you enable inlining. I think https://reviews.llvm.org/D58737 will address this.
I actually introduced this bug in https://reviews.llvm.org/D57929. Two steps forward, one step backward.
Try after r355044, see if the "relocation against discarded section" errors go away.
Works for me with the latest master.
clang version 9.0.0 (https://github.com/llvm/llvm-project.git
9bf43b5c261b4df6c855231905d14608687c7633)
Thanks for the quick fix
This is related to Bug 37561. The bug is fixed now, but I get linker errors (lld-link) when building teh project with optimizer (for release).
lld-link reports about an error with relocation against "symbol" in discarded section. This was triggered by a global function calling sprintf(), which was not referenced. After I removed the function or replaced sprintf() with snprintf(), linker did not complain, but the unit test was failing.
When building for Debug, the linker also did not complain, the unit test was passing and I was able to create the coverage report.
Looks to me like dead code stripping is leading to dangling references and also the Optimizer may cause code corruptions.
I hope Marius can reproduce the issue with his project, as I can hardly share mine and it comes with a lot of references in our repository.
SSB