Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include debuginfo in release builds of LLVM by default #42502

Open
infinity0 opened this issue Jun 7, 2017 · 4 comments
Open

Include debuginfo in release builds of LLVM by default #42502

infinity0 opened this issue Jun 7, 2017 · 4 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@infinity0
Copy link
Contributor

infinity0 commented Jun 7, 2017

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).

@eddyb
Copy link
Member

eddyb commented Jun 7, 2017

I can see Debian turning on debuginfo and using gold to improve link performance.

I remember something about split debuginfo being very useful in such builds.
Maybe that's the case for all distro builds if the distro has separate debuginfo packages?

@infinity0
Copy link
Contributor Author

Yes, Debian does split debuginfo. However we don't usually need buildsystem-level support for that, we just use dh_strip, which wraps around strip(1), after the build (e.g. here). I'm not sure what would be suitable for rust upstream.

@eddyb
Copy link
Member

eddyb commented Jun 7, 2017

@infinity0 Ah, there's a LLVM cmake option (or was, maybe it's changed since) to support that as part of the build, which, along with using gold, drastically improved building with debuginfo for me.

@Mark-Simulacrum Mark-Simulacrum added A-build A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. labels Jun 23, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jul 27, 2017
@jonas-schievink jonas-schievink added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) and removed T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) A-build labels Apr 21, 2019
@jyn514
Copy link
Member

jyn514 commented May 20, 2023

#67109 looks related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

5 participants