Bug 318378 (MONO75390) - [PATCH] TLS issues
Summary: [PATCH] TLS issues
Status: RESOLVED FIXED
Alias: MONO75390
Product: Mono: Runtime
Classification: Mono
Component: GC (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Paolo Molaro
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-27 15:43 UTC by Robert Jordan
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
tls.diff (1.26 KB, patch)
2005-06-27 15:44 UTC, Thomas Wiest
Details | Diff
test case (455 bytes, text/plain)
2005-06-27 15:45 UTC, Thomas Wiest
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:23:17 UTC


---- Reported by robertj@gmx.net 2005-06-27 08:43:54 MST ----

[Rephrased from the mail "[PATCH] issue with libmono.so and dlopen"
@ mono-devel-list. Sorry for that]

Description:

If mono is built using the "--with-tls=__thread" option,
the one and only libgc variable declared with __thread
will cause dlopen(3) problems because its declaration doesn't
specify a compatible TLS model.

The default TLS model for unattributed __thread declarations
is "global-dynamic" which doesn't seem to be compatible with
dlopen(3).

See test case.

Affected systems I tested with:
SUSE 9.0-9.3

Patch:

libmono uses  __attribute__((tls_model("local-exec"))) for
__thread variables, so I just added the same code block I
found in utils/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.

Suggestions:

I'm not happy with the attached patch because it duplicates
code between libmono 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 libmono and libgc. MONO_FAST_TLS might be
obsoleted.



---- Additional Comments From robertj@gmx.net 2005-06-27 08:44:32 MST ----

Created an attachment (id=168186)
tls.diff




---- Additional Comments From robertj@gmx.net 2005-06-27 08:45:16 MST ----

Created an attachment (id=168187)
test case




---- Additional Comments From miguel@ximian.com 2005-06-29 19:46:28 MST ----

Paolo, can you review/comment on this one?



---- Additional Comments From lupus@ximian.com 2005-07-07 06:18:12 MST ----

This is fixed in svn. Robert: you might want to report to the libc
folks to check if this is also a bug in the dl support.

Imported an attachment (id=168186)
Imported an attachment (id=168187)

Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>SUSE 9.0-9.3</cf_op_sys_details>
Unknown operating system SUSE 9.2. Setting to default OS "Other".