Rollup merge of #77765 - amshafer:master, r=petrochenkov
Add LLVM flags to limit DWARF version to 2 on BSD This has been a thorn in my side for a while, I can finally generate flamegraphs of rust programs on bsd again. This fixes dtrace profiling on freebsd, I think it might help with lldb as well but I can't test that because my current rust-lldb setup is messed up. I'm limiting the dwarf version to 2 on all bsd's (netbsd/openbsd/freebsd) since it looks like this applies to all of them, but I have only tested on freebsd. Let me know if there's anything I can improve! --- Currently on FreeBSD dtrace profiling does not work and shows jumbled/incorrect symbols in the backtraces. FreeBSD does not support the latest versions of DWARF in dtrace (and lldb?) yet, and needs to be limited to DWARF2 in the same way as macos. This adds an is_like_bsd flag since it was missing. NetBSD/OpenBSD/FreeBSD all match this. This effectively copies #11864 but targets FreeBSD instead of macos.
This commit is contained in:
commit
596235281c
8 changed files with 23 additions and 4 deletions
|
@ -120,10 +120,8 @@ pub fn finalize(cx: &CodegenCx<'_, '_>) {
|
|||
// 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)
|
||||
if cx.sess().target.target.options.is_like_osx
|
||||
|| cx.sess().target.target.options.is_like_android
|
||||
{
|
||||
llvm::LLVMRustAddModuleFlag(cx.llmod, "Dwarf Version\0".as_ptr().cast(), 2)
|
||||
if let Some(version) = cx.sess().target.target.options.dwarf_version {
|
||||
llvm::LLVMRustAddModuleFlag(cx.llmod, "Dwarf Version\0".as_ptr().cast(), version)
|
||||
}
|
||||
|
||||
// Indicate that we want CodeView debug information on MSVC
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue