Author: zoltan
Date: 2006-08-10 06:35:01 -0400 (Thu, 10 Aug 2006)
New Revision: 63578
Modified:
trunk/mono/mono/utils/ChangeLog
trunk/mono/mono/utils/mono-compiler.h
Log:
2006-08-10 Zoltan Varga <[EMAIL PROTECTED]>
* mono-compiler.h: Fix TLS definitions so libmono can be loaded
dynamically as a
module. Fixes #78767.
Modified: trunk/mono/mono/utils/ChangeLog
===================================================================
--- trunk/mono/mono/utils/ChangeLog 2006-08-10 09:49:03 UTC (rev 63577)
+++ trunk/mono/mono/utils/ChangeLog 2006-08-10 10:35:01 UTC (rev 63578)
@@ -1,4 +1,8 @@
+2006-08-10 Zoltan Varga <[EMAIL PROTECTED]>
+ * mono-compiler.h: Fix TLS definitions so libmono can be loaded
dynamically as a
+ module. Fixes #78767.
+
Wed May 17 19:00:15 CEST 2006 Paolo Molaro <[EMAIL PROTECTED]>
* mono-hash.h, mono-hash.c: changed the code so we're able to
Modified: trunk/mono/mono/utils/mono-compiler.h
===================================================================
--- trunk/mono/mono/utils/mono-compiler.h 2006-08-10 09:49:03 UTC (rev
63577)
+++ trunk/mono/mono/utils/mono-compiler.h 2006-08-10 10:35:01 UTC (rev
63578)
@@ -9,12 +9,26 @@
#ifdef HAVE_KW_THREAD
#if HAVE_TLS_MODEL_ATTR
+/*
+ * Define this if you want a faster libmono, which cannot be loaded
dynamically as a
+ * module.
+ */
+//#define PIC_INITIAL_EXEC
+
#if defined (__powerpc__)
#define MONO_TLS_FAST
#elif defined(PIC)
+
+#ifdef PIC_INITIAL_EXEC
#define MONO_TLS_FAST __attribute__((tls_model("initial-exec")))
#else
+#define MONO_TLS_FAST __attribute__((tls_model("local-dynamic")))
+#endif
+
+#else
+
#define MONO_TLS_FAST __attribute__((tls_model("local-exec")))
+
#endif
#else
@@ -29,6 +43,7 @@
#endif
#elif defined(__x86_64__)
#if defined(PIC)
+// This only works if libmono is linked into the application
#define MONO_THREAD_VAR_OFFSET(var,offset) do { guint64 foo; __asm ("movq "
#var "@GOTTPOFF(%%rip), %0" : "=r" (foo)); offset = foo; } while (0)
#else
#define MONO_THREAD_VAR_OFFSET(var,offset) do { guint64 foo; __asm ("movq $"
#var "@TPOFF, %0" : "=r" (foo)); offset = foo; } while (0)
@@ -39,6 +54,15 @@
#define MONO_THREAD_VAR_OFFSET(var,offset) (offset) = -1
#endif
+#if defined(PIC) && !defined(PIC_INITIAL_EXEC)
+/*
+ * The above definitions do not seem to work if libmono is loaded dynamically
as a module.
+ * See bug #78767.
+ */
+#undef MONO_THREAD_VAR_OFFSET
+#define MONO_THREAD_VAR_OFFSET(var,offset) (offset) = -1
+#endif
+
#else /* no HAVE_KW_THREAD */
#define MONO_THREAD_VAR_OFFSET(var,offset) (offset) = -1
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches