From patchwork Fri Aug 23 07:08:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 269305 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 1ECE82C0090 for ; Fri, 23 Aug 2013 17:08:50 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=NIoUC432+I4U9zMJzMMW6K+q/Ibkv CJAj4a+TJpcpxpYsR6L82JK9cWUrxO3eNb1NCSBB1p9IcD9IrBmX/NDTgQkP4ulY pDJQ+bEzUaUeGPlGYHStt9qIHjCYi3vmQT/4Io82uyqzI2qoxx2JWnnS3mnUKEka YX/+cGxOj2BNFM= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=EkMsDvn3i9tS4yuVv3vhBrTgA6E=; b=jGA V+wlALam5+KHiYkNM9xHWLt9H555XamTuPvcssaj88slkGNEh9wtp/DKlm0rSThv 9l0LDfaDTAbJ8sxpchO7O5IsFovasrw+HBJKn/L5rCy5Cl0KwgkwPs5BgsYvbSvZ vShqRuqcdbciwlZcadqC5xsIzKnwc2b4WElW2zqE= Received: (qmail 27224 invoked by alias); 23 Aug 2013 07:08:43 -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 27208 invoked by uid 89); 23 Aug 2013 07:08:42 -0000 X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 23 Aug 2013 07:08:12 +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 r7N78Ath030632 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 23 Aug 2013 03:08:10 -0400 Received: from zalov.cz (vpn1-4-247.ams2.redhat.com [10.36.4.247]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r7N788h1022294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 23 Aug 2013 03:08:10 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.cz (8.14.5/8.14.5) with ESMTP id r7N7888r011639; Fri, 23 Aug 2013 09:08:08 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id r7N787YG011638; Fri, 23 Aug 2013 09:08:07 +0200 Date: Fri, 23 Aug 2013 09:08:07 +0200 From: Jakub Jelinek To: Uros Bizjak , Jan Hubicka , Richard Henderson Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix .lbss handling on x86-64 (PR target/58218) Message-ID: <20130823070807.GI1814@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi! On the following testcase we generate .section .lbss,"aw",@progbits which causes assembler warning, it is supposed to be .section .lbss,"aw",@nobits instead. The following patch fixes that. I went through all of default_section_type_flags and looked for which sections the default decision is based on section name and which sections have large data counterparts on x86-64 and I hope I've caught up all of them. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.8? 2013-08-23 Jakub Jelinek PR target/58218 * config/i386/x86-64.h (TARGET_SECTION_TYPE_FLAGS): Define. * config/i386/i386.c (x86_64_elf_section_type_flags): New function. * gcc.target/i386/pr58218.c: New test. Jakub --- gcc/config/i386/x86-64.h.jj 2013-04-25 23:47:56.000000000 +0200 +++ gcc/config/i386/x86-64.h 2013-08-22 20:15:12.197344591 +0200 @@ -103,3 +103,6 @@ see the files COPYING3 and COPYING.RUNTI #undef TARGET_ASM_UNIQUE_SECTION #define TARGET_ASM_UNIQUE_SECTION x86_64_elf_unique_section + +#undef TARGET_SECTION_TYPE_FLAGS +#define TARGET_SECTION_TYPE_FLAGS x86_64_elf_section_type_flags --- gcc/config/i386/i386.c.jj 2013-08-22 20:30:09.206333231 +0200 +++ gcc/config/i386/i386.c 2013-08-22 22:25:53.249919215 +0200 @@ -4912,6 +4912,31 @@ x86_64_elf_select_section (tree decl, in return default_elf_select_section (decl, reloc, align); } +/* Select a set of attributes for section NAME based on the properties + of DECL and whether or not RELOC indicates that DECL's initializer + might contain runtime relocations. */ + +static unsigned int x86_64_elf_section_type_flags (tree, const char *, int) + ATTRIBUTE_UNUSED; + +static unsigned int +x86_64_elf_section_type_flags (tree decl, const char *name, int reloc) +{ + unsigned int flags = default_section_type_flags (decl, name, reloc); + + if (decl == NULL_TREE + && (strcmp (name, ".ldata.rel.ro") == 0 + || strcmp (name, ".ldata.rel.ro.local") == 0)) + flags |= SECTION_RELRO; + + if (strcmp (name, ".lbss") == 0 + || strncmp (name, ".lbss.", 5) == 0 + || strncmp (name, ".gnu.linkonce.lb.", 16) == 0) + flags |= SECTION_BSS; + + return flags; +} + /* Build up a unique section name, expressed as a STRING_CST node, and assign it to DECL_SECTION_NAME (decl). RELOC indicates whether the initial value of EXP requires --- gcc/testsuite/gcc.target/i386/pr58218.c.jj 2013-08-22 20:26:56.827563563 +0200 +++ gcc/testsuite/gcc.target/i386/pr58218.c 2013-08-22 20:26:48.000000000 +0200 @@ -0,0 +1,5 @@ +/* PR target/58218 */ +/* { dg-do assemble { target lp64 } } */ +/* { dg-options "-mcmodel=medium" } */ + +struct { float x[16385]; } a = { { 0.f, } };