diff options
| author | Ralf Jung <post@ralfj.de> | 2022-11-26 15:58:44 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-11-26 16:14:58 +0100 |
| commit | 3158a8d476d6f35664502fa50aae9f3e873a263e (patch) | |
| tree | 161ec2736722678e62088e7aa0d5f73e65085147 /src | |
| parent | 245857beb76094d07f8447c5072d9da386f42b91 (diff) | |
| download | rust-3158a8d476d6f35664502fa50aae9f3e873a263e.tar.gz rust-3158a8d476d6f35664502fa50aae9f3e873a263e.zip | |
support no_std on Windows
Diffstat (limited to 'src')
| -rwxr-xr-x | src/tools/miri/ci.sh | 1 | ||||
| -rw-r--r-- | src/tools/miri/src/shims/tls.rs | 5 | ||||
| -rw-r--r-- | src/tools/miri/tests/pass/no_std.rs | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/tools/miri/ci.sh b/src/tools/miri/ci.sh index bf9e986bdc7..4e976ef248a 100755 --- a/src/tools/miri/ci.sh +++ b/src/tools/miri/ci.sh @@ -75,7 +75,6 @@ function run_tests_minimal { ./miri test -- "$@" # Ensure that a small smoke test of cargo-miri works. - # Note: This doesn't work on windows because of TLS. cargo miri run --manifest-path test-cargo-miri/no-std-smoke/Cargo.toml } diff --git a/src/tools/miri/src/shims/tls.rs b/src/tools/miri/src/shims/tls.rs index 430dedbc170..5fda8bd7b7d 100644 --- a/src/tools/miri/src/shims/tls.rs +++ b/src/tools/miri/src/shims/tls.rs @@ -261,6 +261,11 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { // (that would be basically https://github.com/rust-lang/miri/issues/450), // we specifically look up the static in libstd that we know is placed // in that section. + if !this.have_module(&["std"]) { + // Looks like we are running in a `no_std` crate. + // That also means no TLS dtors callback to call. + return Ok(()); + } let thread_callback = this.eval_windows("thread_local_key", "p_thread_callback")?.to_pointer(this)?; let thread_callback = this.get_ptr_fn(thread_callback)?.as_instance()?; diff --git a/src/tools/miri/tests/pass/no_std.rs b/src/tools/miri/tests/pass/no_std.rs index eb0e860e68e..3bece7783f7 100644 --- a/src/tools/miri/tests/pass/no_std.rs +++ b/src/tools/miri/tests/pass/no_std.rs @@ -1,9 +1,5 @@ #![feature(lang_items, start)] #![no_std] -// windows tls dtors go through libstd right now, thus this test -// cannot pass. When windows tls dtors go through the special magic -// windows linker section, we can run this test on windows again. -//@ignore-target-windows: no-std not supported on Windows // Plumbing to let us use `writeln!` to host stdout: |
