Update threads-xform for current nightly (#2183)

This commit updates the threads transformation for LLVM 10 where LLD has
has breaking changes from LLVM 9. While previously the support here
attempted to straddle multiple LLVM styles this is now removed in favor
of simply supporting LLVM 10's style of output. This means that
wasm-bindgen will only be compatible with recent nightlies and forward.

The major change here is that the `__wasm_init_memory` function is
automatically called by the `start` function. We handle that by placing
the previous `start` function first, before stack/tls allocation. Other
changes are to delete all the old code from pre-llvm-9.

Closes #2175
This commit is contained in:
Alex Crichton
2020-06-03 11:39:10 -05:00
committed by GitHub
parent 0d39f9013f
commit 8edcda4095
3 changed files with 68 additions and 301 deletions

View File

@ -301,23 +301,6 @@ impl Bindgen {
}
};
// This isn't the hardest thing in the world too support but we
// basically don't know how to rationalize #[wasm_bindgen(start)] and
// the actual `start` function if present. Figure this out later if it
// comes up, but otherwise we should continue to be compatible with
// LLVM's output today.
//
// Note that start function handling in `js/mod.rs` will need to be
// updated as well, because `#[wasm_bindgen(start)]` is inserted *after*
// a module's start function, if any, because we assume start functions
// only show up when injected on behalf of wasm-bindgen's passes.
if module.start.is_some() {
bail!(
"wasm-bindgen is currently incompatible with modules that \
already have a start function"
);
}
self.threads
.run(&mut module)
.with_context(|| "failed to prepare module for threading")?;