mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-23 05:31:32 +00:00
Work around unstable linkage attribute
This commit is contained in:
@ -56,3 +56,6 @@ managed = []
|
||||
deterministic-execution = ["wasmparser/deterministic"]
|
||||
# generate debug information from Wasm DWARF for use with the GDB JIT interface
|
||||
generate-debug-information = ["wasm-debug"]
|
||||
# don't export symbols related to the GDB JIT interafce, LLVM or some other native
|
||||
# code will be providing them
|
||||
generate-debug-information-no-export-symbols = ["generate-debug-information", "wasm-debug"]
|
||||
|
@ -15,7 +15,7 @@ use std::sync::{Arc, Mutex};
|
||||
// Implementation of this function is derived from wasmtime and is licensed under
|
||||
// the Apache 2.0 license. See ATTRIBUTIONS.md for full license and more
|
||||
// information.
|
||||
#[linkage = "linkonce"]
|
||||
#[cfg(not(feature = "generate-debug-information-no-export-symbols"))]
|
||||
#[no_mangle]
|
||||
#[inline(never)]
|
||||
extern "C" fn __jit_debug_register_code() {
|
||||
@ -81,7 +81,7 @@ struct JitDebugDescriptor {
|
||||
/// The data is in the form of a doubly linked list. This global variable acts
|
||||
/// as a head node with extra information about the operation that we want the
|
||||
/// debugger to perform.
|
||||
#[linkage = "linkonce"]
|
||||
#[cfg(not(feature = "generate-debug-information-no-export-symbols"))]
|
||||
#[no_mangle]
|
||||
#[allow(non_upper_case_globals)]
|
||||
static mut __jit_debug_descriptor: JitDebugDescriptor = JitDebugDescriptor {
|
||||
@ -91,6 +91,12 @@ static mut __jit_debug_descriptor: JitDebugDescriptor = JitDebugDescriptor {
|
||||
first_entry: ptr::null_mut(),
|
||||
};
|
||||
|
||||
#[cfg(feature = "generate-debug-information-no-export-symbols")]
|
||||
extern "C" {
|
||||
static mut __jit_debug_descriptor: JitDebugDescriptor;
|
||||
fn __jit_debug_register_code();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Global lock on [`__jit_debug_descriptor`]. Acquire this lock when
|
||||
/// reading or writing to the global variable. This includes calls to
|
||||
@ -173,12 +179,28 @@ impl Drop for JitCodeDebugInfoEntryHandleInner {
|
||||
}
|
||||
|
||||
/// Manager of debug info registered with the debugger.
|
||||
#[derive(Debug, Clone, Default)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct JitCodeDebugInfoManager {
|
||||
inner: Vec<JitCodeDebugInfoEntryHandle>,
|
||||
}
|
||||
|
||||
impl Default for JitCodeDebugInfoManager {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl JitCodeDebugInfoManager {
|
||||
pub(crate) fn new() -> Self {
|
||||
unsafe {
|
||||
// ensure we set the version, even if externally linked
|
||||
__jit_debug_descriptor.version = 1;
|
||||
}
|
||||
Self {
|
||||
inner: vec![],
|
||||
}
|
||||
}
|
||||
|
||||
/// Register debug info relating to JIT code with the debugger.
|
||||
pub(crate) fn register_new_jit_code_entry(
|
||||
&mut self,
|
||||
|
@ -99,7 +99,7 @@ pub fn read_module<
|
||||
|
||||
generate_debug_info: compiler_config.should_generate_debug_info(),
|
||||
#[cfg(feature = "generate-debug-information")]
|
||||
debug_info_manager: Default::default(),
|
||||
debug_info_manager: crate::jit_debug::JitCodeDebugInfoManager::new(),
|
||||
}));
|
||||
|
||||
let mut parser = wasmparser::ValidatingParser::new(
|
||||
|
Reference in New Issue
Block a user