diff mbox

Problems with trans-mem branch on Solaris/x86 etc.

Message ID yddaa88xigf.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Nov. 7, 2011, 11:47 a.m. UTC
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.

Comments

Richard Henderson Nov. 7, 2011, 4:44 p.m. UTC | #1
On 11/07/2011 03:47 AM, Rainer Orth wrote:
>   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.

You're right about that.

>   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.

Of course there's a bit more porting work to do for a new cpu.
E.g. implementing the sjlj.S file.

We should make sure that the bootstrap succeeds though,
disabling the library when porting work hasn't been done.

> * 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

Ug.  I hate conditionalizing these things.

> * 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.

Ok, we can take care of this post-merge.

Thanks for the review of the configury as well.

> 	* 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.

Ok for branch.


r~
Joseph Myers Nov. 7, 2011, 11:48 p.m. UTC | #2
On Mon, 7 Nov 2011, Richard Henderson wrote:

> We should make sure that the bootstrap succeeds though,
> disabling the library when porting work hasn't been done.

For disabling libraries, I've suggested that toplevel configure should 
source a file from the subdirectory that says whether a target is 
supported (maybe sets various libitm_* shell variables relating to the 
configuration for that target including libitm_supported or similar to say 
whether it's supported at all).  Such a file might also be sourced by 
libitm configure.  The idea is to get toplevel configure out of the 
business of listing targets that do or do not support particular languages 
or libraries, instead keeping that information with the libraries 
themselves (and so not needing merging between the gcc and src 
repositories).  You can do this incrementally, one subdirectory at a time.
Rainer Orth Nov. 8, 2011, 2:51 p.m. UTC | #3
Richard Henderson <rth@redhat.com> writes:

>>   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.
>
> Of course there's a bit more porting work to do for a new cpu.
> E.g. implementing the sjlj.S file.

I see.  Currently, it seems you have to go by example.  For the SPARC
case, this seems to be something for Eric and/or David to try.

> We should make sure that the bootstrap succeeds though,
> disabling the library when porting work hasn't been done.

Indeed :-)  I wanted to give Tru64 UNIX a try, but am currently running
into an ICE building stage1 libstdc++:

/var/gcc/regression/trunk/5.1b-gcc/build/alpha-dec-osf5.1b/libstdc++-v3/include/bits/ptr_traits.h:158:12: internal compiler error: in dbxout_type, at dbxout.c:2372

Have to check out what's going on here first.

>> * 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
>
> Ug.  I hate conditionalizing these things.

It should be doable to follow the libffi lead to deal with sjls.S with
Sun as without .cfi* support on x86.

>> * 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.
>
> Ok, we can take care of this post-merge.

Indeed.  I'll give it a try if I get around to it.

>> 	* 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.
>
> Ok for branch.

I didn't manage to apply it in time before the merge.  Still ok for
mainline, I assume?  I've just completed a C++-only bootstrap on
i386-pc-solaris2.11, the only new failures compared to my test last
weekend being

FAIL: libitm.c/clone-1.c execution test

for both 32 and 64-bit.

Thanks.
        Rainer
Richard Henderson Nov. 8, 2011, 2:52 p.m. UTC | #4
On 11/08/2011 06:51 AM, Rainer Orth wrote:
>>> >> 	* 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.
>> >
>> > Ok for branch.
> I didn't manage to apply it in time before the merge.  Still ok for
> mainline, I assume?  I've just completed a C++-only bootstrap on
> i386-pc-solaris2.11, the only new failures compared to my test last
> weekend being

Yes of course.


r~
diff mbox

Patch

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 "*)
 	    ;;