[gccgo] Mark type descriptor decls as artificial

Message ID mcr7hhs2z9d.fsf@google.com
State New
Headers show

Commit Message

Ian Taylor Oct. 8, 2010, 8:41 p.m.
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.



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 @@ 
   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