1
Fork 0

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 #45246.
This commit is contained in:
Josh Stone 2019-11-18 15:05:01 -08:00
parent a0d40f8bdf
commit a5d624d32c
2 changed files with 5 additions and 0 deletions

View file

@ -1331,6 +1331,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"for every macro invocation, print its name and arguments"), "for every macro invocation, print its name and arguments"),
debug_macros: bool = (false, parse_bool, [TRACKED], debug_macros: bool = (false, parse_bool, [TRACKED],
"emit line numbers debug info inside macros"), "emit line numbers debug info inside macros"),
generate_arange_section: bool = (true, parse_bool, [UNTRACKED],
"generate DWARF address ranges for faster lookups"),
keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED], keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED],
"don't clear the hygiene data after analysis"), "don't clear the hygiene data after analysis"),
keep_ast: bool = (false, parse_bool, [UNTRACKED], keep_ast: bool = (false, parse_bool, [UNTRACKED],

View file

@ -62,6 +62,9 @@ unsafe fn configure_llvm(sess: &Session) {
if sess.opts.debugging_opts.disable_instrumentation_preinliner { if sess.opts.debugging_opts.disable_instrumentation_preinliner {
add("-disable-preinline"); add("-disable-preinline");
} }
if sess.opts.debugging_opts.generate_arange_section {
add("-generate-arange-section");
}
if get_major_version() >= 8 { if get_major_version() >= 8 {
match sess.opts.debugging_opts.merge_functions match sess.opts.debugging_opts.merge_functions
.unwrap_or(sess.target.target.options.merge_functions) { .unwrap_or(sess.target.target.options.merge_functions) {