diff options
author | Iain Sandoe <iains@gcc.gnu.org> | 2011-01-07 13:57:45 +0000 |
---|---|---|
committer | Iain Sandoe <iains@gcc.gnu.org> | 2011-01-07 13:57:45 +0000 |
commit | 14d11d4097091e8abaa63866f8cc0903f581c82a (patch) | |
tree | cf51df2cf5cae2810e51692d844e2d9afa6b187f /gcc/config/darwin.c | |
parent | 0b764288f97fbb0f33b42c66ebffc061ba59cb7d (diff) | |
download | gcc-14d11d4097091e8abaa63866f8cc0903f581c82a.zip gcc-14d11d4097091e8abaa63866f8cc0903f581c82a.tar.gz gcc-14d11d4097091e8abaa63866f8cc0903f581c82a.tar.bz2 |
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.
From-SVN: r168571
Diffstat (limited to 'gcc/config/darwin.c')
-rw-r--r-- | gcc/config/darwin.c | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index d9185db..5560bf9 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" |