diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index d83dcde74f6..00000000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,5 +0,0 @@ -[target.'cfg(target_os = "linux")'] -rustflags = [ - # Put the VM functions in the dynamic symbol table. - "-C", "link-arg=-Wl,-E", -] diff --git a/lib/api/build.rs b/lib/api/build.rs new file mode 100644 index 00000000000..43fde88973c --- /dev/null +++ b/lib/api/build.rs @@ -0,0 +1,5 @@ +//! Pass `--export-dynamic` to the linker. +fn main() { + #[cfg(target_os = "linux")] + println!("cargo:rustc-cdylib-link-arg=--export-dynamic"); +} diff --git a/lib/c-api/build.rs b/lib/c-api/build.rs index ce423ac12e1..e411c704f8c 100644 --- a/lib/c-api/build.rs +++ b/lib/c-api/build.rs @@ -1,5 +1,6 @@ //! This build script aims at: //! +//! * pass `--export-dynamic` to the linker, //! * generating the C header files for the C API, //! * setting `inline-c` up. @@ -69,6 +70,9 @@ macro_rules! map_feature_as_c_define { } fn main() { + #[cfg(target_os = "linux")] + println!("cargo:rustc-cdylib-link-arg=--export-dynamic"); + if !running_self() { return; } diff --git a/lib/engine-dylib/build.rs b/lib/engine-dylib/build.rs new file mode 100644 index 00000000000..43fde88973c --- /dev/null +++ b/lib/engine-dylib/build.rs @@ -0,0 +1,5 @@ +//! Pass `--export-dynamic` to the linker. +fn main() { + #[cfg(target_os = "linux")] + println!("cargo:rustc-cdylib-link-arg=--export-dynamic"); +} diff --git a/lib/vm/build.rs b/lib/vm/build.rs index 278eb570db7..c5abd9f1e6c 100644 --- a/lib/vm/build.rs +++ b/lib/vm/build.rs @@ -1,8 +1,12 @@ -//! Runtime build script compiles C code using setjmp for trap handling. +//! 1. Pass `--export-dynamic` to the linker. +//! 2. Runtime build script compiles C code using setjmp for trap handling. use std::env; fn main() { + #[cfg(target_os = "linux")] + println!("cargo:rustc-cdylib-link-arg=--export-dynamic"); + println!("cargo:rerun-if-changed=src/trap/handlers.c"); cc::Build::new()