From patchwork Wed Jul 6 21:20:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 103579 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 2350AB6F69 for ; Thu, 7 Jul 2011 07:21:21 +1000 (EST) Received: (qmail 27566 invoked by alias); 6 Jul 2011 21:21:19 -0000 Received: (qmail 27556 invoked by uid 22791); 6 Jul 2011 21:21:18 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Jul 2011 21:20:55 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p66LKtBP008183 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 6 Jul 2011 17:20:55 -0400 Received: from [127.0.0.1] (ovpn-113-44.phx2.redhat.com [10.3.113.44]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p66LKs5q008895 for ; Wed, 6 Jul 2011 17:20:54 -0400 Message-ID: <4E14D1B6.7090408@redhat.com> Date: Wed, 06 Jul 2011 17:20:54 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/49568 (unneeded thunks emitted on xcoff target) 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 This issue was exposed by honza's change to how thunks are represented, but the underlying problem was that we weren't setting DECL_COMDAT on them properly. Tested that the bug is fixed with an alpha-dec-osf5.1b cross compiler, regression tested x86_64-pc-linux-gnu, applying to trunk. commit d8a77afc071a28ee411d484793b90aaf6959cc5f Author: Jason Merrill Date: Wed Jul 6 16:28:34 2011 -0400 PR c++/49568 * method.c (make_thunk, use_thunk): Copy DECL_COMDAT. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 9b9eb9a..d41a4dd 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -140,11 +140,12 @@ make_thunk (tree function, bool this_adjusting, THUNK_VIRTUAL_OFFSET (thunk) = virtual_offset; THUNK_ALIAS (thunk) = NULL_TREE; - /* The thunk itself is not a constructor or destructor, even if - the thing it is thunking to is. */ DECL_INTERFACE_KNOWN (thunk) = 1; DECL_NOT_REALLY_EXTERN (thunk) = 1; + DECL_COMDAT (thunk) = DECL_COMDAT (function); DECL_SAVED_FUNCTION_DATA (thunk) = NULL; + /* The thunk itself is not a constructor or destructor, even if + the thing it is thunking to is. */ DECL_DESTRUCTOR_P (thunk) = 0; DECL_CONSTRUCTOR_P (thunk) = 0; DECL_EXTERNAL (thunk) = 1; @@ -342,6 +343,7 @@ use_thunk (tree thunk_fndecl, bool emit_p) DECL_VISIBILITY (thunk_fndecl) = DECL_VISIBILITY (function); DECL_VISIBILITY_SPECIFIED (thunk_fndecl) = DECL_VISIBILITY_SPECIFIED (function); + DECL_COMDAT (thunk_fndecl) = DECL_COMDAT (function); if (DECL_ONE_ONLY (function) || DECL_WEAK (function)) make_decl_one_only (thunk_fndecl, cxx_comdat_group (thunk_fndecl));