[aot] Don't aot methods that use tls on HAVE_KW_THREAD platforms
[mono.git] / mono / mini / mini.c
index fff5ece8d5512e319ffe7c3a70bbaf25e5ba2b24..750410441af8afda4ad292c84405f3e195b47c24 100644 (file)
@@ -1983,6 +1983,18 @@ mono_create_tls_get (MonoCompile *cfg, MonoTlsKey key)
        if (!cfg->backend->have_tls_get)
                return NULL;
 
+#ifdef HAVE_KW_THREAD
+       /*
+        * MONO_THREAD_VAR_OFFSET definitions don't work when loading mono as a
+        * dynamic library. This means that we need to be conservative and don't
+        * aot code that contains these tls chunks.
+        *
+        * FIXME Remove HAVE_KW_THREAD altogether and use only pthread since it
+        * simplifies the code alot.
+        */
+       if (!cfg->full_aot)
+               cfg->disable_aot = TRUE;
+#endif
        /*
         * TLS offsets might be different at AOT time, so load them from a GOT slot and
         * use a different opcode.