Skip to content

Include debuginfo in release builds of LLVM by default #42502

Open
@infinity0

Description

@infinity0

This would be useful to help debug things like #42476. At the moment I can only debug it using Debian's rustc as stage0 - its LLVM is built separately and dynamically linked into librustc_llvm, so debugging symbols work there. However with rust's own 1.16 stage0 I get this instead:

(gdb) bt
#0  0x00003fffb5e6180c in (anonymous namespace)::ELFObjectWriter::computeSymbolTable(llvm::MCAssembler&, llvm::MCAsmLayout const&, llvm::DenseMap<llvm::MCSectionELF const*, unsigned int, llvm::DenseMapInfo<llvm::MCSectionELF const*>, llvm::detail::DenseMapPair<llvm::MCSectionELF const*, unsigned int> > const&, llvm::DenseMap<llvm::MCSymbol const*, unsigned int, llvm::DenseMapInfo<llvm::MCSymbol const*>, llvm::detail::DenseMapPair<llvm::MCSymbol const*, unsigned int> > const&, std::map<llvm::MCSectionELF const*, std::pair<unsigned long, unsigned long>, std::less<llvm::MCSectionELF const*>, std::allocator<std::pair<llvm::MCSectionELF const* const, std::pair<unsigned long, unsigned long> > > >&) [clone .constprop.338] ()
   from /home/infinity0/build2/rustc-1.17.0+dfsg2/build/powerpc64le-unknown-linux-gnu/stage0/bin/../lib/../lib/librustc_llvm-1b4bf1d78c7d2bcc.so
[..]

(sid_ppc64el-dchroot)infinity0@plummer:~/rustc-1.17.0+dfsg2$ sha256sum /home/infinity0/build2/rustc-1.17.0+dfsg2/build/powerpc64le-unknown-linux-gnu/stage0/bin/../lib/../lib/librustc_llvm-1b4bf1d78c7d2bcc.so  
d3090a547a2a8189cb116cc726965e4af0695cd4ae48ae41f05224a3d429534b  /home/infinity0/build2/rustc-1.17.0+dfsg2/build/powerpc64le-unknown-linux-gnu/stage0/bin/../lib/../lib/librustc_llvm-1b4bf1d78c7d2bcc.so
^^^^ matches the one from rustc-1.16.0-powerpc64le-unknown-linux-gnu.tar.gz

(sid_ppc64el-dchroot)infinity0@plummer:~/rustc-1.17.0+dfsg2$ objdump --debugging /home/infinity0/build2/rustc-1.17.0+dfsg2/build/powerpc64le-unknown-linux-gnu/stage0/bin/../lib/../lib/librustc_llvm-1b4bf1d78c7d2bcc.so  | wc -l
80819

< eddyb> infinity0: you have to build LLVM in a special way to get DWARF for it
< eddyb> and if you don't do it right you can easily run out of memory
< eddyb> I'm not even sure we support that mode
< eddyb> ah https://github.com/rust-lang/rust/blob/master/src/bootstrap/config.toml.example#L21
< eddyb> see https://github.com/rust-lang/rust/blob/master/src/bootstrap/config.toml.example#L56-L59
< eddyb> might have to be set to 1
/cc @eddyb

I don't think we in Debian are doing anything particularly special, FWIW: https://sources.debian.net/src/llvm-toolchain-3.9/1:3.9.1-9/debian/rules/#L250 (@sylvestre is the maintainer).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions