about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/base.rs
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-08-20 21:13:18 +0200
committerNikita Popov <nikita.ppv@gmail.com>2021-08-21 10:08:05 +0200
commit306259c64595807db0632f0a293bd06bf034f97b (patch)
tree757c73de7a527061579740270feca3793c9e1a20 /compiler/rustc_codegen_llvm/src/base.rs
parentf3ae726f30401acb1aacf5600f5a2a2883a0c9d4 (diff)
downloadrust-306259c64595807db0632f0a293bd06bf034f97b.tar.gz
rust-306259c64595807db0632f0a293bd06bf034f97b.zip
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.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/base.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/base.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/base.rs b/compiler/rustc_codegen_llvm/src/base.rs
index a9f43880ef6..a6bdbd11899 100644
--- a/compiler/rustc_codegen_llvm/src/base.rs
+++ b/compiler/rustc_codegen_llvm/src/base.rs
@@ -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 {