emulating tls for systems without

Danny Smith dannysmith@clear.net.nz
Sun Sep 24 21:15:00 GMT 2006



> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org 
> [mailto:gcc-patches-owner@gcc.gnu.org] On Behalf Of Richard Henderson
> Sent: Thursday, 21 September 2006 1:59 p.m.
> To: Jakub Jelinek
> Cc: Diego Novillo; gcc-patches@gcc.gnu.org
> Subject: emulating tls for systems without
> 
> 
> Jakub, I've finished up that WIP patch you sent me this morning.
> 
> For everyone else, we've come up with a scheme to emulate tls 
> with the __gthread_[gs]etspecific routines that 
> thread-enabled systems are supposed to provide in their gcc 
> port. 

<snip>
> 
> It would be good if some windows or other similarly tls 
> deprived systems could test to see if openmp threadprivate 
> tests work as expected.
> 

Hello,
I applied your patch and tested using the libgomp testsuite on
i686-pc-mingw32.
I have modified  specs to add -mthread  -lpthread.a  when compiling with
-fopenmp.
The former will pull in libmingwthrd and so make gthread_active_p()
return true.  The latter provides a pthread
emulation libraray from the pthread-win32 project for the rest of the
-fopenmp interface.

The result with C were very promising;
All compilation tests passed.  All but two (copyin-1.c, lib-1.c)
execution tests passed.

In C++ tescases, I think I ran into the problem Jakub described, with
many link failures of
this sort.

/develop/svn/trunk/build/mingw32/./libgomp/../libstdc++-v3/src/.libs/lib
stdc++.a(eh_globals.o):eh_globals.cc:(.text$_ZN81_GLOBAL__N_.._.._.._.._
gcc_libstdc___v3_libsupc___eh_globals.cc_00000000_7C87594B10get_globalEv
+0x9): undefined reference to `(anonymous
namespace)::get_global()::__emutls_v._ZZN81_GLOBAL__N_.._.._.._.._gcc_li
bstdc___v3_libsupc___eh_globals.cc_00000000_7C87594B10get_globalEvE6glob
al'


In fortran, i ran into library problem with 
ialias (foo) expansion,  with undefined references to:

	 	`gomp_ialias_omp_set_dynamic'
                       	`gomp_ialias_omp_unset_nest_lock'
		`gomp_ialias_omp_unset_lock'
                       	`gomp_ialias_omp_set_nest_lock'
		`gomp_ialias_omp_set_lock'
		`gomp_ialias_omp_destroy_nest_lock'
		`gomp_ialias_omp_destroy_lock'
		`gomp_ialias_omp_init_nest_lock'
		`gomp_ialias_omp_init_lock'


That should be relaltively simple to fix.

Thanks for working on this. 

Danny



More information about the Gcc-patches mailing list