about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2021-11-01 14:16:25 -0700
committerAlex Crichton <alex@alexcrichton.com>2021-11-10 08:35:42 -0800
commitd208e1943bd94f0646dbb6fdc1a14d1973bf63a5 (patch)
tree3b0c75edf1d6f4712cbfd1dd16baea1a786772c2 /compiler/rustc_codegen_llvm/src
parentcaa9e4a2d0feaee53df67677a190edab95c996af (diff)
downloadrust-d208e1943bd94f0646dbb6fdc1a14d1973bf63a5.tar.gz
rust-d208e1943bd94f0646dbb6fdc1a14d1973bf63a5.zip
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.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index c3e7e7169a9..35a3d21036a 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -75,7 +75,15 @@ unsafe fn configure_llvm(sess: &Session) {
         if sess.print_llvm_passes() {
             add("-debug-pass=Structure", false);
         }
-        if !sess.opts.debugging_opts.no_generate_arange_section {
+        if !sess.opts.debugging_opts.no_generate_arange_section
+            // FIXME: An LLVM bug [1] means that if this option is enabled for
+            // 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);
         }