From patchwork Fri Oct 8 20:41:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [gccgo] Mark type descriptor decls as artificial From: Ian Taylor X-Patchwork-Id: 67282 Message-Id: To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Date: Fri, 08 Oct 2010 13:41:34 -0700 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