Hello, Did you compile your own Mono? You might want to disable the TLS support in your Mono to work around these issues.
> Hi, > > I ran into a problem with dlopen and libmono.so. It appears > that the one and only __thread variable of libgc will > get the tls-model "global-dynamic", which doesn't seem to > be compatible with dlopen(3). I don't know whether this is > a bug or a "by design" feature. > > Mini uses __attribute__((tls_model("local-exec"))) for > __thread variables, if applicable, so I just added > the same code block I found in mono-compiler.h > to libgc/pthread_support.c > > The patch will probably speed-up the GC a little bit, although > I did't profile it. > > I'm not happy with the attached patch because it duplicates > code between mini and libgc, so I'd provide another patch, > if you guys would accept this solution: > > configure.is probes whether the GCC switch -ftls-model > is working. If yes, -ftls-model=local-exec will be added > to the CFLAGS of Mono and libgc. MONO_FAST_TLS can be > obsoleted. > > Rob > > ps: the attached "foo.c" is a test case for the problem. > Plain text document attachment (tls.diff) > Index: libgc/pthread_support.c > =================================================================== > --- libgc/pthread_support.c (revision 46453) > +++ libgc/pthread_support.c (working copy) > @@ -168,11 +168,23 @@ > > /* We don't really support thread-local allocation with DBG_HDRS_ALL */ > > +#if USE_COMPILER_TLS_ATTR > +#if defined(PIC) && defined(__x86_64__) > +#define COMPILER_TLS_ATTR > +#elif defined (__powerpc__) > +#define COMPILER_TLS_ATTR > +#else > +#define COMPILER_TLS_ATTR __attribute__((tls_model("local-exec"))) > +#endif > +#else > +#define COMPILER_TLS_ATTR > +#endif > + > static > #ifdef USE_COMPILER_TLS > __thread > #endif > -GC_key_t GC_thread_key; > +GC_key_t GC_thread_key COMPILER_TLS_ATTR; > > static GC_bool keys_initialized; > > Index: configure.in > =================================================================== > --- configure.in (revision 46453) > +++ configure.in (working copy) > @@ -1598,7 +1598,10 @@ > AC_TRY_COMPILE([static __thread int foo > __attribute__((tls_model("initial-exec")));], [ > ], [ > AC_MSG_RESULT(yes) > - AC_DEFINE(HAVE_TLS_MODEL_ATTR, 1, [tld_model available]) > + AC_DEFINE(HAVE_TLS_MODEL_ATTR, 1, [tls_model available]) > + # Pass the information to libgc as well > + CPPFLAGS="$CPPFLAGS -DUSE_COMPILER_TLS_ATTR" > + export CPPFLAGS > ], [ > AC_MSG_RESULT(no) > ]) > _______________________________________________ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Miguel de Icaza <[EMAIL PROTECTED]> _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list