This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: emulating tls for systems without
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>, Diego Novillo <dnovillo at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 21 Sep 2006 04:33:54 -0400
- Subject: Re: emulating tls for systems without
- References: <20060920143207.GO12531@devserv.devel.redhat.com> <20060921015910.GE5186@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Sep 20, 2006 at 06:59:10PM -0700, Richard Henderson wrote:
> Jakub, I've finished up that WIP patch you sent me this morning.
Thanks. I have added a hack on top of this:
--- gcc/config/i386/i386.c.xx 2006-09-20 10:12:29.000000000 +0200
+++ gcc/config/i386/i386.c 2006-09-21 08:44:58.000000000 +0200
@@ -1267,7 +1267,7 @@ static section *x86_64_elf_select_sectio
#ifdef HAVE_AS_TLS
#undef TARGET_HAVE_TLS
-#define TARGET_HAVE_TLS true
+#define TARGET_HAVE_TLS false
#endif
#undef TARGET_CANNOT_FORCE_CONST_MEM
#define TARGET_CANNOT_FORCE_CONST_MEM ix86_cannot_force_const_mem
so that I can test it on x86-64 linux and tried to build it with target
libs. One thing is that libgcc_eh.a wasn't using WEAK symbols for
pthread_*, fixed by including two extra headers (that's exactly what
unwind-dw2.c does too):
* emutls.c: Include coretypes.h and tm.h.
--- gcc/emutls.c.jj 2006-09-21 08:44:17.000000000 +0200
+++ gcc/emutls.c 2006-09-21 10:03:54.000000000 +0200
@@ -30,6 +30,8 @@ Software Foundation, 51 Franklin Street,
#include "tconfig.h"
#include "tsystem.h"
+#include "coretypes.h"
+#include "tm.h"
#include "gthr.h"
typedef unsigned int word __attribute__((mode(word)));
But the next problem is that libgomp.so doesn't link, as e.g.
__emutls_v.tid_cache isn't defined anywhere. Small testcase
/* { dg-options "-O2" } */
static __thread int i;
int foo (void)
{
return i;
}
__emutls_v.i is optimized out. Guess we need some cgraph munging, but not
sure what exactly.
Jakub