aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorJeff Law <law@gcc.gnu.org>1996-04-15 01:46:10 -0600
committerJeff Law <law@gcc.gnu.org>1996-04-15 01:46:10 -0600
commitcf4403481dd67ecec1f1faabd8492421d3680a76 (patch)
tree5ae566bfe100fa103dfabae70dc5d0eed68cc6b3 /gcc/varasm.c
parent7ca919b759bb26a3aadb085d6d514a3ecd672510 (diff)
downloadgcc-cf4403481dd67ecec1f1faabd8492421d3680a76.zip
gcc-cf4403481dd67ecec1f1faabd8492421d3680a76.tar.gz
gcc-cf4403481dd67ecec1f1faabd8492421d3680a76.tar.bz2
flags.h (flag_function_sections): Declare.
* flags.h (flag_function_sections): Declare. * toplev.c (flag_function_sections): Define. (compile_file): Add warnings when -ffunction-sections is used with -g, or profiling. Disable -ffunction-sections when profiling is used. Add warning when -ffunction-sections is used on a target that doesn't support it. * varasm.c (named_section): Make a copy of the section name in case the original is in temporary storage. (function_section): Set DECL_SECTION_NAME for each function if flag_function_sections is on and the target supports it. * dbxout.c (dbxout_function_end): New function. (dbxout_function): Call dbxout_function_end if using extensions and flag_function_sections is on. * sparc/sysv4.h (ASM_OUTPUT_SECTION_NAME): Prefix a function section's name with ".text%" when -ffunction-sections. From-SVN: r11774
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 9b83110..cc60f03 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -255,7 +255,8 @@ named_section (decl, name)
if (in_section != in_named || strcmp (name, in_named_name))
{
- in_named_name = name;
+ in_named_name = obstack_alloc (&permanent_obstack, strlen (name) + 1);
+ strcpy (in_named_name, name);
in_section = in_named;
#ifdef ASM_OUTPUT_SECTION_NAME
@@ -349,6 +350,29 @@ void
function_section (decl)
tree decl;
{
+
+#ifdef ASM_OUTPUT_SECTION_NAME
+ /* If we are placing functions into their own sections, and this
+ function doesn't already have a section specified, set it now. */
+ if (flag_function_sections
+ && decl != NULL_TREE
+ && DECL_SECTION_NAME (decl) == NULL_TREE)
+ {
+ int len;
+ char *string;
+
+ len = IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (decl)) + 1;
+ string = alloca (len);
+ strcpy (string, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
+
+ /* Strip off any encoding in fnname. */
+ STRIP_NAME_ENCODING (string, string);
+
+ /* Set DECL_SECTION_NAME. */
+ DECL_SECTION_NAME (decl) = build_string (len, string);
+ }
+#endif
+
if (decl != NULL_TREE
&& DECL_SECTION_NAME (decl) != NULL_TREE)
named_section (decl, (char *) 0);