From patchwork Mon Jan 23 13:11:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai Tietz X-Patchwork-Id: 137355 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 A7DB8B6FA4 for ; Tue, 24 Jan 2012 00:12:04 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1327929126; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=xaoM+7U9G9kFFI0Ve4RdTiVhDDo=; b=dtpPBI7mUC6N6uuoAbwL8lx3YkZt+Yll6gP3Wa3xJoJNaiRl1g/AFHjN6PO8bv Ko3MJsjGicQYb4oITq61LIQFd6EKMxxxy1/t3hIUXVHBRCF4VXv0hvFFYw2iDwj2 1V293YhGvf90zL8HSZabAUi2XGaT4Vc3MsmR89nOZCPrs= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=gp0gAhCgAfEUqK5o0EokwPoKW+EE9jr4MQQi53mWLYkt9ataebE6ZpvfVQyRas Za6iUyJL1gnUP6HML0Pq4z06Ij/lQETE60e/79vmCxlDgifNonLC3jWhU9j2AhZQ aqTxgHcHIjUZZa9HtENr9tIfDwVI8ziqpCqyheN+8H+Pc=; Received: (qmail 17399 invoked by alias); 23 Jan 2012 13:11:55 -0000 Received: (qmail 17178 invoked by uid 22791); 23 Jan 2012 13:11:53 -0000 X-SWARE-Spam-Status: No, hits=0.3 required=5.0 tests=AWL, BAYES_50, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-tul01m020-f175.google.com (HELO mail-tul01m020-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Jan 2012 13:11:40 +0000 Received: by obbuo9 with SMTP id uo9so3318781obb.20 for ; Mon, 23 Jan 2012 05:11:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.109.38 with SMTP id hp6mr7800419obb.64.1327324299545; Mon, 23 Jan 2012 05:11:39 -0800 (PST) Received: by 10.182.60.232 with HTTP; Mon, 23 Jan 2012 05:11:39 -0800 (PST) In-Reply-To: References: Date: Mon, 23 Jan 2012 14:11:39 +0100 Message-ID: Subject: Re: [patch PR 51900]: Fix PE's delegitimize_address functions From: Kai Tietz To: Richard Guenther Cc: GCC Patches , Richard Henderson , Dave Korn , Jakub Jelinek 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 So revised patch with removing dwarf2out.c changes and using default_binds_local_p_1 in i386_pe_binds_local_p. The dwarf2out change isn't anymore necessary. It seems that fix of PR/45682 fixed this issue, too. ChangeLog 2012-01-23 Kai Tietz PR target/51900 * config/i386/predicates.md (symbolic_operand): Allow UNSPEC_PCREL as PIC expression for lea. * config/i386/winnt.c (i386_pe_binds_local_p): Reworked. * config/i386/i386.c (ix86_delegitimize_address): Handle UNSPEC_PCREL for none-MEM, too. Tested for x86_64-w64-mingw, i686-w64-mingw32, and x86_64-unknown-linux-gnu. Ok for apply? Regards, Kai Index: config/i386/predicates.md =================================================================== --- config/i386/predicates.md (revision 183389) +++ config/i386/predicates.md (working copy) @@ -410,6 +410,7 @@ || (GET_CODE (op) == UNSPEC && (XINT (op, 1) == UNSPEC_GOT || XINT (op, 1) == UNSPEC_GOTOFF + || XINT (op, 1) == UNSPEC_PCREL || XINT (op, 1) == UNSPEC_GOTPCREL))) return true; if (GET_CODE (op) != PLUS Index: config/i386/winnt.c =================================================================== --- config/i386/winnt.c (revision 183389) +++ config/i386/winnt.c (working copy) @@ -350,21 +350,22 @@ SYMBOL_REF_FLAGS (symbol) = flags; } + bool i386_pe_binds_local_p (const_tree exp) { - /* PE does not do dynamic binding. Indeed, the only kind of - non-local reference comes from a dllimport'd symbol. */ if ((TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == FUNCTION_DECL) && DECL_DLLIMPORT_P (exp)) return false; - /* Or a weak one, now that they are supported. */ - if ((TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == FUNCTION_DECL) - && DECL_WEAK (exp)) - return false; - - return true; + /* External public symbols, which aren't weakref-s, + have local-binding for PE targets. */ + if (DECL_P (exp) + && !lookup_attribute ("weakref", DECL_ATTRIBUTES (exp)) + && TREE_PUBLIC (exp) + && DECL_EXTERNAL (exp)) + return true; + return default_binds_local_p_1 (exp, 0); } /* Also strip the fastcall prefix and stdcall suffix. */ Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 183389) +++ config/i386/i386.c (working copy) @@ -13231,10 +13231,10 @@ || GET_CODE (XEXP (x, 0)) != UNSPEC || (XINT (XEXP (x, 0), 1) != UNSPEC_GOTPCREL && XINT (XEXP (x, 0), 1) != UNSPEC_PCREL) - || !MEM_P (orig_x)) + || (!MEM_P (orig_x) && XINT (XEXP (x, 0), 1) != UNSPEC_PCREL)) return ix86_delegitimize_tls_address (orig_x); x = XVECEXP (XEXP (x, 0), 0, 0); - if (GET_MODE (orig_x) != GET_MODE (x)) + if (GET_MODE (orig_x) != GET_MODE (x) && MEM_P (orig_x)) { x = simplify_gen_subreg (GET_MODE (orig_x), x, GET_MODE (x), 0);