aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/darwin.c
diff options
context:
space:
mode:
authorIain Sandoe <iains@gcc.gnu.org>2011-01-07 13:57:45 +0000
committerIain Sandoe <iains@gcc.gnu.org>2011-01-07 13:57:45 +0000
commit3d55baf94f3fa6a0672f6a5d49c2627409e5219b (patch)
treecf51df2cf5cae2810e51692d844e2d9afa6b187f /gcc/config/darwin.c
parent274a60a350ec668a15140e36c13840b8af80180f (diff)
allow the target to label code fragments generated by partitioning.
* target.def (function_switched_text_sections): New Hook. * doc/tm.texi Regenerated. * doc/tm.texi.in (TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS) New. * final.c (default_function_switched_text_sections): New. (final_scan_insn): Call function_switched_text_sections when a mid-function section change occurs. * output.h (default_function_switched_text_sections): Declare. * config/darwin-protos.h (darwin_function_switched_text_sections) : Likewise. * config/darwin.c (darwin_function_switched_text_sections): New. * config/darwin.h (TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS) New. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@168571 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/darwin.c')
-rw-r--r--gcc/config/darwin.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index d9185dbeb76..5560bf913fb 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -2572,18 +2572,6 @@ darwin_override_options (void)
if (!global_options_set.x_dwarf_strict)
dwarf_strict = 1;
- /* FIXME: Darwin cannot support multiple function sections until (a) the new code
- atoms created have a proper start label and (b) there are suitable pubnames
- emitted. This applies to all current Darwin versions (OSX <= 10.6.5). */
- if (global_options.x_flag_reorder_blocks_and_partition)
- {
- inform (input_location,
- "-freorder-blocks-and-partition is currently disabled for this "
- "platform");
- flag_reorder_blocks_and_partition = 0;
- flag_reorder_blocks = 1;
- }
-
/* Do not allow unwind tables to be generated by default for m32.
fnon-call-exceptions will override this, regardless of what we do. */
if (generating_for_darwin_version < 10
@@ -2591,13 +2579,13 @@ darwin_override_options (void)
&& !TARGET_64BIT)
global_options.x_flag_asynchronous_unwind_tables = 0;
- /* Disable -freorder-blocks-and-partition when unwind tables are being emitted
- for Darwin < 10 (OSX 10.6).
- The strategy is, "Unless the User has specifically set/unset an unwind flag
- we will switch off -freorder-blocks-and-partition when unwind tables will be
- generated". If the User specifically sets flags... we assume (s)he knows
- why... */
- if (generating_for_darwin_version < 10
+ /* Disable -freorder-blocks-and-partition when unwind tables are being emitted
+ for Darwin < 10 (OSX 10.6).
+ The strategy is, "Unless the User has specifically set/unset an unwind flag
+ we will switch off -freorder-blocks-and-partition when unwind tables will be
+ generated". If the User specifically sets flags... we assume (s)he knows
+ why... */
+ if (generating_for_darwin_version < 9
&& global_options_set.x_flag_reorder_blocks_and_partition
&& ((global_options.x_flag_exceptions /* User, c++, java */
&& !global_options_set.x_flag_exceptions) /* User specified... */
@@ -2607,13 +2595,6 @@ darwin_override_options (void)
&& !global_options_set.x_flag_non_call_exceptions)
|| (global_options.x_flag_asynchronous_unwind_tables
&& !global_options_set.x_flag_asynchronous_unwind_tables)))
- {
- inform (input_location,
- "-freorder-blocks-and-partition does not work with exceptions "
- "on this architecture");
- flag_reorder_blocks_and_partition = 0;
- flag_reorder_blocks = 1;
- }
if (flag_mkernel || flag_apple_kext)
{
@@ -3066,4 +3047,21 @@ darwin_function_section (tree decl, enum node_frequency freq,
}
}
+/* When a function is partitioned between sections, we need to insert a label
+ at the start of each new chunk - so that it may become a valid 'atom' for
+ eh and debug purposes. Without this the linker will emit warnings if one
+ tries to add line location information (since the switched fragment will
+ be anonymous). */
+
+void
+darwin_function_switched_text_sections (FILE *fp, tree decl, bool new_is_cold)
+{
+ char buf[128];
+ snprintf (buf, 128, "%s%s",new_is_cold?"__cold_sect_of_":"__hot_sect_of_",
+ IDENTIFIER_POINTER (DECL_NAME (decl)));
+ /* Make sure we pick up all the relevant quotes etc. */
+ assemble_name_raw (fp, (const char *) buf);
+ fputs (":\n", fp);
+}
+
#include "gt-darwin.h"