Skip to content

Commit d208e19

Browse files
committed
Fix a crash with wasm64 in LLVM
This commit works around a crash in LLVM when the `-generate-arange-section` argument is passed to LLVM. An LLVM bug is opened for this and the code in question is also set to continue passing this flag with LLVM 14, assuming that this is fixed by the time LLVM 14 comes out. Otherwise this should work around debuginfo crashes on LLVM 13.
1 parent caa9e4a commit d208e19

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,15 @@ unsafe fn configure_llvm(sess: &Session) {
7575
if sess.print_llvm_passes() {
7676
add("-debug-pass=Structure", false);
7777
}
78-
if !sess.opts.debugging_opts.no_generate_arange_section {
78+
if !sess.opts.debugging_opts.no_generate_arange_section
79+
// FIXME: An LLVM bug [1] means that if this option is enabled for
80+
// wasm64 then LLVM will crash when generating debuginfo. Assuming
81+
// that this gets fixed in LLVM 14 this condition here is a
82+
// workaround to work with versions of LLVM 13 and prior.
83+
//
84+
// [1]: https://bugs.llvm.org/show_bug.cgi?id=52376
85+
&& (sess.target.arch != "wasm64" || llvm_util::get_version() >= (14, 0, 0))
86+
{
7987
add("-generate-arange-section", false);
8088
}
8189

0 commit comments

Comments
 (0)