https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119737
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The problem is in gcn_hsa_declare_function_name.
This seems to fix the issue:
```
diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index d59e87bed46..2754f1feebd 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -6587,7 +6587,8 @@ gcn_hsa_declare_function_name (FILE *file, const char
*name,
if (avgpr % vgpr_block_size)
avgpr += vgpr_block_size - (avgpr % vgpr_block_size);
- fputs ("\t.rodata\n"
+ switch_to_section (readonly_data_section);
+ fputs (
"\t.p2align\t6\n"
"\t.amdhsa_kernel\t", file);
assemble_name (file, name);
@@ -6707,7 +6708,7 @@ gcn_hsa_declare_function_name (FILE *file, const char
*name,
fputs (" .end_amdgpu_metadata\n", file);
#endif
- fputs ("\t.text\n", file);
+ switch_to_section (current_function_section ());
fputs ("\t.align\t256\n", file);
fputs ("\t.type\t", file);
assemble_name (file, name);
```