From patchwork Thu Feb 19 21:04:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 441748 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C295A140145 for ; Fri, 20 Feb 2015 08:05:02 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=R0VKcOfGW/1Ss8SkzW sbjWyYSTFpyqJxTG8GLRZTcwuEbrKfoLSf1ZMfR+B3SE4QVJIAHSZI4kNX+UU9+o tlJiC4k8fxEX+QwFi15Mp2tSGKegiabwfaXneFf4bog27VYy+nFaWs//xBpQyTsV NHGOXKsqaPxkI9QJ5LinGS4Mk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=D3Cw7N5TlDsBXEic8XzNpB8K O3M=; b=A+yk5f/ZN2ZXzFo7B7vQnRP9dr/JGC1TVVzHvLIh+tk8tAB+S5UBahzx BMhKxJEeu7x0ngXViBL1cT3Hopxx2+nG052YBAW/HtiT+Vnq4P4uoIsggh5dhJ8B ifXc8UivcDFCA2MumWcZq1mYANlHQqQeXzUNAEastaR5T6X0KUM= Received: (qmail 12013 invoked by alias); 19 Feb 2015 21:04:55 -0000 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 Received: (qmail 12000 invoked by uid 89); 19 Feb 2015 21:04:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_FROM_URIBL_PCCC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-ob0-f173.google.com Received: from mail-ob0-f173.google.com (HELO mail-ob0-f173.google.com) (209.85.214.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 19 Feb 2015 21:04:53 +0000 Received: by mail-ob0-f173.google.com with SMTP id uy5so19540899obc.4 for ; Thu, 19 Feb 2015 13:04:51 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.202.178.131 with SMTP id b125mr4044412oif.80.1424379890968; Thu, 19 Feb 2015 13:04:50 -0800 (PST) Received: by 10.60.159.229 with HTTP; Thu, 19 Feb 2015 13:04:50 -0800 (PST) In-Reply-To: <54E21B33.8020905@redhat.com> References: <54E21B33.8020905@redhat.com> Date: Thu, 19 Feb 2015 22:04:50 +0100 Message-ID: Subject: Re: [PATCH] PR rtl-optimization/32219: optimizer causees wrong code in pic/hidden/weak symbol checking From: Uros Bizjak To: Richard Henderson Cc: "H.J. Lu" , "gcc-patches@gcc.gnu.org" On Mon, Feb 16, 2015 at 5:30 PM, Richard Henderson wrote: >>>> 2015-02-12 H.J. Lu >>>> Richard Henderson >>>> >>>> PR rtl/32219 >>>> * cgraphunit.c (cgraph_node::finalize_function): Set definition >>>> before notice_global_symbol. >>>> (varpool_node::finalize_decl): Likewise. >>>> * varasm.c (default_binds_local_p_2): Rename from >>>> default_binds_local_p_1, add weak_dominate argument. Use direct >>>> returns instead of assigning to local variable. Unify varpool and >>>> cgraph paths via symtab_node. Reject undef weak variables before >>>> testing visibility. Reorder tests for simplicity. >>>> (default_binds_local_p): Use default_binds_local_p_2. >>>> (default_binds_local_p_1): Likewise. >>>> (decl_binds_to_current_def_p): Unify varpool and cgraph paths >>>> via symtab_node. >>>> (default_elf_asm_output_external): Emit visibility when specified. >>> >>> It looks like this patch broke alphaev68-linux-gnu [1]. There are many >>> failures of the type: >>> >>> /tmp/cck7V7MR.o: In function >>> `__static_initialization_and_destruction_0(int, int)':^M >>> (.text+0x3ac): relocation truncated to fit: GPRELHIGH against symbol >>> `std::__cxx11::basic_string, >>> std::allocator >::~basic_string()@@GLIBCXX_3.4.21' defined in >>> .text section in >>> /space/uros/gcc-build/alphaev68-unknown-linux-gnu/./libstdc++-v3/src/.libs/libstdc++.so^M >>> /space/homedirs/uros/local/bin/ld: /tmp/cck7V7MR.o: gp-relative >>> relocation against dynamic symbol >> >> It could be related to: >> >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65064 >> >> Before this bug fix, all common symbols don't bind locally, >> which is one of PR 32219 bugs. After this fix, common >> symbols bind locally. It may cause problems on targets with >> small data sections and common symbols aren't in small >> data section: > > This is a destructor, and so obviously not a common symbol. > > I'll have a look. The attached patch fixes all alpha-linux-gnu failures. 2015-02-19 Uros Bizjak * config/alpha/alpha.c (alpha_in_small_data_p): Reject common symbols. Patch was bootstrapped and regression tested on alphaev68-linux-gnu. OK for mainline? Uros. Index: config/alpha/alpha.c =================================================================== --- config/alpha/alpha.c (revision 220806) +++ config/alpha/alpha.c (working copy) @@ -835,6 +835,10 @@ alpha_in_small_data_p (const_tree exp) if (TREE_CODE (exp) == FUNCTION_DECL) return false; + /* COMMON symbols are never small data. */ + if (TREE_CODE (exp) == VAR_DECL && DECL_COMMON (exp)) + return false; + if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp)) { const char *section = DECL_SECTION_NAME (exp);