1
Fork 0

Always use llvm.used for coverage symbols

This follows what clang does in CoverageMappingGen. Using just
llvm.compiler.used is insufficient at least for MSVC targets.
This commit is contained in:
Nikita Popov 2021-08-20 21:13:18 +02:00
parent f3ae726f30
commit 306259c645
6 changed files with 59 additions and 35 deletions

View file

@ -162,11 +162,13 @@ pub fn compile_codegen_unit(
cx.coverageinfo_finalize();
}
// Create the llvm.compiler.used variable
// This variable has type [N x i8*] and is stored in the llvm.metadata section
// Create the llvm.used and llvm.compiler.used variables.
if !cx.used_statics().borrow().is_empty() {
cx.create_used_variable()
}
if !cx.compiler_used_statics().borrow().is_empty() {
cx.create_compiler_used_variable()
}
// Finalize debuginfo
if cx.sess().opts.debuginfo != DebugInfo::None {