From patchwork Sat Feb 5 17:04:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 82009 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 54E09B7120 for ; Sun, 6 Feb 2011 04:04:39 +1100 (EST) Received: (qmail 23267 invoked by alias); 5 Feb 2011 17:04:35 -0000 Received: (qmail 23255 invoked by uid 22791); 5 Feb 2011 17:04:34 -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; Sat, 05 Feb 2011 17:04:27 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p15H4QIA022137 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 5 Feb 2011 12:04:26 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p15H4Pg5018289 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 5 Feb 2011 12:04:25 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id p15H4OF5027608; Sat, 5 Feb 2011 18:04:24 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p15H4Osc027606; Sat, 5 Feb 2011 18:04:24 +0100 Date: Sat, 5 Feb 2011 18:04:24 +0100 From: Jakub Jelinek To: Richard Henderson Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix a .data.rel.ro{, .local} section conflict issue (PR middle-end/47610) Message-ID: <20110205170424.GC30899@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 Hi! My recent PR31490 patch caused a regression on ppc and pa at least, where gcc started complaining about section type conflicts on .data.rel.ro{,.local} sections. The problem is if get_section is called both from default_elf_select_rtx_section where it is called with .data.rel.ro{,.local} section but NULL decl, and with a decl that belongs into the same section. default_section_type_flags would set SECTION_RELRO only if decl was non-NULL. Fixed by oring in SECTION_RELRO for those two explicit sections too. Bootstrapped/regtested on x86_64-linux and i686-linux, tested with a cross on the pa testcase. Ok for trunk? 2011-02-05 Jakub Jelinek PR middle-end/47610 * varasm.c (default_section_type_flags): If decl is NULL, and name is .data.rel.ro or .data.rel.ro.local, set SECTION_RELRO bit. Jakub --- gcc/varasm.c.jj 2011-02-03 20:09:38.000000000 +0100 +++ gcc/varasm.c 2011-02-05 00:01:59.911796344 +0100 @@ -6060,7 +6060,12 @@ default_section_type_flags (tree decl, c flags = SECTION_WRITE; } else - flags = SECTION_WRITE; + { + flags = SECTION_WRITE; + if (strcmp (name, ".data.rel.ro") == 0 + || strcmp (name, ".data.rel.ro.local") == 0) + flags |= SECTION_RELRO; + } if (decl && DECL_ONE_ONLY (decl)) flags |= SECTION_LINKONCE;