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: [libitm] Link with -litm and -pthread


On Sat, Feb 11, 2012 at 03:14:40PM +0100, Eric Botcazou wrote:
> Hi,
> 
> this completes the half-implemented linking scheme of libitm and makes it mimic 
> that of libgomp entirely.  We need the -pthread thing on Solaris 8.
> 
> Tested on SPARC/Solaris 8 & 9 and i586/Linux, OK for the mainline?

This change causes massive failures at -m32/-m64 on x86_64-apple-darwin11
in the libitm testsuite...

FAIL: libitm.c/cancel.c (test for excess errors)
WARNING: libitm.c/cancel.c compilation failed to produce executable
FAIL: libitm.c/clone-1.c (test for excess errors)
WARNING: libitm.c/clone-1.c compilation failed to produce executable
FAIL: libitm.c/dropref-2.c (test for excess errors)
WARNING: libitm.c/dropref-2.c compilation failed to produce executable
FAIL: libitm.c/dropref.c (test for excess errors)
WARNING: libitm.c/dropref.c compilation failed to produce executable
FAIL: libitm.c/memcpy-1.c (test for excess errors)
WARNING: libitm.c/memcpy-1.c compilation failed to produce executable
FAIL: libitm.c/memset-1.c (test for excess errors)
WARNING: libitm.c/memset-1.c compilation failed to produce executable
FAIL: libitm.c/notx.c (test for excess errors)
WARNING: libitm.c/notx.c compilation failed to produce executable
FAIL: libitm.c/reentrant.c (test for excess errors)
WARNING: libitm.c/reentrant.c compilation failed to produce executable
FAIL: libitm.c/simple-1.c (test for excess errors)
WARNING: libitm.c/simple-1.c compilation failed to produce executable
FAIL: libitm.c/simple-2.c (test for excess errors)
WARNING: libitm.c/simple-2.c compilation failed to produce executable
FAIL: libitm.c/stackundo.c (test for excess errors)
WARNING: libitm.c/stackundo.c compilation failed to produce executable
FAIL: libitm.c/txrelease.c (test for excess errors)
WARNING: libitm.c/txrelease.c compilation failed to produce executable
Running /sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20120211/libitm/testsuite/libitm.c++/c++.exp ...
FAIL: libitm.c++/dropref.C (test for excess errors)
WARNING: libitm.c++/dropref.C compilation failed to produce executable
FAIL: libitm.c++/eh-1.C (test for excess errors)
WARNING: libitm.c++/eh-1.C compilation failed to produce executable

# of expected passes		1
# of unexpected failures	14
# of unsupported tests		1

These appear in the form...

Executing on host: /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/ /sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20120211/libitm/testsuite/libitm.c/cancel.c  -B/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.3.0/./libitm/ -I/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.3.0/./libitm -I/sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20120211/libitm/testsuite/.. -shared-libgcc -fmessage-length=0 -fgnu-tm  -O2   -L/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.3.0/./libitm/.libs -lm   -m64 -o ./cancel.exe    (timeout = 300)
Undefined symbols for architecture x86_64:
  "__ITM_registerTMCloneTable", referenced from:
      ___doTMRegistrations in crttms.o
  "__ITM_abortTransaction", referenced from:
      _cancel1 in ccSkMYPk.o
      transaction clone for cancel1 in ccSkMYPk.o
      _main in ccSkMYPk.o
  "__ITM_beginTransaction", referenced from:
      _main in ccSkMYPk.o
  "__ITM_WU4", referenced from:
      _main in ccSkMYPk.o
  "__ITM_commitTransaction", referenced from:
      _main in ccSkMYPk.o
  "__ITM_inTransaction", referenced from:
      _main in ccSkMYPk.o
  "__ITM_deregisterTMCloneTable", referenced from:
      ___doTMdeRegistrations in crttme.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
compiler exited with status 1
output is:
Undefined symbols for architecture x86_64:
  "__ITM_registerTMCloneTable", referenced from:
      ___doTMRegistrations in crttms.o
  "__ITM_abortTransaction", referenced from:
      _cancel1 in ccSkMYPk.o
      transaction clone for cancel1 in ccSkMYPk.o
      _main in ccSkMYPk.o
  "__ITM_beginTransaction", referenced from:
      _main in ccSkMYPk.o
  "__ITM_WU4", referenced from:
      _main in ccSkMYPk.o
  "__ITM_commitTransaction", referenced from:
      _main in ccSkMYPk.o
  "__ITM_inTransaction", referenced from:
      _main in ccSkMYPk.o
  "__ITM_deregisterTMCloneTable", referenced from:
      ___doTMdeRegistrations in crttme.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

FAIL: libitm.c/cancel.c (test for excess errors)

> 
> 
> 2012-02-11  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	* gcc.c (LINK_COMMAND_SPEC): Deal with -fgnu-tm.
> 	(GTM_SELF_SPECS): Define if not already defined.
> 	(driver_self_specs): Add GTM_SELF_SPECS.
> 	* config/darwin.h (GTM_SELF_SPECS): Define.
> 	* config/i386/cygwin.h (GTM_SELF_SPECS): Likewise.
> 	* config/i386/mingw32.h (GTM_SELF_SPECS): Likewise.
> 
> 
> 2012-02-11  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	* configure.ac (link_itm): Fix comment.
> 	* configure: Regenerate.
> 	* testsuite/lib/libitm.exp: Do not pass -litm for the link.
> 
> 
> -- 
> Eric Botcazou

> Index: gcc/gcc.c
> ===================================================================
> --- gcc/gcc.c	(revision 183864)
> +++ gcc/gcc.c	(working copy)
> @@ -675,6 +675,7 @@ proper position among the other output f
>      %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
>      %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
>      %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
> +    %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
>      %(mflib) " STACK_SPLIT_SPEC "\
>      %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
>      %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
> @@ -839,9 +840,14 @@ static const char *const multilib_defaul
>  #define GOMP_SELF_SPECS "%{fopenmp|ftree-parallelize-loops=*: -pthread}"
>  #endif
>  
> +/* Likewise for -fgnu-tm.  */
> +#ifndef GTM_SELF_SPECS
> +#define GTM_SELF_SPECS "%{fgnu-tm: -pthread}"
> +#endif
> +
>  static const char *const driver_self_specs[] = {
>    "%{fdump-final-insns:-fdump-final-insns=.} %<fdump-final-insns",
> -  DRIVER_SELF_SPECS, CONFIGURE_SPECS, GOMP_SELF_SPECS
> +  DRIVER_SELF_SPECS, CONFIGURE_SPECS, GOMP_SELF_SPECS, GTM_SELF_SPECS
>  };
>  
>  #ifndef OPTION_DEFAULT_SPECS
> Index: gcc/config/i386/cygwin.h
> ===================================================================
> --- gcc/config/i386/cygwin.h	(revision 183864)
> +++ gcc/config/i386/cygwin.h	(working copy)
> @@ -126,6 +126,8 @@ along with GCC; see the file COPYING3.
>     and the -pthread flag is not recognized.  */
>  #undef GOMP_SELF_SPECS
>  #define GOMP_SELF_SPECS ""
> +#undef GTM_SELF_SPECS
> +#define GTM_SELF_SPECS ""
>  
>  /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */
>  #if DWARF2_UNWIND_INFO
> Index: gcc/config/i386/mingw32.h
> ===================================================================
> --- gcc/config/i386/mingw32.h	(revision 183864)
> +++ gcc/config/i386/mingw32.h	(working copy)
> @@ -187,6 +187,8 @@ do {						         \
>  #undef GOMP_SELF_SPECS
>  #define GOMP_SELF_SPECS "%{fopenmp|ftree-parallelize-loops=*: " \
>  			"-mthreads -pthread}"
> +#undef GTM_SELF_SPECS
> +#define GTM_SELF_SPECS "%{fgnu-tm:-mthreads -pthread}"
>  
>  /* mingw32 atexit function is safe to use in shared libraries.  Use it
>     to register C++ static destructors.  */
> Index: gcc/config/darwin.h
> ===================================================================
> --- gcc/config/darwin.h	(revision 183864)
> +++ gcc/config/darwin.h	(working copy)
> @@ -915,6 +915,8 @@ void add_framework_path (char *);
>  
>  #undef GOMP_SELF_SPECS
>  #define GOMP_SELF_SPECS ""
> +#undef GTM_SELF_SPECS
> +#define GTM_SELF_SPECS ""
>  
>  /* Darwin disables section anchors by default.  
>     They should be enabled per arch where support exists in that arch.  */
> Index: libitm/configure.ac
> ===================================================================
> --- libitm/configure.ac	(revision 183864)
> +++ libitm/configure.ac	(working copy)
> @@ -268,7 +268,7 @@ else
>  fi
>  
>  # Set up the set of libraries that we need to link against for libitm.
> -# Note that the GOMP_SELF_SPEC in gcc.c will force -pthread for -fopenmp,
> +# Note that the GTM_SELF_SPECS in gcc.c will force -pthread for -fgnu-tm,
>  # which will force linkage against -lpthread (or equivalent for the system).
>  # That's not 100% ideal, but about the best we can do easily.
>  if test $enable_shared = yes; then
> Index: libitm/testsuite/lib/libitm.exp
> ===================================================================
> --- libitm/testsuite/lib/libitm.exp	(revision 183864)
> +++ libitm/testsuite/lib/libitm.exp	(working copy)
> @@ -140,7 +140,6 @@ proc libitm_init { args } {
>  	lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
>      }
>      lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
> -    lappend ALWAYS_CFLAGS "ldflags=-litm"
>  
>      # We use atomic operations in the testcases to validate results.
>      if { ([istarget i?86-*-*] || [istarget x86_64-*-*])


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