This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] libgomp: removing nodlopen flag for portability
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Sebastian Steiger <steigers at phys dot ethz dot ch>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 2 May 2007 09:36:50 -0400
- Subject: Re: [patch] libgomp: removing nodlopen flag for portability
- References: <463890C3.6030801@phys.ethz.ch>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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