aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorJosh Conner <jconner@apple.com>2006-02-13 18:12:17 +0000
committerJosh Conner <jconner@gcc.gnu.org>2006-02-13 18:12:17 +0000
commit4c553323a6f4d90e48002ea23b7f779c106ad620 (patch)
tree6029d89fb50bcba47971911b85b26ad5671431a7 /gcc/varasm.c
parente98aa197b7f0810908fd4f8504fe87cb615eaeea (diff)
downloadgcc-4c553323a6f4d90e48002ea23b7f779c106ad620.zip
gcc-4c553323a6f4d90e48002ea23b7f779c106ad620.tar.gz
gcc-4c553323a6f4d90e48002ea23b7f779c106ad620.tar.bz2
re PR target/25376 (section attribute doesn't work on darwin)
PR target/25376 * varasm.c (function_section): Check for section name before calling select_section on targets that define USE_SELECT_SECTION_FOR_FUNCTIONS. On other targets, use unlikely_text_section instead of hot_function_section if first_function_block_is_cold. * gcc.dg/pr25376.c: New test. * gcc.c-torture/compile/pr23237.c: Only compile test -- don't assemble. * lib/target-supports.exp (check_named_sections_available): Only compile named-sections test -- don't assemble. From-SVN: r110917
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 68bd026..bddf1ad 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -440,9 +440,14 @@ function_section (tree decl)
reloc = 1;
#ifdef USE_SELECT_SECTION_FOR_FUNCTIONS
- return targetm.asm_out.select_section (decl, reloc, DECL_ALIGN (decl));
+ if (decl != NULL_TREE
+ && DECL_SECTION_NAME (decl) != NULL_TREE)
+ return reloc ? unlikely_text_section ()
+ : get_named_section (decl, NULL, 0);
+ else
+ return targetm.asm_out.select_section (decl, reloc, DECL_ALIGN (decl));
#else
- return hot_function_section (decl);
+ return reloc ? unlikely_text_section () : hot_function_section (decl);
#endif
}
@@ -450,9 +455,15 @@ section *
current_function_section (void)
{
#ifdef USE_SELECT_SECTION_FOR_FUNCTIONS
- return targetm.asm_out.select_section (current_function_decl,
- in_cold_section_p,
- DECL_ALIGN (current_function_decl));
+ if (current_function_decl != NULL_TREE
+ && DECL_SECTION_NAME (current_function_decl) != NULL_TREE)
+ return in_cold_section_p ? unlikely_text_section ()
+ : get_named_section (current_function_decl,
+ NULL, 0);
+ else
+ return targetm.asm_out.select_section (current_function_decl,
+ in_cold_section_p,
+ DECL_ALIGN (current_function_decl));
#else
return (in_cold_section_p
? unlikely_text_section ()