As described in the PR, there are a couple of jit testsuite failures on
Solaris when using /bin/as.  The errors point to GC issues and indeed,
gcc/config/sol2.c lacked GTY markup.  This patch fixes that, following
what darwin.c does for machopic_indirections.  I confess I have no idea
why I had to change the code the way I did except for the fact that it
works.  While formally I don't need approval, it would be nice if
someone in the know could have a look.

Bootstrappedn without regressions on i386-pc-solaris2.11 and
sparc-sun-solaris2.11 with as and gas, with and without jit.

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2018-02-08  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        PR target/84379
        * config.gcc (*-*-solaris2*): Set target_gtfiles,
        cp_target_gtfiles.
        * config/sol2.c (comdat_entry): Mark as GTY((for_user)).
        (solaris_comdat_htab): Mark GTY.
        (solaris_elf_asm_comdat_section): Allocate solaris_comdat_htab
        with create_ggc.
        Allocate comdat_entry's with ggc_alloc.
        Include gt-sol2.h.

# HG changeset patch
# Parent  2c72579b3945b50373c09b9c93a37f00d94eee79
Fix Solaris gty handling  (PR target/84379)

diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -880,6 +880,7 @@ case ${target} in
   fi
   tm_p_file="${tm_p_file} sol2-protos.h"
   tmake_file="${tmake_file} t-sol2 t-slibgcc"
+  target_gtfiles="$target_gtfiles \$(srcdir)/config/sol2.c"
   c_target_objs="${c_target_objs} sol2-c.o"
   cxx_target_objs="${cxx_target_objs} sol2-c.o sol2-cxx.o"
   extra_objs="${extra_objs} sol2.o sol2-stubs.o"
diff --git a/gcc/config/sol2.c b/gcc/config/sol2.c
--- a/gcc/config/sol2.c
+++ b/gcc/config/sol2.c
@@ -163,7 +163,7 @@ solaris_assemble_visibility (tree decl, 
 
 /* Group section information entry stored in solaris_comdat_htab.  */
 
-typedef struct comdat_entry
+typedef struct GTY((for_user)) comdat_entry
 {
   const char *name;
   unsigned int flags;
@@ -173,11 +173,10 @@ typedef struct comdat_entry
 
 /* Helpers for maintaining solaris_comdat_htab.  */
 
-struct comdat_entry_hasher : nofree_ptr_hash <comdat_entry>
+struct comdat_entry_hasher : ggc_ptr_hash <comdat_entry>
 {
   static inline hashval_t hash (const comdat_entry *);
   static inline bool equal (const comdat_entry *, const comdat_entry *);
-  static inline void remove (comdat_entry *);
 };
 
 inline hashval_t
@@ -195,7 +194,7 @@ comdat_entry_hasher::equal (const comdat
 
 /* Hash table of group signature symbols.  */
 
-static hash_table<comdat_entry_hasher> *solaris_comdat_htab;
+static GTY (()) hash_table<comdat_entry_hasher> *solaris_comdat_htab;
 
 /* Output assembly to switch to COMDAT group section NAME with attributes
    FLAGS and group signature symbol DECL, using Sun as syntax.  */
@@ -237,14 +236,14 @@ solaris_elf_asm_comdat_section (const ch
      remember the signature symbols and emit those not marked
      TREE_SYMBOL_REFERENCED in solaris_file_end.  */
   if (!solaris_comdat_htab)
-    solaris_comdat_htab = new hash_table<comdat_entry_hasher> (37);
+    solaris_comdat_htab = hash_table<comdat_entry_hasher>::create_ggc (37);
 
   entry.sig = signature;
   slot = solaris_comdat_htab->find_slot (&entry, INSERT);
 
   if (*slot == NULL)
     {
-      *slot = XCNEW (comdat_entry);
+      *slot = ggc_alloc<comdat_entry> ();
       /* Remember fragmented section name.  */
       (*slot)->name = section;
       /* Emit as regular section, .group declaration has already been done.  */
@@ -299,3 +298,5 @@ solaris_override_options (void)
   if (!HAVE_LD_EH_FRAME_CIEV3 && !global_options_set.x_dwarf_version)
     dwarf_version = 2;
 }
+
+#include "gt-sol2.h"

Reply via email to