From patchwork Fri Aug 2 18:26:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 264325 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 EAE332C007C for ; Sat, 3 Aug 2013 04:27:13 +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:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=QHVYCeC+pCz1tOyp4i9S8etaig8ItKs5S2u4PkcNZWiNbv7AO64wK AdavcGbz9Zw+kHi1JGcxe25CZJF385N35Sb3XlzOFvtqvBjEHFBj2CtXjlbwbE0i /iyMVorDhv1HtovaHGct9bT7ON59rLRi9OKazTT5TSv6FK8FKJUa70= 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:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=kV3n2ONBx3kffw38jzoFef9a46w=; b=eUOXahDRh8wjymHvmefW xCff7ikAqSrH6V1A741O/tEyF3OO/WPPvx9cDRrjANiqWdztUqDUm396D6dCnO9x zNpqUHZrh/pcVYw3VyeUDKtv8/nb1eQ2ZvAzb/d1LwNPEwWPGijSoVMCTvZIeoX6 mnMLkJzxJ2iMBhTchcBqG6Q= Received: (qmail 20190 invoked by alias); 2 Aug 2013 18:27:07 -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 20176 invoked by uid 89); 2 Aug 2013 18:27:07 -0000 X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RDNS_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS autolearn=no version=3.3.1 Received: from Unknown (HELO mail-qa0-f54.google.com) (209.85.216.54) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 02 Aug 2013 18:27:06 +0000 Received: by mail-qa0-f54.google.com with SMTP id bv4so490987qab.20 for ; Fri, 02 Aug 2013 11:26:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type:x-gm-message-state; bh=wcDznYYf0W+ZaqllpueHDtwcpVKxCSqWUrsOXqVZ6cE=; b=WDr1N3f55nydzWFDqw5LCRLtWGdgVaOt9FziwcQPJheJlbyhJTaLeCoRPejHMu8ZIE 9ZKAbTRK65wXFRbHNzUJPOdibeYfKCeWdbh1rsgeXdAMaYzsaIIClxlroPNH2yZaICcP w+oRoeaJzQzO2Wq6PrDjmAETUOQtwJqV2s5H0q22GA0ksIR4Cq0RsQ2Hytc8ZXw0p1ax Y5HjhXBkk6RAwox6ypEHc+w9XmsQu5WdpEgsYBjtBiQCzwFa1h2+/tXvGmyQzhn6hmAd ERXt4cRFz9HVo6K3dBWLnKoCyttI9wxky1YtYHzWCeGGCIdHOdBHJUofek/igYqDN7Nx n3xA== X-Received: by 10.224.61.129 with SMTP id t1mr12893344qah.112.1375468018419; Fri, 02 Aug 2013 11:26:58 -0700 (PDT) Received: from iant-glaptop.roam.corp.google.com.google.com ([2620:0:1000:3204:59ec:7807:b07d:925b]) by mx.google.com with ESMTPSA id m10sm2858836qae.12.2013.08.02.11.26.57 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 02 Aug 2013 11:26:57 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Always put immutable structs in unique section Date: Fri, 02 Aug 2013 11:26:55 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlGnHvmT04fAsDE1qPBk5rFWTUyfvKnW9G2hS5IeoQuPyEoQY0lFpWZ0T9AqhaJJYMg7Dd6TK6tpAAy7gFJ7r5Dy8mC25LhOq/YTsoBvdzLQA/RcQAz3VG+X42Smb/NFUOlA2Wodr6ua+DhG4kMpDiPkKXZqjSyWsXioQOfbf821s1/NRhjxHhbG0ZHRRTGNPeqWR5iNYZOQsWKFzm2y+81hrinjA== X-Virus-Found: No The Go backend interfaces uses immutable structs for things like type descriptors, map descriptors, and function descriptors. These objects must always be created for exported names in case they are referenced by a different package, but this often does not happen. This patch moves them to unique sections so that linker GC can discard them a link time. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline and 4.8 branch. Ian 2013-08-02 Ian Lance Taylor * go-gcc.cc (immutable_struct_set_init): Always call resolve_unique_section. Index: go-gcc.cc =================================================================== --- go-gcc.cc (revision 201222) +++ go-gcc.cc (working copy) @@ -1521,10 +1521,11 @@ Gcc_backend::immutable_struct_set_init(B TREE_PUBLIC(decl) = 1; } else - { - make_decl_one_only(decl, DECL_ASSEMBLER_NAME(decl)); - resolve_unique_section(decl, 1, 0); - } + make_decl_one_only(decl, DECL_ASSEMBLER_NAME(decl)); + + // These variables are often unneeded in the final program, so put + // them in their own section so that linker GC can discard them. + resolve_unique_section(decl, 1, 1); rest_of_decl_compilation(decl, 1, 0); }