From patchwork Thu Nov 10 16:42:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 124963 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 1D90C1007D1 for ; Fri, 11 Nov 2011 03:42:28 +1100 (EST) Received: (qmail 7016 invoked by alias); 10 Nov 2011 16:42:26 -0000 Received: (qmail 6999 invoked by uid 22791); 10 Nov 2011 16:42:24 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, TW_GJ, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 10 Nov 2011 16:42:09 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id C591DFD7; Thu, 10 Nov 2011 17:42:07 +0100 (CET) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ZYIuC-nfA-zE; Thu, 10 Nov 2011 17:42:03 +0100 (CET) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id AA378FD6; Thu, 10 Nov 2011 17:42:03 +0100 (CET) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.5+Sun/8.14.5/Submit) id pAAGg3B4009088; Thu, 10 Nov 2011 17:42:03 +0100 (MET) From: Rainer Orth To: Richard Henderson Cc: gcc-patches@gcc.gnu.org Subject: Status of libitm on Tru64 UNIX Date: Thu, 10 Nov 2011 17:42:03 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Just for fun, I gave libitm a try on alpha-dec-osf5.1b, too. Here's what I found: * config/alpha/sjlj.S needs trivial changes for the non-ELF/non-Linux platform. * Initially, all C tests were failing like this: 333619:./simple-1.exe: /sbin/loader: Error: libitm.so.0: symbol "_ZnamRKSt9nothrow_t" unresolved 333619:./simple-1.exe: /sbin/loader: Fatal Error: Load of "./simple-1.exe" failed: Unresolved symbol name This happens because the platform doesn't support weak definitions (i.e. an extern symbol declared weak working as if defined with a NULL value), you need to provide a dummy implementation instead. To check if it works, I'm testing __osf__ for now, but a test like the following can be used to construct a configure test: void weakdef (void) __attribute__ ((weak)); int main (void) { if (weakdef != 0) weakdef (); return 0; } It fails to link on osf. libgfortran/acinclude.m4 (LIBGFOR_GTHREAD_WEAK) has another test, but mostly uses a blacklist approach instead. With those changes, libitm.so built, but with loads of problems in the testsuite: * Most tests fail with an ICE: FAIL: libitm.c/cancel.c (internal compiler error) FAIL: libitm.c/cancel.c (test for excess errors) Excess errors: /vol/gcc/src/hg/trunk/local/libitm/testsuite/libitm.c/cancel.c:55:1: internal compiler error: in default_no_named_section, at varasm.c:6293 WARNING: libitm.c/cancel.c compilation failed to produce executable I couldn't determine where tm tries to use named sections (which are missing in ECOFF), since even gdb 7.3.1 SEGVs on cc1. This may be due to being compiled as C++. * All tests using need an explicit -pthread: FAIL: libitm.c/notx.c (test for excess errors) Excess errors: /var/gcc/regression/trunk/5.1b-gcc/build/gcc/include-fixed/pthread.h:1427:4: error: #error "Please compile the module including pthread.h with -pthread" WARNING: libitm.c/notx.c compilation failed to produce executable This patch adds this unconditionally. Even with those changes, I run into PR middle-end/50598, just as on Solaris 8. Rainer 2011-11-09 Rainer Orth libitm: * config/alpha/sjlj.S (_ITM_beginTransaction) [!__ELF__]: Don't use .hidden. (.note.GNU-stack): Only use if __linux__. * alloc_cpp.cc [!HAVE_WEAKDEF] (_ZnaXRKSt9nothrow_t): Dummy function. * testsuite/libitm.c/notx.c: Use dg-options "-pthread". * testsuite/libitm.c/reentrant.c: Likewise. * testsuite/libitm.c/simple-2.c: Likewise. * testsuite/libitm.c/txrelease.c: Likewise. * testsuite/libitm.c++/static_ctor.C: Likewise. diff --git a/libitm/alloc_cpp.cc b/libitm/alloc_cpp.cc --- a/libitm/alloc_cpp.cc +++ b/libitm/alloc_cpp.cc @@ -60,6 +60,14 @@ extern void _ZdlPvRKSt9nothrow_t (void * extern void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) __attribute__((weak)); extern void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) __attribute__((weak)); +#ifdef __osf__ /* Really: !HAVE_WEAKDEF */ +void * +_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) +{ + return NULL; +} +#endif /* __osf__ */ + /* Wrap the delete nothrow symbols for usage with a single argument. Perhaps should have a configure type check for this, because the std::nothrow_t reference argument is unused (empty class), and most diff --git a/libitm/config/alpha/sjlj.S b/libitm/config/alpha/sjlj.S --- a/libitm/config/alpha/sjlj.S +++ b/libitm/config/alpha/sjlj.S @@ -74,7 +74,9 @@ _ITM_beginTransaction: .align 4 .globl GTM_longjmp +#ifdef __ELF__ .hidden GTM_longjmp +#endif .ent GTM_longjmp GTM_longjmp: @@ -105,4 +107,6 @@ GTM_longjmp: ret .end GTM_longjmp +#ifdef __linux__ .section .note.GNU-stack, "", @progbits +#endif diff --git a/libitm/testsuite/libitm.c++/static_ctor.C b/libitm/testsuite/libitm.c++/static_ctor.C --- a/libitm/testsuite/libitm.c++/static_ctor.C +++ b/libitm/testsuite/libitm.c++/static_ctor.C @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-options "-pthread" } */ /* { dg-xfail-if "" { *-*-* } { "*" } { "" } } */ /* Tests static constructors inside of transactional code. */ diff --git a/libitm/testsuite/libitm.c/notx.c b/libitm/testsuite/libitm.c/notx.c --- a/libitm/testsuite/libitm.c/notx.c +++ b/libitm/testsuite/libitm.c/notx.c @@ -1,5 +1,8 @@ /* These tests all check whether initialization happens properly even if no transaction has been used in the current thread yet. */ + +/* { dg-options "-pthread" } */ + #include #include #include diff --git a/libitm/testsuite/libitm.c/reentrant.c b/libitm/testsuite/libitm.c/reentrant.c --- a/libitm/testsuite/libitm.c/reentrant.c +++ b/libitm/testsuite/libitm.c/reentrant.c @@ -1,4 +1,5 @@ /* { dg-do run { xfail *-*-* } } +/* { dg-options "-pthread" } */ /* Tests that new transactions can be started from both transaction_pure and transaction_unsafe code. This also requires proper handling of reentrant diff --git a/libitm/testsuite/libitm.c/simple-2.c b/libitm/testsuite/libitm.c/simple-2.c --- a/libitm/testsuite/libitm.c/simple-2.c +++ b/libitm/testsuite/libitm.c/simple-2.c @@ -1,5 +1,7 @@ /* Simplest test involving real threads. Verify we get the correct answer. */ +/* { dg-options "-pthread" } */ + #include #include diff --git a/libitm/testsuite/libitm.c/txrelease.c b/libitm/testsuite/libitm.c/txrelease.c --- a/libitm/testsuite/libitm.c/txrelease.c +++ b/libitm/testsuite/libitm.c/txrelease.c @@ -2,6 +2,8 @@ transaction data when a thread exists, potentially repeatedly. However, we currently cannot check whether the data has indeed been released. */ +/* { dg-options "-pthread" } */ + #include #include #include