diff options
Diffstat (limited to 'src/librustc_codegen_llvm/base.rs')
| -rw-r--r-- | src/librustc_codegen_llvm/base.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index d5e0d7d36ee..b19199b9cfa 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -144,17 +144,18 @@ pub fn compile_codegen_unit( } } + // Finalize code coverage by injecting the coverage map. Note, the coverage map will + // also be added to the `llvm.used` variable, created next. + if cx.sess().opts.debugging_opts.instrument_coverage { + cx.coverageinfo_finalize(); + } + // Create the llvm.used variable // This variable has type [N x i8*] and is stored in the llvm.metadata section if !cx.used_statics().borrow().is_empty() { cx.create_used_variable() } - // Finalize code coverage by injecting the coverage map - if cx.sess().opts.debugging_opts.instrument_coverage { - cx.coverageinfo_finalize(); - } - // Finalize debuginfo if cx.sess().opts.debuginfo != DebugInfo::None { cx.debuginfo_finalize(); |
