[utils] Don't abort at startup if remote TLS reads is not available.
authorRodrigo Kumpera <kumpera@gmail.com>
Thu, 9 Jul 2015 14:02:57 +0000 (10:02 -0400)
committerRodrigo Kumpera <kumpera@gmail.com>
Fri, 10 Jul 2015 14:07:33 +0000 (10:07 -0400)
Remote TLS reads is not a required feature for the runtime to work on
mach systems. We still want it available, but can leave the assertion
to happen when someone actually use it.

Usage won't happen today as part of regular code execution, so moving
the assert will make us more robust.

mono/utils/mach-support-amd64.c
mono/utils/mach-support-arm.c
mono/utils/mach-support-x86.c

index 47bced480236a5cdcaf66a7f0614104da64599e4..7944e2c986b68ceaa2dd2b86cb2fc5d3946f2d15 100644 (file)
@@ -107,6 +107,7 @@ mono_mach_get_tls_address_from_thread (pthread_t thread, pthread_key_t key)
         */
        intptr_t *p = (intptr_t *)thread;
        intptr_t **tsd = (intptr_t **) ((char*)p + tls_vector_offset);
+       g_assert (tls_vector_offset != -1);
 
        return (void *) &tsd [key];
 }
@@ -151,7 +152,8 @@ mono_mach_init (pthread_key_t key)
                }
        }
 
-       g_error ("could not discover the mach TLS offset");
+       tls_vector_offset = -1;
+       g_warning ("could not discover the mach TLS offset");
 ok:
        pthread_setspecific (key, old_value);
 }
index f32e14c7cfe0f0b419affe2e45a5c6477459d3ea..cdf701cd8f4368fc01bd9ca7ec51b978ca8ab368 100644 (file)
@@ -163,6 +163,7 @@ mono_mach_get_tls_address_from_thread (pthread_t thread, pthread_key_t key)
         */
        intptr_t *p = (intptr_t *) thread;
        intptr_t **tsd = (intptr_t **) ((char*)p + tls_vector_offset);
+       g_assert (tls_vector_offset != -1);
 
        return (void *) &tsd [key];
 }
@@ -201,7 +202,8 @@ mono_mach_init (pthread_key_t key)
                }
        }
 
-       g_error ("could not discover the mach TLS offset");
+       tls_vector_offset = -1;
+       g_warning ("could not discover the mach TLS offset");
 ok:
        pthread_setspecific (key, old_value);
 }
index c65a7b8cadac99ec59f1b949d71588f09d071c88..cc09323c48ce94d300d9e4f8fe9d922036c3137b 100644 (file)
@@ -106,6 +106,7 @@ mono_mach_get_tls_address_from_thread (pthread_t thread, pthread_key_t key)
         */
        intptr_t *p = (intptr_t *) thread;
        intptr_t **tsd = (intptr_t **) ((char*)p + tls_vector_offset);
+       g_assert (tls_vector_offset != -1);
 
        return (void *) &tsd [key];     
 }
@@ -154,7 +155,8 @@ mono_mach_init (pthread_key_t key)
                }
        }
 
-       g_error ("could not discover the mach TLS offset");
+       tls_vector_offset = -1;
+       g_warning ("could not discover the mach TLS offset");
 ok:
        pthread_setspecific (key, old_value);
 }