From patchwork Mon Sep 27 20:29:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 65919 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 C1A1AB70EC for ; Tue, 28 Sep 2010 06:29:23 +1000 (EST) Received: (qmail 10834 invoked by alias); 27 Sep 2010 20:29:21 -0000 Received: (qmail 10823 invoked by uid 22791); 27 Sep 2010 20:29:21 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from g1t0029.austin.hp.com (HELO g1t0029.austin.hp.com) (15.216.28.36) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Sep 2010 20:29:16 +0000 Received: from g1t0038.austin.hp.com (g1t0038.austin.hp.com [16.236.32.44]) by g1t0029.austin.hp.com (Postfix) with ESMTP id 1EE2138206; Mon, 27 Sep 2010 20:29:15 +0000 (UTC) Received: from lucas.cup.hp.com (lucas.cup.hp.com [15.244.97.116]) by g1t0038.austin.hp.com (Postfix) with ESMTP id 8E0F630061; Mon, 27 Sep 2010 20:29:14 +0000 (UTC) Received: (from sje@localhost) by lucas.cup.hp.com (8.11.1 (PHNE_35485)/8.11.1) id o8RKTDM18735; Mon, 27 Sep 2010 13:29:13 -0700 (PDT) Date: Mon, 27 Sep 2010 13:29:13 -0700 (PDT) Message-Id: <201009272029.o8RKTDM18735@lucas.cup.hp.com> From: Steve Ellcey To: gcc-patches@gcc.gnu.org Cc: hubicka@ucw.cz, dave@hiauly1.hia.nrc.ca Subject: HPPA constructor merge patch, PR middle-end/45388 In-Reply-To: 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 A lot of C++ tests started failing on HPPA with r163443, the constructor merge patch. HPPA (in 32 bit mode) does not have .ctors and .dtors sections so it uses the collect2 magic name functionality to handle static constructors. In ipa.c at build_cdtor_fns the code says: /* Generate functions to call static constructors and destructors for targets that do not support .ctors/.dtors sections. These functions have magic names which are detected by collect2. */ The problem is that while build_cdtor turns off DECL_STATIC_CONSTRUCTOR (and DECL_STATIC_DESTRUCTOR) it does net set TREE_PUBLIC to 1 for these functions and it is TREE_PUBLIC that is used in ASM_DECLARE_FUNCTION_NAME to decide whether or not to make the constructor or destructor name externally visible. If it is not externally visible then collect2 will not find the names in order to set up the needed constructors. Tested on hppa2.0w-hp-hpux11.11 (32 bit mode) with no regressions. OK to checkin? Steve Ellcey sje@cup.hp.com 2010-09-27 Steve Ellcey PR middle-end/45388 * ipa.c: Set TREE_PUBLIC on constructors/destructors. Index: ipa.c =================================================================== --- ipa.c (revision 164643) +++ ipa.c (working copy) @@ -1477,6 +1477,7 @@ build_cdtor (bool ctor_p, VEC (tree, hea DECL_STATIC_CONSTRUCTOR (fn) = 0; else DECL_STATIC_DESTRUCTOR (fn) = 0; + TREE_PUBLIC (fn) = 1; /* We do not want to optimize away pure/const calls here. When optimizing, these should be already removed, when not optimizing, we want user to be able to breakpoint in them. */