In varasm.c default_function_rodata_section():
section *
default_function_rodata_section (tree decl)
{
if (decl != NULL_TREE && DECL_SECTION_NAME (decl))
{
const char *name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
if (DECL_ONE_ONLY (decl) && HAVE_COMDAT_GROUP)
{
size_t len = strlen (name) + 3;
char* rname = (char *) alloca (len);
strcpy (rname, ".rodata");
strcat (rname, name + 5);
At this point, we haven't checked to see what the prefix of name is -
for example, it could be .gnu.* or .text.*. If the former, you end up
with sections like ".rodatalinkonce.t.*" which don't match the usual
.rodata.* linker script patterns.
Should we do something smarter here?