]> git.lizzy.rs Git - rust.git/commitdiff
fix TLS on partially supported OSes
authorRalf Jung <post@ralfj.de>
Sun, 27 Nov 2022 12:19:54 +0000 (13:19 +0100)
committerRalf Jung <post@ralfj.de>
Mon, 28 Nov 2022 07:53:14 +0000 (08:53 +0100)
src/tools/miri/src/shims/tls.rs

index 65978c9774f516493f97ef17ab19410720c8ca0c..fe278ff717f0cc17c2c98c7e424655aed3b66bd0 100644 (file)
@@ -240,7 +240,7 @@ pub fn on_stack_empty<'tcx>(
         match &mut self.0 {
             Init => {
                 match this.tcx.sess.target.os.as_ref() {
-                    "linux" => {
+                    "linux" | "freebsd" | "android" => {
                         // Run the pthread dtors.
                         self.0 = PthreadDtors(Default::default());
                     }
@@ -257,10 +257,16 @@ pub fn on_stack_empty<'tcx>(
                         // And move to the final state.
                         self.0 = Done;
                     }
-                    _ => {
-                        // No TLS support for this platform, directly move to final state.
+                    "wasi" | "none" => {
+                        // No OS, no TLS dtors.
+                        // FIXME: should we do something on wasi?
                         self.0 = Done;
                     }
+                    os => {
+                        throw_unsup_format!(
+                            "the TLS machinery does not know how to handle OS `{os}`"
+                        );
+                    }
                 }
             }
             PthreadDtors(state) => {