On Wed, May 02, 2007 at 03:23:15PM +0200, Sebastian Steiger wrote:
This is the patch following the discussion of myself and Andrew Haley in
the gcc-help mailing list:
http://gcc.gnu.org/ml/gcc-help/2007-04/msg00300.html
It fixes a problem when trying to dlopen() the libgomp library. This
operation is required, for example, when using libgomp from within
python. With the new libgomp, I was able to use the OpenMP functionality
in C++ functions that were ported to python using the python/C++ API,
e.g. with SWIG.
The tls-model flag was proposed by Iordan Hristov who initally
encountered the problem:
http://gcc.gnu.org/ml/gcc-help/2006-09/msg00164.html
This is a bad idea, global-dynamic model is much slower than initial-exec.
You can LD_PRELOAD=libgomp.so.1 python ...
Dropping -Wl,-z,nodlopen is possible on Linux, but you risk running out of the
preallocated static TLS space, as libgomp uses quite a lot of TLS vars (on
x86_64 64 bytes).
--- libgomp/configure.tgt (revision 123941)
+++ libgomp/configure.tgt (working copy)
@@ -17,8 +17,8 @@
case "${target}" in
*-*-linux*)
- XCFLAGS="${XCFLAGS} -ftls-model=initial-exec"
- XLDFLAGS="${XLDFLAGS} -Wl,-z,nodlopen"
+ XCFLAGS="${XCFLAGS} -ftls-model=global-dynamic"
+ XLDFLAGS="${XLDFLAGS}"
;;
esac
fi
Jakub