Error out instead of crashing when using sgen+pthread.
authorZoltan Varga <vargaz@gmail.com>
Fri, 14 Jan 2011 13:57:47 +0000 (14:57 +0100)
committerZoltan Varga <vargaz@gmail.com>
Fri, 14 Jan 2011 13:58:59 +0000 (14:58 +0100)
mono/metadata/sgen-gc.c

index 722b796ca80a223a59ecaa7a3c2d85cfcd5df3e7..020cb5eb1c4de7ae22e46d51c79efe83fe99ec0f 100644 (file)
@@ -7192,6 +7192,12 @@ enum {
        mono_mb_emit_i4 ((mb), (offset));               \
        } while (0)
 #else
+
+/* 
+ * CEE_MONO_TLS requires the tls offset, not the key, so the code below only works on darwin,
+ * where the two are the same.
+ */
+#ifdef __APPLE__
 #define EMIT_TLS_ACCESS(mb,member,dummy)       do {    \
        mono_mb_emit_byte ((mb), MONO_CUSTOM_PREFIX);   \
        mono_mb_emit_byte ((mb), CEE_MONO_TLS);         \
@@ -7200,6 +7206,10 @@ enum {
        mono_mb_emit_byte ((mb), CEE_ADD);              \
        mono_mb_emit_byte ((mb), CEE_LDIND_I);          \
        } while (0)
+#else
+#define EMIT_TLS_ACCESS(mb,member,dummy)       do { g_error ("sgen is not supported when using --with-tls=pthread.\n"); } while (0)
+#endif
+
 #endif
 
 #ifdef MANAGED_ALLOCATION