From patchwork Fri Oct 8 20:41:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 67282 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 4CC08B70E2 for ; Sat, 9 Oct 2010 07:41:55 +1100 (EST) Received: (qmail 28732 invoked by alias); 8 Oct 2010 20:41:53 -0000 Received: (qmail 28715 invoked by uid 22791); 8 Oct 2010 20:41:52 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, TW_CC, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 Oct 2010 20:41:47 +0000 Received: from hpaq7.eem.corp.google.com (hpaq7.eem.corp.google.com [172.25.149.7]) by smtp-out.google.com with ESMTP id o98KfiTJ009846 for ; Fri, 8 Oct 2010 13:41:44 -0700 Received: from pwi10 (pwi10.prod.google.com [10.241.219.10]) by hpaq7.eem.corp.google.com with ESMTP id o98KfLe0030799 for ; Fri, 8 Oct 2010 13:41:43 -0700 Received: by pwi10 with SMTP id 10so708587pwi.15 for ; Fri, 08 Oct 2010 13:41:43 -0700 (PDT) Received: by 10.142.217.9 with SMTP id p9mr2491758wfg.296.1286570497892; Fri, 08 Oct 2010 13:41:37 -0700 (PDT) Received: from coign.google.com (adsl-71-133-8-30.dsl.pltn13.pacbell.net [71.133.8.30]) by mx.google.com with ESMTPS id x33sm4125398wfd.1.2010.10.08.13.41.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 08 Oct 2010 13:41:36 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: [gccgo] Mark type descriptor decls as artificial Date: Fri, 08 Oct 2010 13:41:34 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-System-Of-Record: true 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 marks Go type descriptors as artificial. I noticed this because they were being marked as STB_GNU_UNIQUE, and that was causing the version of glibc that I am using to not execute COPY relocs for them. I'm not really sure whether that is right or wrong, or possibly fixed in a later version, but it's certainly undesirable in this case. It doesn't happen for C++ type reflection structures because they are marked as artificial and gcc does not mark artificial read-only as STB_GNU_UNIQUE (see ASM_DECLARE_OBJECT_NAME in config/elfos.h). Go type descriptors should be marked as artificial anyhow, so this patch is correct and as a bonus fixes the problem with COPY relocs. I also added a #include in preparation for the merge with gcc mainline. Committed to gccgo branch. Ian diff -r 93e41ce440bb go/gogo-tree.cc --- a/go/gogo-tree.cc Fri Oct 08 13:35:50 2010 -0700 +++ b/go/gogo-tree.cc Fri Oct 08 13:37:07 2010 -0700 @@ -13,6 +13,7 @@ extern "C" { +#include "toplev.h" #include "tree.h" #include "gimple.h" #include "tree-iterator.h" @@ -3075,6 +3076,7 @@ TYPE_QUAL_CONST)); TREE_READONLY(decl) = 1; TREE_CONSTANT(decl) = 1; + DECL_ARTIFICIAL (decl) = 1; // Store the new decl now. This breaks a potential recursion in // which the length of an array calls the len function on another