This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Problems with trans-mem branch on Solaris/x86 etc.
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Aldy Hernandez <aldyh at redhat dot com>, Richard Henderson <rth at redhat dot com>
- Date: Mon, 07 Nov 2011 12:47:28 +0100
- Subject: Problems with trans-mem branch on Solaris/x86 etc.
This weekend, I tried the trans-mem branch as of r180975 on
i386-pc-solaris2.11. Doing so, I ran into a couple of problems. I'm
reporting them here, both because bugzilla currently lacks a libitm
component and in the hope that they can be fixed before the merge.
* At first I tried a bootstrap with the default configuration with Sun
as and ld. That failed immediately in libitm:
In file included from /vol/gcc/src/hg/trunk/tm/libitm/aatree.cc:28:0:
/vol/gcc/src/hg/trunk/tm/libitm/libitm_i.h:77:20: fatal error: target.h: No such file or directory
compilation terminated.
make[4]: *** [aatree.lo] Error 1
While the configure triplet has i386 as target_cpu, the port defaults
to --with-arch=pentiumpro (Solaris 8/9) or pentium4 (Solaris 10+).
I've changed configure.tgt to accept i386 as well, but this needs to
be dealt with in a more general way. Besides, this should fail
e.g. with an error or something, not with a missing header.
Solaris/SPARC is going to have a similar issue: the default configure
triplet is sparc-sun-solaris2*, still it defaults to v8plus, so cas is
available. I haven't tried a bootstrap yet, though.
* There's an error in config/generic/tls.h, fixed in the patch below:
In file included from /vol/gcc/src/hg/trunk/tm/libitm/libitm_i.h:273:0,
from /vol/gcc/src/hg/trunk/tm/libitm/aatree.cc:28:
/vol/gcc/src/hg/trunk/tm/libitm/config/generic/tls.h: In function 'GTM::gtm_thread* GTM::gtm_thr()':
/vol/gcc/src/hg/trunk/tm/libitm/config/generic/tls.h:52:60: error: cannot convert 'GTM::gtm_thread**' to 'GTM::gtm_thread*' in return
make[2]: *** [aatree.lo] Error 1
* config/x86/cacheline.h doesn't assemble with Sun as:
Assembler: cacheline.cc
"/var/tmp//ccM9aGuv.s", line 148 : Syntax error
Near line: " jnz,pn 0b"
make[2]: *** [cacheline.lo] Error 1
I've not tried to fix this, since config/x86/sjlj.S unconditionally
uses .cfi* directives, which doesn't work with Sun as either. The
same problem is bound to happen in config/alpha/sjlj.S on Tru64
UNIX, which uses the vendor assembler.
* At that point, I gave up with Sun as for now and retried with gas
2.21.1 instead. With the problems above fixed, libitm.la fails to
link:
Undefined first referenced
symbol in file
GTM::_gtm_thr_tls .libs/alloc_c.o (symbol scope specifies local binding)
ld: fatal: symbol referencing errors. No output written to .libs/libitm.so.0.0.0
collect2: error: ld returned 1 exit status
make[4]: *** [libitm.la] Error 1
_gtm_thr_tls is declared, but never defined, also fixed in the patch
below.
This allowed the bootstrap to finish. I see a few tm-related testsuite
failures:
* 32-bit:
FAIL: libitm.c/memcpy-1.c execution test
libitm: pr_undoLogCode not supported
FAIL: libitm.c/memset-1.c execution test
likewise
* 64-bit:
FAIL: libitm.c++/eh-1.C execution test
terminate called after throwing an instance of 'int'
not yet investigated
* 32 and 64-bit:
WARNING: libitm.c++/static_ctor.C compilation failed to produce executable
Probably use dg-skip-if instead of dg-xfail-if?
* 32 and 64-bit:
FAIL: c-c++-common/tm/malloc.c scan-tree-dump-times tmmark " malloc .666" 1
* 32-bit:
FAIL: gcc.dg/tm/memopt-1.c scan-tree-dump-times tmmemopt "transforming: .*_ITM_RaWU8 \\(&g\\);" 1
Unrelated to the failure at hand, but in Tcl regex, . also matches
newlines, so better use \[^\n\r\]* instead.
Apart from those build- and test-related issues, I found a couple of
others (merely by inspection):
* libitm.map cannot work with Sun ld due to its use of wildcards. In
fact, the whole symbol versioning support was copied from libgomp
before gcc gained symbol versioning for Sun ld. Fortunately, this
still works for now, but should be fixed before GCC 4.7.0 is released.
* obsolete/wrong references to libgomp:
configure.ac
configure.tgt
testsuite/libitm.c++/c++.exp
* configure.ac (AC_PREREQ) is outdated, should be 2.64 instead.
unused header checks: unistd.h, semaphore.h, sys/time.h
unused GCC_HEADER_STDINT
AC_C_BIGENDIAN/WORDS_BIGENDIAN could be replaced by built-in macros
unused function checks: strtoull
HAVE_BROKEN_POSIX_SEMAPHORES is unused
LIBITM_CHECK_ATTRIBUTE_DLLEXPORT, LIBITM_CHECK_ATTRIBUTE_ALIAS unused
LIBITM_GNU_SYMBOL_VERSIONING unused
LIBITM_CHECK_SYNC_BUILTINS unused
* Makefile.am:
fincludedir, libsubincludedir are unused
That's it for now.
Rainer
2011-11-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.tgt: Handle i386 like i[456]86.
* config/generic/tls.h [!HAVE_ARCH_GTM_THREAD] (gtm_thr): Don't
take address.
* config/generic/tls.cc [!HAVE_ARCH_GTM_THREAD ||
!HAVE_ARCH_GTM_THREAD_DISP] (_gtm_thr_tls): New variable.
diff --git a/libitm/config/generic/tls.cc b/libitm/config/generic/tls.cc
--- a/libitm/config/generic/tls.cc
+++ b/libitm/config/generic/tls.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2010, 2011 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU Transactional Memory Library (libitm).
@@ -26,6 +26,10 @@
namespace GTM HIDDEN {
+#if !defined(HAVE_ARCH_GTM_THREAD) || !defined(HAVE_ARCH_GTM_THREAD_DISP)
+__thread gtm_thread_tls _gtm_thr_tls;
+#endif
+
// Filter out any updates that overlap the libitm stack, as defined by
// TOP (entry point to library) and BOT (below current function). This
// definition should be fine for all stack-grows-down architectures.
diff --git a/libitm/config/generic/tls.h b/libitm/config/generic/tls.h
--- a/libitm/config/generic/tls.h
+++ b/libitm/config/generic/tls.h
@@ -49,7 +49,7 @@ extern __thread gtm_thread_tls _gtm_thr_
#ifndef HAVE_ARCH_GTM_THREAD
// If the target does not provide optimized access to the thread-local
// data, simply access the TLS variable defined above.
-static inline gtm_thread *gtm_thr() { return &_gtm_thr_tls.thr; }
+static inline gtm_thread *gtm_thr() { return _gtm_thr_tls.thr; }
static inline void set_gtm_thr(gtm_thread *x) { _gtm_thr_tls.thr = x; }
#endif
diff --git a/libitm/configure.tgt b/libitm/configure.tgt
--- a/libitm/configure.tgt
+++ b/libitm/configure.tgt
@@ -52,7 +52,7 @@ case "${target_cpu}" in
powerpc*) ARCH=powerpc ;;
s390*) ARCH=s390 ;;
- i[456]86)
+ i[3456]86)
case " ${CC} ${CFLAGS} " in
*" -m64 "*)
;;
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University