Resolve libcall relocations for older CPUs (#5567)

* Resolve libcall relocations for older CPUs

Long ago Wasmtime used to have logic for resolving relocations
post-compilation for libcalls which I ended up removing during
refactorings last year. As #5563 points out, however, it's possible to
get Wasmtime to panic by disabling SSE features which forces Cranelift
to use libcalls for some floating-point operations instead. Note that
this also requires disabling SIMD because SIMD support has a baseline of
SSE 4.2.

This commit pulls back the old implementations of various libcalls and
reimplements logic necessary to have them work on CPUs without SSE 4.2

Closes #5563

* Fix log message in `wast` support

* Fix offset listed in relocations

Be sure to factor in the offset of the function itself

* Review comments
This commit is contained in:
Alex Crichton
2023-01-18 09:04:10 -06:00
committed by GitHub
parent 94b51cdb17
commit 9b896d2a70
7 changed files with 298 additions and 14 deletions

View File

@@ -363,7 +363,7 @@ impl<T> WastContext<T> {
let sp = directive.span();
if log::log_enabled!(log::Level::Debug) {
let (line, col) = sp.linecol_in(wast);
log::debug!("failed directive on {}:{}:{}", filename, line + 1, col);
log::debug!("running directive on {}:{}:{}", filename, line + 1, col);
}
self.run_directive(directive)
.map_err(|e| match e.downcast() {