===================================================================
@@ -7030,6 +7030,12 @@ if function is in @code{.text.name}, and
otherwise.
@end deftypefn
+@deftypevr {Target Hook} {const char *} TARGET_ASM_MERGEABLE_RODATA_PREFIX
+Usually, the compiler uses the prefix @code{".rodata"} to construct
+section names for mergeable constant data. Define this macro to override
+the string if a different section name should be used.
+@end deftypevr
+
@deftypefn {Target Hook} {section *} TARGET_ASM_SELECT_RTX_SECTION (enum machine_mode @var{mode}, rtx @var{x}, unsigned HOST_WIDE_INT @var{align})
Return the section into which a constant @var{x}, of mode @var{mode},
should be placed. You can assume that @var{x} is some kind of
===================================================================
@@ -6978,6 +6978,8 @@ if function is in @code{.text.name}, and
otherwise.
@end deftypefn
+@hook TARGET_ASM_MERGEABLE_RODATA_PREFIX
+
@hook TARGET_ASM_SELECT_RTX_SECTION
Return the section into which a constant @var{x}, of mode @var{mode},
should be placed. You can assume that @var{x} is some kind of
===================================================================
@@ -296,6 +296,15 @@ DEFHOOK
section *, (tree decl),
default_function_rodata_section)
+/* Nonnull if the target wants to override the default ".rodata" prefix
+ for mergeable data sections. */
+DEFHOOKPOD
+(mergeable_rodata_prefix,
+ "Usually, the compiler uses the prefix @code{\".rodata\"} to construct\n\
+section names for mergeable constant data. Define this macro to override\n\
+the string if a different section name should be used.",
+ const char *, ".rodata")
+
/* Output a constructor for a symbol with a given priority. */
DEFHOOK
(constructor,
===================================================================
@@ -737,7 +737,8 @@ mergeable_string_section (tree decl ATTR
const char *str;
HOST_WIDE_INT i;
int j, unit;
- char name[30];
+ const char *prefix = targetm.asm_out.mergeable_rodata_prefix;
+ char *name = (char *) alloca (strlen (prefix) + 30);
mode = TYPE_MODE (TREE_TYPE (TREE_TYPE (decl)));
modesize = GET_MODE_BITSIZE (mode);
@@ -761,8 +762,8 @@ mergeable_string_section (tree decl ATTR
}
if (i == len - unit)
{
- sprintf (name, ".rodata.str%d.%d", modesize / 8,
- (int) (align / 8));
+ sprintf (name, "%s.str%d.%d", prefix,
+ modesize / 8, (int) (align / 8));
flags |= (modesize / 8) | SECTION_MERGE | SECTION_STRINGS;
return get_section (name, flags, NULL);
}
@@ -789,9 +790,10 @@ mergeable_constant_section (enum machine
&& align <= 256
&& (align & (align - 1)) == 0)
{
- char name[24];
+ const char *prefix = targetm.asm_out.mergeable_rodata_prefix;
+ char *name = (char *) alloca (strlen (prefix) + 30);
- sprintf (name, ".rodata.cst%d", (int) (align / 8));
+ sprintf (name, "%s.cst%d", prefix, (int) (align / 8));
flags |= (align / 8) | SECTION_MERGE;
return get_section (name, flags, NULL);
}