Connect helper C symbols to their static library

This commit adds a `#[link]` annotation to the block defining symbols
coming from a native static library that we build and link. This is
required by rustc to get symbols to get exported correctly when linking
wasmtime into a Rust dynamic library instead of always as an rlib.

While I was at it I went ahead and renamed the symbols now that they're
no longer in C++ and they're doing setjmp/longjmp and not much else.

Closes #3006
This commit is contained in:
Alex Crichton
2021-06-21 07:25:58 -07:00
parent 7ce46043dc
commit 724beaf0f3
6 changed files with 15 additions and 14 deletions

View File

@@ -33,7 +33,7 @@
#![allow(non_snake_case)]
use crate::traphandlers::{tls, Trap, Unwind};
use crate::traphandlers::{tls, wasmtime_longjmp, Trap};
use mach::exception_types::*;
use mach::kern_return::*;
use mach::mach_init::*;
@@ -389,7 +389,7 @@ unsafe extern "C" fn unwind(wasm_pc: *const u8) -> ! {
state.jmp_buf.get()
});
debug_assert!(!jmp_buf.is_null());
Unwind(jmp_buf);
wasmtime_longjmp(jmp_buf);
}
thread_local! {

View File

@@ -1,4 +1,4 @@
use crate::traphandlers::{tls, Trap, Unwind};
use crate::traphandlers::{tls, wasmtime_longjmp, Trap};
use std::cell::RefCell;
use std::convert::TryInto;
use std::io;
@@ -99,7 +99,7 @@ unsafe extern "C" fn trap_handler(
return true;
}
info.capture_backtrace(pc);
Unwind(jmp_buf)
wasmtime_longjmp(jmp_buf)
});
if handled {

View File

@@ -1,4 +1,4 @@
use crate::traphandlers::{tls, Trap, Unwind};
use crate::traphandlers::{tls, wasmtime_longjmp, Trap};
use std::io;
use winapi::um::errhandlingapi::*;
use winapi::um::minwinbase::*;
@@ -69,7 +69,7 @@ unsafe extern "system" fn exception_handler(exception_info: PEXCEPTION_POINTERS)
EXCEPTION_CONTINUE_EXECUTION
} else {
info.capture_backtrace(ip);
Unwind(jmp_buf)
wasmtime_longjmp(jmp_buf)
}
})
}