about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/base.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/base.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/base.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_llvm/src/base.rs b/compiler/rustc_codegen_llvm/src/base.rs
index 5dda836988c..d7da03bf490 100644
--- a/compiler/rustc_codegen_llvm/src/base.rs
+++ b/compiler/rustc_codegen_llvm/src/base.rs
@@ -109,11 +109,16 @@ pub(crate) fn compile_codegen_unit(
             }
 
             // Finalize code coverage by injecting the coverage map. Note, the coverage map will
-            // also be added to the `llvm.compiler.used` variable, created next.
+            // also be added to the `llvm.compiler.used` variable, created below.
             if cx.sess().instrument_coverage() {
                 cx.coverageinfo_finalize();
             }
 
+            // Finalize debuginfo. This adds to `llvm.used`, created below.
+            if cx.sess().opts.debuginfo != DebugInfo::None {
+                cx.debuginfo_finalize();
+            }
+
             // Create the llvm.used and llvm.compiler.used variables.
             if !cx.used_statics.is_empty() {
                 cx.create_used_variable_impl(c"llvm.used", &cx.used_statics);
@@ -130,11 +135,6 @@ pub(crate) fn compile_codegen_unit(
                     llvm::LLVMDeleteGlobal(old_g);
                 }
             }
-
-            // Finalize debuginfo
-            if cx.sess().opts.debuginfo != DebugInfo::None {
-                cx.debuginfo_finalize();
-            }
         }
 
         ModuleCodegen::new_regular(cgu_name.to_string(), llvm_module)