diff --git a/wild/tests/sources/rdyn1.rs b/wild/tests/sources/rdyn1.rs index d0caf96..dd4d0b4 100644 --- a/wild/tests/sources/rdyn1.rs +++ b/wild/tests/sources/rdyn1.rs @@ -15,6 +15,10 @@ thread_local! { pub static TLS1: Cell = const { Cell::new(1) }; } +thread_local! { + pub static TLS2: Cell = const { Cell::new(2) }; +} + #[no_mangle] pub extern fn get_tls1() -> i32 { TLS1.get() @@ -24,3 +28,13 @@ pub extern fn get_tls1() -> i32 { pub extern fn set_tls1(value: i32) { TLS1.set(value); } + +#[no_mangle] +pub extern fn get_tls2() -> i32 { + TLS2.get() +} + +#[no_mangle] +pub extern fn set_tls2(value: i32) { + TLS2.set(value); +} diff --git a/wild/tests/sources/rust-integration-dynamic.rs b/wild/tests/sources/rust-integration-dynamic.rs index 6d9915b..30e9511 100644 --- a/wild/tests/sources/rust-integration-dynamic.rs +++ b/wild/tests/sources/rust-integration-dynamic.rs @@ -5,11 +5,13 @@ //#CompArgs:-C debuginfo=2 //#Shared:rdyn1.rs -extern { +extern "C" { fn foo() -> i32; fn bar() -> i32; fn get_tls1() -> i32; fn set_tls1(value: i32); + fn get_tls2() -> i32; + fn set_tls2(value: i32); } fn main() { @@ -21,10 +23,26 @@ fn main() { std::process::exit(101); } - unsafe { set_tls1(88); } - if unsafe { get_tls1() } != 88 { + if unsafe { get_tls1() } != 1 { std::process::exit(102); } + if unsafe { get_tls2() } != 2 { + std::process::exit(103); + } + + unsafe { + set_tls1(88); + } + unsafe { + set_tls2(55); + } + + if unsafe { get_tls1() } != 88 { + std::process::exit(104); + } + if unsafe { get_tls2() } != 55 { + std::process::exit(105); + } std::process::exit(42); }