This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Use Intel BID library for BID


On Fri, Jun 15, 2007 at 09:15:39AM +1200, Danny Smith wrote:
> 
> 
> > -----Original Message-----
> > From: gcc-patches-owner@gcc.gnu.org 
> > [mailto:gcc-patches-owner@gcc.gnu.org] On Behalf Of H. J. Lu
> > 
> > # See if we support thread-local storage.
> > GCC_CHECK_TLS
> > 
> > in configure.ac. But libgcc is different since the newly built gcc
> > isn't available to create executable to run run-time test,
> > which is needed for GCC_CHECK_TLS, because libgcc is yet to be built.
> 
> 
> Doesn't Richard Henderson's TLS emulation take care of targets without
> assembler support for TLS?
> 
> 2007-02-10  Richard Henderson  <rth@redhat.com>
> 	    Jakub Jelinek  <jakub@redhat.com>
> 	    Alexandre Oliva  <aoliva@redhat.com>
> 
> 	* Makefile.in (libgcc-support, libgcc.mvars): Add emutls.c.
> 
> It does for windows targets even though HAVE_AS_TLS is undefined. 
> Note alose that rth's patch removed the need for 
>  /* { dg-require-effective-target tls } */ in gcc.dg/tls/
> 

We want to know if we can use __thread in libgcc in all cases.  That
is what GCC_CHECK_TLS in config/tls.m4 is checking.  Maybe I should 

if test x$build = x$target; then
  if test x$enable_tls = x; then
    enable_tls=yes
  fi
  GCC_CHECK_TLS
fi

in the patch I am testing now.


H.J.
--
gcc/

2007-06-14  H.J. Lu  <hongjiu.lu@intel.com>

	* configure.ac: Use GCC_CHECK_TLS for native compiler.

	* aclocal.m4: Regenerated.
	* config.in: Likewise.
	* configure: Regenerated.

libgcc/

2007-06-14  H.J. Lu  <hongjiu.lu@intel.com>

	* Makefile.in (gcc_compile_bare): Add @have_tls@.

	* configure.ac: Include ../config/enable.m4 and
	../config/tls.m4.  Use GCC_CHECK_TLS for cross compiler and
	substitute have_tls.
	* configure: Regenerated.

--- gcc/gcc/aclocal.m4.tls	2007-06-14 05:12:44.000000000 -0700
+++ gcc/gcc/aclocal.m4	2007-06-14 14:23:49.000000000 -0700
@@ -94,6 +94,7 @@ fi
 
 m4_include([../config/acx.m4])
 m4_include([../config/codeset.m4])
+m4_include([../config/enable.m4])
 m4_include([../config/gettext-sister.m4])
 m4_include([../config/iconv.m4])
 m4_include([../config/lcmessage.m4])
@@ -101,5 +102,6 @@ m4_include([../config/lib-ld.m4])
 m4_include([../config/lib-link.m4])
 m4_include([../config/lib-prefix.m4])
 m4_include([../config/progtest.m4])
+m4_include([../config/tls.m4])
 m4_include([../config/warnings.m4])
 m4_include([acinclude.m4])
--- gcc/gcc/config.in.tls	2007-06-14 05:13:05.000000000 -0700
+++ gcc/gcc/config.in	2007-06-14 14:23:58.000000000 -0700
@@ -1211,6 +1211,12 @@
 #endif
 
 
+/* Define to 1 if the target supports thread-local storage. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_TLS
+#endif
+
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_UNISTD_H
--- gcc/gcc/configure.ac.tls	2007-06-14 14:19:54.000000000 -0700
+++ gcc/gcc/configure.ac	2007-06-14 14:19:54.000000000 -0700
@@ -3419,6 +3419,16 @@ zlibinc=
 AC_SUBST(zlibdir)
 AC_SUBST(zlibinc)
 
+# Check if we can really use thread-local storage.  We can only check
+# it with the native compiler since we want to know if our target will
+# support thread-local storage, not the build machine.
+if test x$build = x$target; then
+  if test x$enable_tls = x; then
+    enable_tls=$set_have_as_tls
+  fi
+  GCC_CHECK_TLS
+fi
+
 dnl Very limited version of automake's enable-maintainer-mode
 
 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
--- gcc/libgcc/Makefile.in.tls	2007-06-14 14:19:54.000000000 -0700
+++ gcc/libgcc/Makefile.in	2007-06-14 14:19:54.000000000 -0700
@@ -225,7 +225,8 @@ MULTIOSSUBDIR := $(shell if test $(MULTI
 inst_libdir = $(libsubdir)$(MULTISUBDIR)
 inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)
 
-gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS)
+# If we can use thread-local storage
+gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS) @have_tls@
 compile_deps = -MT $@ -MD -MP -MF $(basename $@).dep
 gcc_compile = $(gcc_compile_bare) -o $@ $(compile_deps)
 gcc_s_compile = $(gcc_compile) -DSHARED
--- gcc/libgcc/configure.ac.tls	2007-06-14 14:19:54.000000000 -0700
+++ gcc/libgcc/configure.ac	2007-06-14 14:23:31.000000000 -0700
@@ -1,5 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 
+sinclude(../config/enable.m4)
+sinclude(../config/tls.m4)
 sinclude(../config/acx.m4)
 sinclude(../config/no-executables.m4)
 sinclude(../config/lib-ld.m4)
@@ -169,6 +171,19 @@ else
 fi
 AC_SUBST(vis_hide)
 
+# See if we support thread-local storage.  We can only test it for
+# cross build sicne it requires run-time test with the newly built
+# gcc, which can't be used to build executable due to that libgcc
+# is yet to be built here.  For native build, we will check it in gcc.
+have_tls=
+if test "$build" != "$host"; then
+  GCC_CHECK_TLS
+  if test "$enable_tls $have_tls" = "yes yes"; then
+    have_tls="-DHAVE_TLS"
+  fi
+fi
+AC_SUBST(have_tls)
+
 # Conditionalize the makefile for this target machine.
 tmake_file_=
 for f in ${tmake_file}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]