aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@codesourcery.com>2011-07-13 13:32:57 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2011-07-13 13:32:57 +0000
commit727a65e6fc07ea95309c875978c83c741359ad4e (patch)
treec27f9b1f6edf8bca3d95d41510094e498024b477
parentcb77b6cf1f6f16014d71213cba699d76c87ac2ef (diff)
downloadgcc-727a65e6fc07ea95309c875978c83c741359ad4e.zip
gcc-727a65e6fc07ea95309c875978c83c741359ad4e.tar.gz
gcc-727a65e6fc07ea95309c875978c83c741359ad4e.tar.bz2
tm.texi.in (TARGET_ASM_MERGEABLE_RODATA_PREFIX): Add hook.
* doc/tm.texi.in (TARGET_ASM_MERGEABLE_RODATA_PREFIX): Add hook. * doc/tm.texi: Regenerate. * target.def (mergeable_rodata_prefix: New defhookpod. * varasm.c (mergeable_string_section, mergeable_constant_section): Use it. Allocate name with alloca. From-SVN: r176235
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/doc/tm.texi6
-rw-r--r--gcc/doc/tm.texi.in2
-rw-r--r--gcc/target.def9
-rw-r--r--gcc/varasm.c12
5 files changed, 32 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8690a1d..7bb3a05 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2011-07-13 Bernd Schmidt <bernds@codesourcery.com>
+
+ * doc/tm.texi.in (TARGET_ASM_MERGEABLE_RODATA_PREFIX): Add hook.
+ * doc/tm.texi: Regenerate.
+ * target.def (mergeable_rodata_prefix: New defhookpod.
+ * varasm.c (mergeable_string_section, mergeable_constant_section):
+ Use it. Allocate name with alloca.
+
2011-07-13 H.J. Lu <hongjiu.lu@intel.com>
* doc/invoke.texi (x86): Remove -mfused-madd and add -mfma.
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index faf8b6c..08acb35 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -7050,6 +7050,12 @@ if function is in @code{.text.name}, and the normal readonly-data section
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
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index d823fae..7990c76 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -6984,6 +6984,8 @@ if function is in @code{.text.name}, and the normal readonly-data section
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
diff --git a/gcc/target.def b/gcc/target.def
index 9f03ac9..3a0b413 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -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,
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 045d619..8c65696 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -742,7 +742,8 @@ mergeable_string_section (tree decl ATTRIBUTE_UNUSED,
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);
@@ -766,8 +767,8 @@ mergeable_string_section (tree decl ATTRIBUTE_UNUSED,
}
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);
}
@@ -794,9 +795,10 @@ mergeable_constant_section (enum machine_mode mode ATTRIBUTE_UNUSED,
&& 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);
}