aix: only create named section for VAR_DECL or FUNCTION_DECL
authorDavid Edelsohn <dje.gcc@gmail.com>
Fri, 10 Jul 2020 21:06:21 +0000 (17:06 -0400)
committerDavid Edelsohn <dje.gcc@gmail.com>
Fri, 10 Jul 2020 21:39:53 +0000 (17:39 -0400)
get_constant_section() can be passed constant-like non-DECLs, such as
CONSTRUCTOR or STRING_CST, which make DECL_SECTION_NAME unhappy
(asserted in symtab_node::get).  This patch ensures that xcoff select
section only invokes resolve_unique_section() for DECLs.

gcc/ChangeLog

2020-07-10  David Edelsohn  <dje.gcc@gmail.com>

* config/rs6000/rs6000.c (rs6000_xcoff_select_section): Only
create named section for VAR_DECL or FUNCTION_DECL.

gcc/config/rs6000/rs6000.c

index 15af9b230e6e09e16955e5ae5ad92f890dd9416f..b42f0c5b33dd94df583126dad47f616ac99b233d 100644 (file)
@@ -20465,7 +20465,7 @@ rs6000_xcoff_select_section (tree decl, int reloc,
 {
   /* Place variables with alignment stricter than BIGGEST_ALIGNMENT into
      named section.  */
-  if (align > BIGGEST_ALIGNMENT)
+  if (align > BIGGEST_ALIGNMENT && VAR_OR_FUNCTION_DECL_P (decl))
     {
       resolve_unique_section (decl, reloc, true);
       if (IN_NAMED_SECTION (decl))