From patchwork Tue Feb 12 16:11:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Huber X-Patchwork-Id: 219874 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 AAB5C2C0080 for ; Wed, 13 Feb 2013 03:11:56 +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=1361290318; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: From:To:Cc:Subject:Date:Message-Id:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=IwY43UWf9FQHyJRl080cGAly04I=; b=Jz2bNY44mcgx7FI +aj2vlbcDm+EG7DvAgmnd8QDusMDPg1zdt25VjTqfckwI+VzN5xg7qwVdulIjnbq +GLar+Lad0rksRme8xMANh4ugVvsYvwoD/uJU2bySSLC0DvpW9l4kTGPs3MDOKQl NGNmavOtbx9c+EeHGVF3MyDfJeYc= 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:Received:From:To:Cc:Subject:Date:Message-Id:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=l+V54k9wwFyJhCieyQWdQvdScs+u5BPVwCHgVN+H4bAZX+TeayR1xYXNaOP+vM Ok2J9FvMyioKSY3ye2qa7CyTczU+kTExmvXa9Wp+FRIcZOPd9siLazH3iSWXNEBp VE5csg/sK85WHN/6jvfuIjZfnmZ3+vW2ymMhbV0aByh34=; Received: (qmail 13501 invoked by alias); 12 Feb 2013 16:11:50 -0000 Received: (qmail 13487 invoked by uid 22791); 12 Feb 2013 16:11:48 -0000 X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL, BAYES_00, RDNS_DYNAMIC X-Spam-Check-By: sourceware.org Received: from host-82-135-62-35.customer.m-online.net (HELO mail.embedded-brains.de) (82.135.62.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Feb 2013 16:11:42 +0000 Received: by mail.embedded-brains.de (Postfix, from userid 65534) id 4A378652CFF; Tue, 12 Feb 2013 17:11:40 +0100 (CET) Received: from eb0024.eb.z (eb0024.eb.z [192.168.96.64]) by mail.embedded-brains.de (Postfix) with ESMTP id B67D3652CFA; Tue, 12 Feb 2013 17:11:39 +0100 (CET) From: Sebastian Huber To: gcc-patches@gcc.gnu.org Cc: Alan Modra , edmar@freescale.com, Sebastian Huber Subject: [PATCH] PR55033: Fix Date: Tue, 12 Feb 2013 17:11:37 +0100 Message-Id: <1360685497-24237-1-git-send-email-sebastian.huber@embedded-brains.de> 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 This patch from Alan Modra fixes a section type conflict error. See also http://gcc.gnu.org/ml/gcc-patches/2012-10/msg02172.html Test results on PowerPC without this patch: http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg01351.html Test results on PowerPC with this patch: http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg01371.html Test results for x86_64-unknown-linux-gnu with and without this patch: http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg01358.html http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg01376.html The patch has no impact on x86_64-unknown-linux-gnu test results. Alan Modra * varasm.c (default_elf_select_section): Move !DECL_P check.. (get_named_section): ..to here before calling get_section_name. Adjust assertion. (default_section_type_flags): Add DECL_P check. * config/i386/winnt.c (i386_pe_section_type_flags): Likewise. * config/rs6000/rs6000.c (rs6000_xcoff_section_type_flags): * Likewise. --- gcc/config/i386/winnt.c | 2 +- gcc/config/rs6000/rs6000.c | 2 +- gcc/varasm.c | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index 118b1ec..7e7c155 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -476,7 +476,7 @@ i386_pe_section_type_flags (tree decl, const char *name, int reloc) flags |= SECTION_PE_SHARED; } - if (decl && DECL_ONE_ONLY (decl)) + if (decl && DECL_P (decl) && DECL_ONE_ONLY (decl)) flags |= SECTION_LINKONCE; /* See if we already have an entry for this section. */ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index fbf57be..bf0cacb 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -25913,7 +25913,7 @@ rs6000_xcoff_section_type_flags (tree decl, const char *name, int reloc) unsigned int flags = default_section_type_flags (decl, name, reloc); /* Align to at least UNIT size. */ - if (flags & SECTION_CODE || !decl) + if ((flags & SECTION_CODE) != 0 || !decl || !DECL_P (decl)) align = MIN_UNITS_PER_WORD; else /* Increase alignment of large objects if not already stricter. */ diff --git a/gcc/varasm.c b/gcc/varasm.c index 6648103..ea709fd 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -402,12 +402,16 @@ get_named_section (tree decl, const char *name, int reloc) { unsigned int flags; - gcc_assert (!decl || DECL_P (decl)); if (name == NULL) - name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl)); + { + gcc_assert (decl && DECL_P (decl) && DECL_SECTION_NAME (decl)); + name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl)); + } flags = targetm.section_type_flags (decl, name, reloc); + if (decl && !DECL_P (decl)) + decl = NULL_TREE; return get_section (name, flags, decl); } @@ -5989,7 +5993,7 @@ default_section_type_flags (tree decl, const char *name, int reloc) flags |= SECTION_RELRO; } - if (decl && DECL_ONE_ONLY (decl)) + if (decl && DECL_P (decl) && DECL_ONE_ONLY (decl)) flags |= SECTION_LINKONCE; if (decl && TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl)) @@ -6348,8 +6352,6 @@ default_elf_select_section (tree decl, int reloc, gcc_unreachable (); } - if (!DECL_P (decl)) - decl = NULL_TREE; return get_named_section (decl, sname, reloc); }