* [libitm] Link with -litm and -pthread
@ 2012-02-11 14:17 Eric Botcazou
2012-02-11 17:55 ` Jack Howarth
` (4 more replies)
0 siblings, 5 replies; 23+ messages in thread
From: Eric Botcazou @ 2012-02-11 14:17 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 770 bytes --]
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?
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
[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 3818 bytes --]
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-*-*])
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-11 14:17 [libitm] Link with -litm and -pthread Eric Botcazou
@ 2012-02-11 17:55 ` Jack Howarth
2012-02-11 18:01 ` Eric Botcazou
2012-02-11 19:13 ` Iain Sandoe
` (3 subsequent siblings)
4 siblings, 1 reply; 23+ messages in thread
From: Jack Howarth @ 2012-02-11 17:55 UTC (permalink / raw)
To: Eric Botcazou; +Cc: gcc-patches
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-*-*])
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-11 17:55 ` Jack Howarth
@ 2012-02-11 18:01 ` Eric Botcazou
2012-02-11 18:07 ` Jack Howarth
2012-02-11 18:12 ` Jack Howarth
0 siblings, 2 replies; 23+ messages in thread
From: Eric Botcazou @ 2012-02-11 18:01 UTC (permalink / raw)
To: Jack Howarth; +Cc: gcc-patches
> This change causes massive failures at -m32/-m64 on x86_64-apple-darwin11
> in the libitm testsuite...
How did you test it?
--
Eric Botcazou
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-11 18:01 ` Eric Botcazou
@ 2012-02-11 18:07 ` Jack Howarth
2012-02-11 18:14 ` Eric Botcazou
2012-02-11 18:12 ` Jack Howarth
1 sibling, 1 reply; 23+ messages in thread
From: Jack Howarth @ 2012-02-11 18:07 UTC (permalink / raw)
To: Eric Botcazou; +Cc: gcc-patches
On Sat, Feb 11, 2012 at 06:54:05PM +0100, Eric Botcazou wrote:
> > This change causes massive failures at -m32/-m64 on x86_64-apple-darwin11
> > in the libitm testsuite...
>
> How did you test it?
>
> --
> Eric Botcazou
Eric,
Applied to gcc trunk (r184130) along with the proposed fix for
Bug libitm/52042...
Index: libitm/alloc_cpp.cc
===================================================================
--- libitm/alloc_cpp.cc (revision 183968)
+++ libitm/alloc_cpp.cc (working copy)
@@ -60,7 +60,7 @@ extern void _ZdlPvRKSt9nothrow_t (void *, c_nothro
extern void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) __attribute__((weak));
extern void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) __attribute__((weak));
-#if !defined (HAVE_ELF_STYLE_WEAKREF)
+#if !defined (HAVE_ELF_STYLE_WEAKREF) && !defined (__MACH__)
void *_ZnwX (size_t) { return NULL; }
void _ZdlPv (void *) { return; }
void *_ZnaX (size_t) { return NULL; }
Index: libitm/eh_cpp.cc
===================================================================
--- libitm/eh_cpp.cc (revision 183968)
+++ libitm/eh_cpp.cc (working copy)
@@ -39,7 +39,7 @@ extern void *__cxa_begin_catch (void *) WEAK;
extern void *__cxa_end_catch (void) WEAK;
extern void __cxa_tm_cleanup (void *, void *, unsigned int) WEAK;
-#if !defined (HAVE_ELF_STYLE_WEAKREF)
+#if !defined (HAVE_ELF_STYLE_WEAKREF) && !defined (__MACH__)
void *__cxa_allocate_exception (size_t) { return NULL; }
void __cxa_throw (void *, void *, void *) { return; }
void *__cxa_begin_catch (void *) { return NULL; }
Index: libgcc/config/darwin-crt-tm.c
===================================================================
--- libgcc/config/darwin-crt-tm.c (revision 183968)
+++ libgcc/config/darwin-crt-tm.c (working copy)
@@ -23,33 +23,68 @@ a copy of the GCC Runtime Library Exception along
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include "tsystem.h"
+#include <stddef.h>
+#include <dlfcn.h>
#include <mach-o/dyld.h>
+#include <mach-o/getsect.h>
-/* not listed in mach-o/dyld.h for some reason. */
-extern char * getsectdata (const char*,const char*,unsigned long*);
+#ifdef __LP64__
+#define GET_DATA_TMCT(mh,size) \
+ getsectdatafromheader_64 ((struct mach_header_64*) mh, \
+ "__DATA", "__tm_clone_table", (uint64_t *)size)
+#else
+#define GET_DATA_TMCT(mh,size) \
+ getsectdatafromheader (mh, "__DATA", "__tm_clone_table", (uint32_t *)size)
+#endif
#define WEAK __attribute__((weak))
+#define UNUSED __attribute__((unused))
extern void _ITM_registerTMCloneTable (void *, size_t) WEAK;
extern void _ITM_deregisterTMCloneTable (void *) WEAK;
+#if defined(START) || defined(END)
+static inline void *getTMCloneTable (const void *f, size_t *tmct_siz)
+{
+ char *tmct_fixed, *tmct = NULL;
+ unsigned int i, img_count;
+ struct mach_header *mh;
+ Dl_info info;
+
+ if (! dladdr (f, &info) || info.dli_fbase == NULL)
+ abort ();
+
+ mh = (struct mach_header *) info.dli_fbase;
+ tmct_fixed = GET_DATA_TMCT (mh, tmct_siz);
+ *tmct_siz /= (sizeof (size_t) * 2);
+ /* No tm_clone_table or no clones. */
+ if (tmct_fixed == NULL || *tmct_siz == 0)
+ return NULL;
+
+ img_count = _dyld_image_count();
+ for (i = 0; i < img_count && tmct == NULL; i++)
+ {
+ if (mh == _dyld_get_image_header(i))
+ tmct = tmct_fixed + (unsigned long)_dyld_get_image_vmaddr_slide(i);
+ }
+
+ return tmct;
+}
+#endif
+
#ifdef START
void __doTMRegistrations (void) __attribute__ ((constructor));
void __doTMRegistrations (void)
{
- char * tm_clone_table_sect_data;
- unsigned long tmct_siz;
-
- tm_clone_table_sect_data = getsectdata ("__DATA",
- "__tm_clone_table",
- &tmct_siz);
- tmct_siz /= (sizeof (size_t) * 2);
- if (_ITM_registerTMCloneTable != NULL
- && tm_clone_table_sect_data != NULL
- && tmct_siz > 0)
- _ITM_registerTMCloneTable (tm_clone_table_sect_data, (size_t)tmct_siz);
+ size_t tmct_siz;
+ void *tmct;
+
+ tmct = getTMCloneTable ((const void *)&__doTMRegistrations, &tmct_siz);
+ if (_ITM_registerTMCloneTable != NULL && tmct != NULL)
+ _ITM_registerTMCloneTable (tmct, (size_t)tmct_siz);
}
#endif
@@ -60,18 +95,53 @@ void __doTMdeRegistrations (void) __attribute__ ((
void __doTMdeRegistrations (void)
{
- char * tm_clone_table_sect_data;
- unsigned long tmct_siz;
-
- tm_clone_table_sect_data = getsectdata ("__DATA",
- "__tm_clone_table",
- &tmct_siz);
-
- if (_ITM_deregisterTMCloneTable != NULL
- && tm_clone_table_sect_data != NULL
- && tmct_siz > 0)
- _ITM_deregisterTMCloneTable (tm_clone_table_sect_data);
+ size_t tmct_siz;
+ void *tmct;
+ tmct = getTMCloneTable ((const void *)&__doTMdeRegistrations, &tmct_siz);
+ if (_ITM_deregisterTMCloneTable != NULL && tmct != NULL)
+ _ITM_deregisterTMCloneTable (tmct);
}
+/* Provide dummy functions to satisfy linkage for versions of the Darwin tool-chain that
+ that can't handle undefined weak refs at the link stage. */
+
+extern void *__cxa_allocate_exception (size_t) WEAK;
+extern void __cxa_throw (void *, void *, void *) WEAK;
+extern void *__cxa_begin_catch (void *) WEAK;
+extern void *__cxa_end_catch (void) WEAK;
+extern void __cxa_tm_cleanup (void *, void *, unsigned int) WEAK;
+
+void *__cxa_allocate_exception (size_t s UNUSED) { return NULL; }
+void __cxa_throw (void * a UNUSED, void * b UNUSED, void * c UNUSED)
+{ return; }
+void *__cxa_begin_catch (void * a UNUSED) { return NULL; }
+void *__cxa_end_catch (void) { return NULL; }
+void __cxa_tm_cleanup (void * a UNUSED, void * b UNUSED, unsigned int c UNUSED)
+{ return; }
+
+extern void *_ZnwX (size_t) WEAK;
+extern void _ZdlPv (void *) WEAK;
+extern void *_ZnaX (size_t) WEAK;
+extern void _ZdaPv (void *) WEAK;
+
+typedef const struct nothrow_t { } *c_nothrow_p;
+
+extern void *_ZnwXRKSt9nothrow_t (size_t, c_nothrow_p) WEAK;
+extern void _ZdlPvRKSt9nothrow_t (void *, c_nothrow_p) WEAK;
+extern void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) WEAK;
+extern void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) WEAK;
+
+void *_ZnwX (size_t s UNUSED) { return NULL; }
+void _ZdlPv (void * a UNUSED) { return; }
+void *_ZnaX (size_t s UNUSED) { return NULL; }
+void _ZdaPv (void * a UNUSED) { return; }
+
+void *_ZnwXRKSt9nothrow_t (size_t s UNUSED, c_nothrow_p b UNUSED)
+ { return NULL; }
+void _ZdlPvRKSt9nothrow_t (void * a UNUSED, c_nothrow_p b UNUSED) { return; }
+void *_ZnaXRKSt9nothrow_t (size_t s UNUSED, c_nothrow_p b UNUSED)
+ { return NULL; }
+void _ZdaPvRKSt9nothrow_t (void * a UNUSED, c_nothrow_p b UNUSED) { return; }
+
#endif
built as...
Using built-in specs.
COLLECT_GCC=gcc-fsf-4.7
COLLECT_LTO_WRAPPER=/sw/lib/gcc4.7/libexec/gcc/x86_64-apple-darwin11.3.0/4.7.0/lto-wrapper
Target: x86_64-apple-darwin11.3.0
Configured with: ../gcc-4.7-20120211/configure --prefix=/sw --prefix=/sw/lib/gcc4.7 --mandir=/sw/share/man --infodir=/sw/lib/gcc4.7/info --with-build-config=bootstrap-lto --enable-stage1-languages=c,lto --enable-languages=c,c++,fortran,lto,objc,obj-c++,java --with-gmp=/sw --with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --program-suffix=-fsf-4.7 --enable-checking=release --enable-cloog-backend=isl
Thread model: posix
gcc version 4.7.0 20120211 (experimental) (GCC)
then...
cd darwin_objdir/x86_64-apple-darwin11.3.0/libitm
make -k check RUNTESTFLAGS="--target_board=unix'{-m32,-m64}'"
which is exactly how I have been testing Patrick Marlier proposed patch.
Jack
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-11 18:01 ` Eric Botcazou
2012-02-11 18:07 ` Jack Howarth
@ 2012-02-11 18:12 ` Jack Howarth
2012-02-11 18:16 ` Eric Botcazou
1 sibling, 1 reply; 23+ messages in thread
From: Jack Howarth @ 2012-02-11 18:12 UTC (permalink / raw)
To: Eric Botcazou; +Cc: gcc-patches
On Sat, Feb 11, 2012 at 06:54:05PM +0100, Eric Botcazou wrote:
> > This change causes massive failures at -m32/-m64 on x86_64-apple-darwin11
> > in the libitm testsuite...
>
> How did you test it?
>
> --
> Eric Botcazou
Eric,
FYI, if I restore -litm to the linkage of the failing tests, they compile
and run fine. I don't understand why we think -litm can be dropped from linking
the tests in the libitm testsuite.
Jack
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-11 18:07 ` Jack Howarth
@ 2012-02-11 18:14 ` Eric Botcazou
2012-02-11 19:24 ` Jack Howarth
0 siblings, 1 reply; 23+ messages in thread
From: Eric Botcazou @ 2012-02-11 18:14 UTC (permalink / raw)
To: Jack Howarth; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 349 bytes --]
> Applied to gcc trunk (r184130) along with the proposed fix for
> Bug libitm/52042...
OK, I missed the hardcoded(!) spec in config/darwin.h for libgomp, so I guess
we need the same thing for libitm. Revised patch attached.
* config/darwin.h (LINK_COMMAND_SPEC_A): Deal with -fgnu-tm.
(GTM_SELF_SPECS): Define.
--
Eric Botcazou
[-- Attachment #2: p2.diff --]
[-- Type: text/x-diff, Size: 4296 bytes --]
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)
@@ -183,6 +183,8 @@ extern GTY(()) int darwin_ms_struct;
%{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
%{fopenmp|ftree-parallelize-loops=*: \
%{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \
+ %{fgnu-tm: \
+ %{static|static-libgcc|static-libstdc++|static-libgfortran: libitm.a%s; : -litm } } \
%{!nostdlib:%{!nodefaultlibs:\
%(link_ssp) %(link_gcc_c_sequence)\
}}\
@@ -915,6 +917,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-*-*])
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-11 18:12 ` Jack Howarth
@ 2012-02-11 18:16 ` Eric Botcazou
0 siblings, 0 replies; 23+ messages in thread
From: Eric Botcazou @ 2012-02-11 18:16 UTC (permalink / raw)
To: Jack Howarth; +Cc: gcc-patches
> FYI, if I restore -litm to the linkage of the failing tests, they
> compile and run fine. I don't understand why we think -litm can be dropped
> from linking the tests in the libitm testsuite.
Because -fgnu-tm will automatically add it on the link line, like for -fopenmp.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-11 14:17 [libitm] Link with -litm and -pthread Eric Botcazou
2012-02-11 17:55 ` Jack Howarth
@ 2012-02-11 19:13 ` Iain Sandoe
2012-02-13 21:43 ` Richard Henderson
` (2 subsequent siblings)
4 siblings, 0 replies; 23+ messages in thread
From: Iain Sandoe @ 2012-02-11 19:13 UTC (permalink / raw)
To: Eric Botcazou; +Cc: GCC Patches, Jack Howarth
Hi Eric,
On 11 Feb 2012, at 14:14, 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?
>
>
> 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
> <p.diff>
very little time - about to go out..
... but I suspect
LINK_COMMAND_SPEC_A in config/darwin.h ... which will need the:
+ %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
however, that's a very quick look.
Iain
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-11 18:14 ` Eric Botcazou
@ 2012-02-11 19:24 ` Jack Howarth
2012-02-11 19:33 ` Eric Botcazou
0 siblings, 1 reply; 23+ messages in thread
From: Jack Howarth @ 2012-02-11 19:24 UTC (permalink / raw)
To: Eric Botcazou; +Cc: gcc-patches
On Sat, Feb 11, 2012 at 07:11:11PM +0100, Eric Botcazou wrote:
> > Applied to gcc trunk (r184130) along with the proposed fix for
> > Bug libitm/52042...
>
> OK, I missed the hardcoded(!) spec in config/darwin.h for libgomp, so I guess
> we need the same thing for libitm. Revised patch attached.
>
>
> * config/darwin.h (LINK_COMMAND_SPEC_A): Deal with -fgnu-tm.
> (GTM_SELF_SPECS): Define.
>
>
> --
> Eric Botcazou
Eric,
I missed the regeneration of libitm/configure the first time. The p2.diff
with the regenerated libitm/configure passes make check in libitm now on
x86_64-apple-darwin11...
Native configuration is x86_64-apple-darwin11.3.0
=== libitm tests ===
Running target unix/-m32
=== libitm Summary for unix/-m32 ===
# of expected passes 26
# of expected failures 3
# of unsupported tests 1
Running target unix/-m64
=== libitm Summary for unix/-m64 ===
# of expected passes 26
# of expected failures 3
# of unsupported tests 1
=== libitm Summary ===
# of expected passes 52
# of expected failures 6
# of unsupported tests 2
Compiler version: gcc libitm
Platform: x86_64-apple-darwin11.3.0
configure flags: --prefix=/sw --prefix=/sw/lib/gcc4.7 --mandir=/sw/share/man --infodir=/sw/lib/gcc4.7/info --with-build-config=bootstrap-lto --enable-stage1-languages=c,lto --enable-languages=c,c++,fortran,lto,objc,obj-c++,java --with-gmp=/sw --with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --program-suffix=-fsf-4.7 --enable-checking=release --enable-cloog-backend=isl
The addition of support for static libitm in the second version of the patch while
probably non-essential is a good idea.
Jack
ps I'll do a full regression test for p2.diff and will post the results to gcc-testresults.
> 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)
> @@ -183,6 +183,8 @@ extern GTY(()) int darwin_ms_struct;
> %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
> %{fopenmp|ftree-parallelize-loops=*: \
> %{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \
> + %{fgnu-tm: \
> + %{static|static-libgcc|static-libstdc++|static-libgfortran: libitm.a%s; : -litm } } \
> %{!nostdlib:%{!nodefaultlibs:\
> %(link_ssp) %(link_gcc_c_sequence)\
> }}\
> @@ -915,6 +917,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-*-*])
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-11 19:24 ` Jack Howarth
@ 2012-02-11 19:33 ` Eric Botcazou
2012-02-12 18:24 ` Jack Howarth
2012-02-15 14:34 ` Greta Yorsh
0 siblings, 2 replies; 23+ messages in thread
From: Eric Botcazou @ 2012-02-11 19:33 UTC (permalink / raw)
To: Jack Howarth; +Cc: gcc-patches
> I missed the regeneration of libitm/configure the first time. The
> p2.diff with the regenerated libitm/configure passes make check in libitm
> now on x86_64-apple-darwin11...
Great, thanks for the testing.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-11 19:33 ` Eric Botcazou
@ 2012-02-12 18:24 ` Jack Howarth
2012-02-15 14:34 ` Greta Yorsh
1 sibling, 0 replies; 23+ messages in thread
From: Jack Howarth @ 2012-02-12 18:24 UTC (permalink / raw)
To: Eric Botcazou; +Cc: gcc-patches
On Sat, Feb 11, 2012 at 08:23:45PM +0100, Eric Botcazou wrote:
> > I missed the regeneration of libitm/configure the first time. The
> > p2.diff with the regenerated libitm/configure passes make check in libitm
> > now on x86_64-apple-darwin11...
>
> Great, thanks for the testing.
Eric,
The full regression tests show no new failures on x86_64-apple-darwin11...
http://gcc.gnu.org/ml/gcc-testresults/2012-02/msg01063.html
Jack
>
> --
> Eric Botcazou
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-11 14:17 [libitm] Link with -litm and -pthread Eric Botcazou
2012-02-11 17:55 ` Jack Howarth
2012-02-11 19:13 ` Iain Sandoe
@ 2012-02-13 21:43 ` Richard Henderson
2012-02-14 2:41 ` Hans-Peter Nilsson
2012-02-14 16:24 ` [libitm] Link with -litm and -pthread Andreas Krebbel
4 siblings, 0 replies; 23+ messages in thread
From: Richard Henderson @ 2012-02-13 21:43 UTC (permalink / raw)
To: Eric Botcazou; +Cc: gcc-patches
On 02/11/2012 06:14 AM, Eric Botcazou wrote:
> 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.
Ok with the darwin followup-patch.
r~
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-11 14:17 [libitm] Link with -litm and -pthread Eric Botcazou
` (2 preceding siblings ...)
2012-02-13 21:43 ` Richard Henderson
@ 2012-02-14 2:41 ` Hans-Peter Nilsson
2012-02-14 8:39 ` Eric Botcazou
2012-02-14 21:39 ` Fix testsuite regressions with -fgnu-tm Hans-Peter Nilsson
2012-02-14 16:24 ` [libitm] Link with -litm and -pthread Andreas Krebbel
4 siblings, 2 replies; 23+ messages in thread
From: Hans-Peter Nilsson @ 2012-02-14 2:41 UTC (permalink / raw)
To: Eric Botcazou; +Cc: gcc-patches
On Sat, 11 Feb 2012, 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.
It broke all targets that don't implement threads and as such
don't support -pthread. And you need to gate *all* tm-related
tests on something like check_effective_target_pthread.
I see regress-155 for cris-elf.
Can't you just limit adding -pthread to Solaris 8 or something?
brgds, H-P
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-14 2:41 ` Hans-Peter Nilsson
@ 2012-02-14 8:39 ` Eric Botcazou
2012-02-14 12:26 ` Hans-Peter Nilsson
2012-02-14 21:39 ` Fix testsuite regressions with -fgnu-tm Hans-Peter Nilsson
1 sibling, 1 reply; 23+ messages in thread
From: Eric Botcazou @ 2012-02-14 8:39 UTC (permalink / raw)
To: Hans-Peter Nilsson; +Cc: gcc-patches
> It broke all targets that don't implement threads and as such
> don't support -pthread. And you need to gate *all* tm-related
> tests on something like check_effective_target_pthread.
The question is, how is libitm supposed to work on these systems? The
configure.ac file contains:
# Check to see if -pthread or -lpthread is needed. Prefer the former.
# In case the pthread.h system header is not found, this test will fail.
XPCFLAGS=""
CFLAGS="$CFLAGS -pthread"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include <pthread.h>
void *g(void *d) { return NULL; }],
[pthread_t t; pthread_create(&t,NULL,g,NULL);])],
[XPCFLAGS=" -Wc,-pthread"],
[CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include <pthread.h>
void *g(void *d) { return NULL; }],
[pthread_t t; pthread_create(&t,NULL,g,NULL);])],
[],
[AC_MSG_ERROR([Pthreads are required to build libitm])])])
> Can't you just limit adding -pthread to Solaris 8 or something?
I didn't invent anything here, this is exactly how -fopenmp/libgomp works.
Just define GTM_SELF_SPECS to "" like Darwin and Windows.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-14 8:39 ` Eric Botcazou
@ 2012-02-14 12:26 ` Hans-Peter Nilsson
0 siblings, 0 replies; 23+ messages in thread
From: Hans-Peter Nilsson @ 2012-02-14 12:26 UTC (permalink / raw)
To: Eric Botcazou; +Cc: gcc-patches
On Tue, 14 Feb 2012, Eric Botcazou wrote:
> > It broke all targets that don't implement threads and as such
> > don't support -pthread. And you need to gate *all* tm-related
> > tests on something like check_effective_target_pthread.
>
> The question is, how is libitm supposed to work on these systems?
I didn't think about that before since whatever was there
compiled and the tests passed, but right, that's a clue.
> The
> configure.ac file contains:
Which is incidental, because configure.tgt already declares
non-support and I get:
checking for libitm support... no
Hm, so it seems an oversight in the framework that tm is
enabled for such systems?
> Just define GTM_SELF_SPECS to "" like Darwin and Windows.
That seems to imply that *every* such system should define
GTM_SELF_SPECS (and should have been part of your recent
changes). But on a second look it seems best to follow the lead
of -fopenmp which implies instead that all tm tests should be
gated on a new check_effective_target_fgnu-tm. Your ball.
brgds, H-P
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-11 14:17 [libitm] Link with -litm and -pthread Eric Botcazou
` (3 preceding siblings ...)
2012-02-14 2:41 ` Hans-Peter Nilsson
@ 2012-02-14 16:24 ` Andreas Krebbel
2012-02-14 16:28 ` Iain Sandoe
2012-02-14 23:41 ` Eric Botcazou
4 siblings, 2 replies; 23+ messages in thread
From: Andreas Krebbel @ 2012-02-14 16:24 UTC (permalink / raw)
To: Eric Botcazou; +Cc: gcc-patches
On 02/11/2012 03:14 PM, 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?
>
>
> 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.
Hi,
I see several new fails on s390x with that patch (r184174):
> FAIL: gcc.dg/lto/trans-mem-1 c_lto_trans-mem-1_0.o-c_lto_trans-mem-1_1.o link, -flto
-fgnu-tm
> UNRESOLVED: gcc.dg/lto/trans-mem-1 c_lto_trans-mem-1_0.o-c_lto_trans-mem-1_1.o execute
-flto -fgnu-tm
> FAIL: gcc.dg/lto/trans-mem-2 c_lto_trans-mem-2_0.o-c_lto_trans-mem-2_1.o link, -flto
-fgnu-tm
> UNRESOLVED: gcc.dg/lto/trans-mem-2 c_lto_trans-mem-2_0.o-c_lto_trans-mem-2_1.o execute
-flto -fgnu-tm
> FAIL: gcc.dg/lto/trans-mem-4 c_lto_trans-mem-4_0.o-c_lto_trans-mem-4_1.o link, -flto
-fgnu-tm
> UNRESOLVED: gcc.dg/lto/trans-mem-4 c_lto_trans-mem-4_0.o-c_lto_trans-mem-4_1.o execute
-flto -fgnu-tm
Executing on host: /home/andreas/patched/gcc-head-build/gcc/xgcc
-B/home/andreas/patched/gcc-head-build/gcc/ c_lto_trans-mem-2_0.o c_lto_trans-mem-2_1.o
-flto -fgnu-tm -o gcc-dg-lto-trans-mem-2-01.exe (timeout = 300)
xgcc: error: libitm.spec: No such file or directory^M
compiler exited with status 1
Bye,
-Andreas-
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-14 16:24 ` [libitm] Link with -litm and -pthread Andreas Krebbel
@ 2012-02-14 16:28 ` Iain Sandoe
2012-02-14 23:41 ` Eric Botcazou
1 sibling, 0 replies; 23+ messages in thread
From: Iain Sandoe @ 2012-02-14 16:28 UTC (permalink / raw)
To: Andreas Krebbel; +Cc: Eric Botcazou, gcc-patches
On 14 Feb 2012, at 16:08, Andreas Krebbel wrote:
> On 02/11/2012 03:14 PM, 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?
>>
>>
>> 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.
>
> Hi,
>
> I see several new fails on s390x with that patch (r184174):
>
>> FAIL: gcc.dg/lto/trans-mem-1 c_lto_trans-mem-1_0.o-c_lto_trans-
>> mem-1_1.o link, -flto
> -fgnu-tm
>> UNRESOLVED: gcc.dg/lto/trans-mem-1 c_lto_trans-mem-1_0.o-
>> c_lto_trans-mem-1_1.o execute
> -flto -fgnu-tm
>> FAIL: gcc.dg/lto/trans-mem-2 c_lto_trans-mem-2_0.o-c_lto_trans-
>> mem-2_1.o link, -flto
> -fgnu-tm
>> UNRESOLVED: gcc.dg/lto/trans-mem-2 c_lto_trans-mem-2_0.o-
>> c_lto_trans-mem-2_1.o execute
> -flto -fgnu-tm
>> FAIL: gcc.dg/lto/trans-mem-4 c_lto_trans-mem-4_0.o-c_lto_trans-
>> mem-4_1.o link, -flto
> -fgnu-tm
>> UNRESOLVED: gcc.dg/lto/trans-mem-4 c_lto_trans-mem-4_0.o-
>> c_lto_trans-mem-4_1.o execute
> -flto -fgnu-tm
>
>
> Executing on host: /home/andreas/patched/gcc-head-build/gcc/xgcc
> -B/home/andreas/patched/gcc-head-build/gcc/ c_lto_trans-mem-2_0.o
> c_lto_trans-mem-2_1.o
> -flto -fgnu-tm -o gcc-dg-lto-trans-mem-2-01.exe (timeout =
> 300)
> xgcc: error: libitm.spec: No such file or directory^M
... any .exp causing use of the libitm spec will need to arrange for -
B /path/to/libitm/build to be appended to the options?
^ permalink raw reply [flat|nested] 23+ messages in thread
* Fix testsuite regressions with -fgnu-tm
2012-02-14 2:41 ` Hans-Peter Nilsson
2012-02-14 8:39 ` Eric Botcazou
@ 2012-02-14 21:39 ` Hans-Peter Nilsson
2012-02-14 22:08 ` Richard Henderson
2012-02-14 23:17 ` Eric Botcazou
1 sibling, 2 replies; 23+ messages in thread
From: Hans-Peter Nilsson @ 2012-02-14 21:39 UTC (permalink / raw)
To: ebotcazou; +Cc: gcc-patches
> From: Hans-Peter Nilsson <hp@bitrange.com>
> Date: Tue, 14 Feb 2012 03:30:44 +0100
> you need to gate *all* tm-related
> tests on something like check_effective_target_pthread.
Like this, tested cris-elf, fixes the regressions, does the same
as -fopenmp.
Ok?
gcc/testsuite:
* lib/target-supports.exp (check_effective_target_fgnu_tm): New
proc.
* gfortran.dg/trans-mem-skel.f90: Gate test on effective_target
fgnu_tm.
* gcc.dg/lto/trans-mem-1_0.c, gcc.dg/lto/trans-mem-2_0.c,
gcc.dg/lto/trans-mem-3_0.c, gcc.dg/lto/trans-mem-4_0.c: Ditto.
* gcc.dg/tm/tm.exp: Gate the whole of gcc.dg/tm on
effective_target fgnu_tm.
* g++.dg/tm/tm.exp: Ditto for g++.dg/tm.
Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp (revision 184203)
+++ lib/target-supports.exp (working copy)
@@ -716,6 +716,15 @@ proc check_effective_target_fopenmp {} {
} "-fopenmp"]
}
+# Return 1 if compilation with -fgnu-tm is error-free for trivial
+# code, 0 otherwise.
+
+proc check_effective_target_fgnu_tm {} {
+ return [check_no_compiler_messages fgnu_tm object {
+ void foo (void) { }
+ } "-fgnu-tm"]
+}
+
# Return 1 if the target supports mmap, 0 otherwise.
proc check_effective_target_mmap {} {
Index: gfortran.dg/trans-mem-skel.f90
===================================================================
--- gfortran.dg/trans-mem-skel.f90 (revision 184203)
+++ gfortran.dg/trans-mem-skel.f90 (working copy)
@@ -1,5 +1,6 @@
! { dg-do compile }
! { dg-options "-fgnu-tm" }
+! { dg-require-effective-target fgnu_tm }
program foo
real x
end program foo
Index: gcc.dg/lto/trans-mem-2_0.c
===================================================================
--- gcc.dg/lto/trans-mem-2_0.c (revision 184203)
+++ gcc.dg/lto/trans-mem-2_0.c (working copy)
@@ -1,6 +1,7 @@
/* { dg-lto-options {{-flto -fgnu-tm}} } */
/* { dg-lto-do link } */
/* { dg-require-effective-target stdint_types } */
+/* { dg-require-effective-target fgnu_tm } */
#include "trans-mem.h"
Index: gcc.dg/lto/trans-mem-4_0.c
===================================================================
--- gcc.dg/lto/trans-mem-4_0.c (revision 184203)
+++ gcc.dg/lto/trans-mem-4_0.c (working copy)
@@ -1,6 +1,7 @@
/* { dg-lto-options {{-flto -fgnu-tm}} } */
/* { dg-lto-do link } */
/* { dg-require-effective-target stdint_types } */
+/* { dg-require-effective-target fgnu_tm } */
extern void foo() __attribute__((transaction_safe));
Index: gcc.dg/lto/trans-mem-1_0.c
===================================================================
--- gcc.dg/lto/trans-mem-1_0.c (revision 184203)
+++ gcc.dg/lto/trans-mem-1_0.c (working copy)
@@ -1,6 +1,7 @@
/* { dg-lto-options {{-flto -fgnu-tm}} } */
/* { dg-lto-do link } */
/* { dg-require-effective-target stdint_types } */
+/* { dg-require-effective-target fgnu_tm } */
int i;
Index: gcc.dg/lto/trans-mem-3_0.c
===================================================================
--- gcc.dg/lto/trans-mem-3_0.c (revision 184203)
+++ gcc.dg/lto/trans-mem-3_0.c (working copy)
@@ -1,6 +1,7 @@
/* { dg-lto-options {{-flto}} } */
/* { dg-lto-do link } */
/* { dg-require-effective-target stdint_types } */
+/* { dg-require-effective-target fgnu_tm } */
/* Test that we can build one object file with -fgnu-tm
(trans-mem-3_1.c), but do the final link of all objects without
Index: gcc.dg/tm/tm.exp
===================================================================
--- gcc.dg/tm/tm.exp (revision 184203)
+++ gcc.dg/tm/tm.exp (working copy)
@@ -19,6 +19,10 @@
# Load support procs.
load_lib gcc-dg.exp
+if ![check_effective_target_fgnu_tm] {
+ return
+}
+
# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then {
Index: g++.dg/tm/tm.exp
===================================================================
--- g++.dg/tm/tm.exp (revision 184203)
+++ g++.dg/tm/tm.exp (working copy)
@@ -19,6 +19,10 @@
# Load support procs.
load_lib g++-dg.exp
+if ![check_effective_target_fgnu_tm] {
+ return
+}
+
# If a testcase doesn't have special options, use these.
global DEFAULT_CXXFLAGS
if ![info exists DEFAULT_CXXFLAGS] then {
brgds, H-P
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Fix testsuite regressions with -fgnu-tm
2012-02-14 21:39 ` Fix testsuite regressions with -fgnu-tm Hans-Peter Nilsson
@ 2012-02-14 22:08 ` Richard Henderson
2012-02-14 23:17 ` Eric Botcazou
1 sibling, 0 replies; 23+ messages in thread
From: Richard Henderson @ 2012-02-14 22:08 UTC (permalink / raw)
To: Hans-Peter Nilsson; +Cc: ebotcazou, gcc-patches
On 02/14/2012 01:10 PM, Hans-Peter Nilsson wrote:
> Like this, tested cris-elf, fixes the regressions, does the same
> as -fopenmp.
>
> Ok?
>
> gcc/testsuite:
>
> * lib/target-supports.exp (check_effective_target_fgnu_tm): New
> proc.
> * gfortran.dg/trans-mem-skel.f90: Gate test on effective_target
> fgnu_tm.
> * gcc.dg/lto/trans-mem-1_0.c, gcc.dg/lto/trans-mem-2_0.c,
> gcc.dg/lto/trans-mem-3_0.c, gcc.dg/lto/trans-mem-4_0.c: Ditto.
> * gcc.dg/tm/tm.exp: Gate the whole of gcc.dg/tm on
> effective_target fgnu_tm.
> * g++.dg/tm/tm.exp: Ditto for g++.dg/tm.
Ok.
r~
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Fix testsuite regressions with -fgnu-tm
2012-02-14 21:39 ` Fix testsuite regressions with -fgnu-tm Hans-Peter Nilsson
2012-02-14 22:08 ` Richard Henderson
@ 2012-02-14 23:17 ` Eric Botcazou
1 sibling, 0 replies; 23+ messages in thread
From: Eric Botcazou @ 2012-02-14 23:17 UTC (permalink / raw)
To: Hans-Peter Nilsson; +Cc: gcc-patches
> Like this, tested cris-elf, fixes the regressions, does the same
> as -fopenmp.
Thanks for fixing this.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-14 16:24 ` [libitm] Link with -litm and -pthread Andreas Krebbel
2012-02-14 16:28 ` Iain Sandoe
@ 2012-02-14 23:41 ` Eric Botcazou
2012-02-17 18:46 ` Andreas Krebbel
1 sibling, 1 reply; 23+ messages in thread
From: Eric Botcazou @ 2012-02-14 23:41 UTC (permalink / raw)
To: Andreas Krebbel; +Cc: gcc-patches
> I see several new fails on s390x with that patch (r184174):
People should realize that -fgnu-tm doesn't really work if libitm hasn't been
ported to the architecture, for example s390/s390x. My understanding is that
Hans-Peter's patch should have taken care of this now.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: [libitm] Link with -litm and -pthread
2012-02-11 19:33 ` Eric Botcazou
2012-02-12 18:24 ` Jack Howarth
@ 2012-02-15 14:34 ` Greta Yorsh
1 sibling, 0 replies; 23+ messages in thread
From: Greta Yorsh @ 2012-02-15 14:34 UTC (permalink / raw)
To: 'Eric Botcazou', Jack Howarth; +Cc: gcc-patches
This patch causes all tm tests to fail on arm-none-eabi target that doesn't
support -pthread command line option:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52259
> -----Original Message-----
> From: Eric Botcazou [mailto:ebotcazou@adacore.com]
> Sent: 11 February 2012 19:24
> To: Jack Howarth
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [libitm] Link with -litm and -pthread
>
> > I missed the regeneration of libitm/configure the first time. The
> > p2.diff with the regenerated libitm/configure passes make check in
> libitm
> > now on x86_64-apple-darwin11...
>
> Great, thanks for the testing.
>
> --
> Eric Botcazou
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [libitm] Link with -litm and -pthread
2012-02-14 23:41 ` Eric Botcazou
@ 2012-02-17 18:46 ` Andreas Krebbel
0 siblings, 0 replies; 23+ messages in thread
From: Andreas Krebbel @ 2012-02-17 18:46 UTC (permalink / raw)
To: Eric Botcazou; +Cc: gcc-patches
On 02/14/2012 11:58 PM, Eric Botcazou wrote:
>> I see several new fails on s390x with that patch (r184174):
>
> People should realize that -fgnu-tm doesn't really work if libitm hasn't been
> ported to the architecture, for example s390/s390x. My understanding is that
> Hans-Peter's patch should have taken care of this now.
>
Sure I'm very well aware that -fgnu-tm cannot work on s390 since we do not have libitm
support yet. So I think the option should simply *not* be used by the testsuite.
However, it still fails with r184339.
The dg-require check does not seem to work properly. Since it only affects the lto tm
testcases perhaps the lib/lto.exp magic dealing with the _0 and _1 files doesn't handle it
properly?!
Bye,
-Andreas-
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2012-02-17 17:55 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-11 14:17 [libitm] Link with -litm and -pthread Eric Botcazou
2012-02-11 17:55 ` Jack Howarth
2012-02-11 18:01 ` Eric Botcazou
2012-02-11 18:07 ` Jack Howarth
2012-02-11 18:14 ` Eric Botcazou
2012-02-11 19:24 ` Jack Howarth
2012-02-11 19:33 ` Eric Botcazou
2012-02-12 18:24 ` Jack Howarth
2012-02-15 14:34 ` Greta Yorsh
2012-02-11 18:12 ` Jack Howarth
2012-02-11 18:16 ` Eric Botcazou
2012-02-11 19:13 ` Iain Sandoe
2012-02-13 21:43 ` Richard Henderson
2012-02-14 2:41 ` Hans-Peter Nilsson
2012-02-14 8:39 ` Eric Botcazou
2012-02-14 12:26 ` Hans-Peter Nilsson
2012-02-14 21:39 ` Fix testsuite regressions with -fgnu-tm Hans-Peter Nilsson
2012-02-14 22:08 ` Richard Henderson
2012-02-14 23:17 ` Eric Botcazou
2012-02-14 16:24 ` [libitm] Link with -litm and -pthread Andreas Krebbel
2012-02-14 16:28 ` Iain Sandoe
2012-02-14 23:41 ` Eric Botcazou
2012-02-17 18:46 ` Andreas Krebbel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).