diff options
| author | bors <bors@rust-lang.org> | 2024-10-29 19:25:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-10-29 19:25:03 +0000 |
| commit | 1e4f10ba6476e48a42a79b9f846a2d9366525b9e (patch) | |
| tree | 66c68bd54e4c3891de7c37e48c563a9b79177192 /compiler/rustc_codegen_llvm/src/debuginfo | |
| parent | e473783d90e2289b8a97575fa60d6315f0a318eb (diff) | |
| parent | 07afe8d12f1c72bdc46f052088922943ca91bcdd (diff) | |
| download | rust-1e4f10ba6476e48a42a79b9f846a2d9366525b9e.tar.gz rust-1e4f10ba6476e48a42a79b9f846a2d9366525b9e.zip | |
Auto merge of #132326 - matthiaskrgr:rollup-ngyw18g, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #131984 (Stabilize if_let_rescope) - #132151 (Ensure that resume arg outlives region bound for coroutines) - #132157 (Remove detail from label/note that is already available in other note) - #132274 (Cleanup op lookup in HIR typeck) - #132319 (cg_llvm: Clean up FFI calls for setting module flags) - #132321 (xous: sync: remove `rustc_const_stable` attribute on Condvar and Mutex new()) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/debuginfo')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/mod.rs | 66 |
1 files changed, 30 insertions, 36 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs index 85eb1c8509d..72e723aa849 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs @@ -91,45 +91,39 @@ impl<'ll, 'tcx> CodegenUnitDebugContext<'ll, 'tcx> { } pub(crate) fn finalize(&self, sess: &Session) { - unsafe { - llvm::LLVMRustDIBuilderFinalize(self.builder); - - if !sess.target.is_like_msvc { - // Debuginfo generation in LLVM by default uses a higher - // version of dwarf than macOS currently understands. We can - // instruct LLVM to emit an older version of dwarf, however, - // for macOS to understand. For more info see #11352 - // This can be overridden using --llvm-opts -dwarf-version,N. - // Android has the same issue (#22398) - let dwarf_version = sess - .opts - .unstable_opts - .dwarf_version - .unwrap_or(sess.target.default_dwarf_version); - llvm::LLVMRustAddModuleFlagU32( - self.llmod, - llvm::LLVMModFlagBehavior::Warning, - c"Dwarf Version".as_ptr(), - dwarf_version, - ); - } else { - // Indicate that we want CodeView debug information on MSVC - llvm::LLVMRustAddModuleFlagU32( - self.llmod, - llvm::LLVMModFlagBehavior::Warning, - c"CodeView".as_ptr(), - 1, - ) - } - - // Prevent bitcode readers from deleting the debug info. - llvm::LLVMRustAddModuleFlagU32( + unsafe { llvm::LLVMRustDIBuilderFinalize(self.builder) }; + if !sess.target.is_like_msvc { + // Debuginfo generation in LLVM by default uses a higher + // version of dwarf than macOS currently understands. We can + // instruct LLVM to emit an older version of dwarf, however, + // for macOS to understand. For more info see #11352 + // This can be overridden using --llvm-opts -dwarf-version,N. + // Android has the same issue (#22398) + let dwarf_version = + sess.opts.unstable_opts.dwarf_version.unwrap_or(sess.target.default_dwarf_version); + llvm::add_module_flag_u32( self.llmod, - llvm::LLVMModFlagBehavior::Warning, - c"Debug Info Version".as_ptr(), - llvm::LLVMRustDebugMetadataVersion(), + llvm::ModuleFlagMergeBehavior::Warning, + "Dwarf Version", + dwarf_version, + ); + } else { + // Indicate that we want CodeView debug information on MSVC + llvm::add_module_flag_u32( + self.llmod, + llvm::ModuleFlagMergeBehavior::Warning, + "CodeView", + 1, ); } + + // Prevent bitcode readers from deleting the debug info. + llvm::add_module_flag_u32( + self.llmod, + llvm::ModuleFlagMergeBehavior::Warning, + "Debug Info Version", + unsafe { llvm::LLVMRustDebugMetadataVersion() }, + ); } } |
