From 73fddc3f8d97b81acceac9634e1371eb22f21bd1 Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Fri, 17 Apr 2020 13:37:05 -0700 Subject: [PATCH] Temporarily fix wasmtime on aarch64 by not constructing per-inst address map. (#1541) The current build of wasmtime on aarch64 panics immediately because the debug infrastructure constructs an address-to-instruction map unconditionally now, and the new backend does not yet support debug info generally (#1523). In this particular case, the address-map construction consults the encoding info, which is not implemented by the new backend and causes the panic. This fix simply avoids generating per-instruction entries in the address map; it at least gets us going until we plumb SourceLocs all the way through the new pipeline. --- crates/environ/src/cranelift.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/crates/environ/src/cranelift.rs b/crates/environ/src/cranelift.rs index ee5ec884ab..f9b8b4be80 100644 --- a/crates/environ/src/cranelift.rs +++ b/crates/environ/src/cranelift.rs @@ -125,15 +125,19 @@ fn get_function_address_map<'data>( let mut blocks = func.layout.blocks().collect::>(); blocks.sort_by_key(|block| func.offsets[*block]); // Ensure inst offsets always increase - let encinfo = isa.encoding_info(); - for block in blocks { - for (offset, inst, size) in func.inst_offsets(block, &encinfo) { - let srcloc = func.srclocs[inst]; - instructions.push(InstructionAddressMap { - srcloc, - code_offset: offset as usize, - code_len: size as usize, - }); + // FIXME(#1523): New backend does not support debug info or instruction-address mapping + // yet. + if !isa.get_mach_backend().is_some() { + let encinfo = isa.encoding_info(); + for block in blocks { + for (offset, inst, size) in func.inst_offsets(block, &encinfo) { + let srcloc = func.srclocs[inst]; + instructions.push(InstructionAddressMap { + srcloc, + code_offset: offset as usize, + code_len: size as usize, + }); + } } }