Closed
Description
I'm attempting to run tests targeting an Android application under Miri and it fails to get past the std::rt::init()
routine. The error is as follows:
error: unsupported operation: `extern` static DefId(1:15149 ~ std[2a7e]::sys::unix::android::signal::{extern#1}::signal) is not supported by Miri
--> /Users/landerb/.rustup/toolchains/nightly-2022-03-03-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/unix/android.rs:75:5
|
75 | weak!(fn signal(c_int, sighandler_t) -> sighandler_t);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `extern` static DefId(1:15149 ~ std[2a7e]::sys::unix::android::signal::{extern#1}::signal) is not supported by Miri
|
= help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
= note: inside `std::sys::unix::android::signal` at /Users/landerb/.rustup/toolchains/nightly-2022-03-03-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/unix/weak.rs:40:38
= note: inside `std::sys::unix::init::reset_sigpipe` at /Users/landerb/.rustup/toolchains/nightly-2022-03-03-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/unix/mod.rs:123:19
= note: inside `std::sys::unix::init` at /Users/landerb/.rustup/toolchains/nightly-2022-03-03-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/unix/mod.rs:66:5
= note: inside `std::rt::init` at /Users/landerb/.rustup/toolchains/nightly-2022-03-03-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs:78:9
= note: inside closure at /Users/landerb/.rustup/toolchains/nightly-2022-03-03-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs:127:42
The issue seems to be with how the std::sys::unix::android::signal()
function is implemented with weak linking: https://github.com/rust-lang/rust/blob/1eb72580d076935a3e590deb6e5813a5aef3eca4/library/std/src/sys/unix/android.rs#L74-L81
We could init the extern static for Android, but I'm genuinely not sure how to go about looking up the implementation pointer it should be linked to or if we should implement some other workaround for this.