Disable .debug_aranges
for all wasm targets
This follows from discussion on https://bugs.llvm.org/show_bug.cgi?id=52442 where it looks like this section doesn't make sense for wasm targets.
This commit is contained in:
parent
9a442353f3
commit
7dc38369c0
3 changed files with 14 additions and 8 deletions
|
@ -75,14 +75,8 @@ unsafe fn configure_llvm(sess: &Session) {
|
||||||
if sess.print_llvm_passes() {
|
if sess.print_llvm_passes() {
|
||||||
add("-debug-pass=Structure", false);
|
add("-debug-pass=Structure", false);
|
||||||
}
|
}
|
||||||
if !sess.opts.debugging_opts.no_generate_arange_section
|
if sess.target.generate_arange_section
|
||||||
// FIXME: An LLVM bug [1] means that if this option is enabled for
|
&& !sess.opts.debugging_opts.no_generate_arange_section
|
||||||
// wasm64 then LLVM will crash when generating debuginfo. Assuming
|
|
||||||
// that this gets fixed in LLVM 14 this condition here is a
|
|
||||||
// workaround to work with versions of LLVM 13 and prior.
|
|
||||||
//
|
|
||||||
// [1]: https://bugs.llvm.org/show_bug.cgi?id=52376
|
|
||||||
&& (sess.target.arch != "wasm64" || llvm_util::get_version() >= (14, 0, 0))
|
|
||||||
{
|
{
|
||||||
add("-generate-arange-section", false);
|
add("-generate-arange-section", false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1357,6 +1357,9 @@ pub struct TargetOptions {
|
||||||
|
|
||||||
/// Minimum number of bits in #[repr(C)] enum. Defaults to 32.
|
/// Minimum number of bits in #[repr(C)] enum. Defaults to 32.
|
||||||
pub c_enum_min_bits: u64,
|
pub c_enum_min_bits: u64,
|
||||||
|
|
||||||
|
/// Whether or not the DWARF `.debug_aranges` section should be generated.
|
||||||
|
pub generate_arange_section: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for TargetOptions {
|
impl Default for TargetOptions {
|
||||||
|
@ -1462,6 +1465,7 @@ impl Default for TargetOptions {
|
||||||
supported_sanitizers: SanitizerSet::empty(),
|
supported_sanitizers: SanitizerSet::empty(),
|
||||||
default_adjusted_cabi: None,
|
default_adjusted_cabi: None,
|
||||||
c_enum_min_bits: 32,
|
c_enum_min_bits: 32,
|
||||||
|
generate_arange_section: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2047,6 +2051,7 @@ impl Target {
|
||||||
key!(supported_sanitizers, SanitizerSet)?;
|
key!(supported_sanitizers, SanitizerSet)?;
|
||||||
key!(default_adjusted_cabi, Option<Abi>)?;
|
key!(default_adjusted_cabi, Option<Abi>)?;
|
||||||
key!(c_enum_min_bits, u64);
|
key!(c_enum_min_bits, u64);
|
||||||
|
key!(generate_arange_section, bool);
|
||||||
|
|
||||||
if base.is_builtin {
|
if base.is_builtin {
|
||||||
// This can cause unfortunate ICEs later down the line.
|
// This can cause unfortunate ICEs later down the line.
|
||||||
|
@ -2286,6 +2291,7 @@ impl ToJson for Target {
|
||||||
target_option_val!(split_debuginfo);
|
target_option_val!(split_debuginfo);
|
||||||
target_option_val!(supported_sanitizers);
|
target_option_val!(supported_sanitizers);
|
||||||
target_option_val!(c_enum_min_bits);
|
target_option_val!(c_enum_min_bits);
|
||||||
|
target_option_val!(generate_arange_section);
|
||||||
|
|
||||||
if let Some(abi) = self.default_adjusted_cabi {
|
if let Some(abi) = self.default_adjusted_cabi {
|
||||||
d.insert("default-adjusted-cabi".to_string(), Abi::name(abi).to_json());
|
d.insert("default-adjusted-cabi".to_string(), Abi::name(abi).to_json());
|
||||||
|
|
|
@ -128,6 +128,12 @@ pub fn options() -> TargetOptions {
|
||||||
// gdb scripts don't work on wasm blobs
|
// gdb scripts don't work on wasm blobs
|
||||||
emit_debug_gdb_scripts: false,
|
emit_debug_gdb_scripts: false,
|
||||||
|
|
||||||
|
// There's more discussion of this at
|
||||||
|
// https://bugs.llvm.org/show_bug.cgi?id=52442 but the general result is
|
||||||
|
// that this isn't useful for wasm and has tricky issues with
|
||||||
|
// representation, so this is disabled.
|
||||||
|
generate_arange_section: false,
|
||||||
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue