> 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.
The net effect of the patch is to block GC for the DECLs registered by calls to solaris_elf_asm_comdat_section, that is to say, the mere fact of passing these DECLs to the function ensures that they will be kept. This obviously fixes the GC failures described in PR jit/84288. However, this also means that, even if the DECLs could otherwise be collected, they won't be anymore once they are passed to solaris_elf_asm_comdat_section. This may be the expected behavior or may be deemed good enough. However, you may want to implement a cache-like behavior instead, where the DECLs passed to solaris_elf_asm_comdat_section are not automatically kept, but instead only the slots of the hash table are kept if their associated DECL is. See the documentation of ggc_cache_remove in hash-table.h for further details. -- Eric Botcazou