Skip to content

Commit

Permalink
Rollup merge of rust-lang#66532 - cuviper:dwarf-aranges, r=michaelwoe…
Browse files Browse the repository at this point in the history
…rister

Generate DWARF address ranges for faster lookups

This adds a new option `-Zgenerate-arange-section`, enabled by default,
corresponding to LLVM's `-generate-arange-section`. This creates a
`.debug_aranges` section with DWARF address ranges, which some tools
depend on to optimize address lookups (elfutils [22288], [25173]).

This only has effect when debuginfo is enabled, and the additional data
is small compared to the other debug sections. For example, libstd.so
with full debuginfo is about 11MB, with just 61kB in aranges.

[22288]: https://sourceware.org/bugzilla/show_bug.cgi?id=22288
[25173]: https://sourceware.org/bugzilla/show_bug.cgi?id=25173

Closes rust-lang#45246.
r? @michaelwoerister
  • Loading branch information
Centril authored Nov 20, 2019
2 parents 0a0d07a + 4c2f1c8 commit 1346557
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"for every macro invocation, print its name and arguments"),
debug_macros: bool = (false, parse_bool, [TRACKED],
"emit line numbers debug info inside macros"),
generate_arange_section: bool = (true, parse_bool, [TRACKED],
"generate DWARF address ranges for faster lookups"),
keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED],
"don't clear the hygiene data after analysis"),
keep_ast: bool = (false, parse_bool, [UNTRACKED],
Expand Down
3 changes: 3 additions & 0 deletions src/librustc_codegen_llvm/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ unsafe fn configure_llvm(sess: &Session) {
if sess.opts.debugging_opts.disable_instrumentation_preinliner {
add("-disable-preinline");
}
if sess.opts.debugging_opts.generate_arange_section {
add("-generate-arange-section");
}
if get_major_version() >= 8 {
match sess.opts.debugging_opts.merge_functions
.unwrap_or(sess.target.target.options.merge_functions) {
Expand Down

0 comments on commit 1346557

Please sign in to comment.