From patchwork Tue Nov 2 16:20:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 69906 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 1A5071007D4 for ; Wed, 3 Nov 2010 03:20:38 +1100 (EST) Received: (qmail 32652 invoked by alias); 2 Nov 2010 16:20:29 -0000 Received: (qmail 32616 invoked by uid 22791); 2 Nov 2010 16:20:27 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD 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; Tue, 02 Nov 2010 16:20:22 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id DA490DAB; Tue, 2 Nov 2010 17:20:19 +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 VOfllncBNo0Z; Tue, 2 Nov 2010 17:20:17 +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 90074DAA; Tue, 2 Nov 2010 17:20:17 +0100 (CET) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id oA2GKHQl000702; Tue, 2 Nov 2010 17:20:17 +0100 (MET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org Subject: Re: [v3] Link libstdc++.so with -pthread on Tru64 UNIX (PR target/45693) References: Date: Tue, 02 Nov 2010 17:20:17 +0100 In-Reply-To: (Rainer Orth's message of "Thu, 28 Oct 2010 16:41:59 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (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 Rainer Orth writes: > As indicated in the PR, all C++ EH tests on Tru64 UNIX were failing > since TLS (emutls in this case) was enabled by an unrelated patch. The > problem is the same as in PR PR target/46131: emutls relies on a couple > of libpthread functions. While there are dummy implementations in > libgcc, of course we need the real thing here. The proper solution is > to link libstdc++.so with -pthread here (instead of, e.g., linking with > -lpthread in g++), so EH doesn't always work, even if linked with > another driver or in a mixed-language problem. Manual testing indicated > that this fixes the problem as expected. alpha-dec-osf5.1b testing in > progress, will commit once completed successfully. While the idea was sound, actual testing revealed two problems: * The osf* case also needs to set os_include_dir. * Cannot use -pthread in OPT_LDFLAGS: libtool swallows that, -Wl,-pthread doesn't work (it's not a linker option), and -Wc,-pthread doesn't work either (seems to be ignored with -shared), so I had to fall back to using -lpthread instead. This fixed all the EH related C++ failures. Installed. Rainer 2010-10-28 Rainer Orth PR target/45693 * configure.host (osf*): Set os_include_dir to os/generic. Add -lpthread to OPT_LDFLAGS. diff -r 3048db040dd6 libstdc++-v3/configure.host --- a/libstdc++-v3/configure.host Fri Oct 29 17:12:46 2010 +0000 +++ b/libstdc++-v3/configure.host Sat Oct 30 11:43:36 2010 +0200 @@ -261,6 +261,13 @@ netbsd*) os_include_dir="os/bsd/netbsd" ;; + osf*) + os_include_dir="os/generic" + # libstdc++.so relies on emutls on Tru64 UNIX, which only works with the + # real functions implemented in libpthread.so, not with the dummies in + # libgcc, so always pass -lpthread. + OPT_LDFLAGS="${OPT_LDFLAGS} -lpthread" + ;; qnx6.[12]*) os_include_dir="os/qnx/qnx6.1" c_model=c