http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46916
--- Comment #32 from Iain Sandoe <iains at gcc dot gnu.org> 2010-12-14 17:16:39 UTC --- minor update (this removes a test for reorder & partition + exceptions that is carried out too early) Tests for reorder + exceptions and reorder + unwind are carried out in opts.c now. Index: gcc/opts.c =================================================================== --- gcc/opts.c (revision 167793) +++ gcc/opts.c (working copy) @@ -723,6 +723,9 @@ finish_options (struct gcc_options *opts, struct g opts->x_flag_reorder_blocks = 1; } + if (opts->x_flag_reorder_blocks_and_partition) + opts->x_flag_reorder_blocks = 1; + /* If user requested unwind info, then turn off the partitioning optimization. */ Index: gcc/config/darwin.c =================================================================== --- gcc/config/darwin.c (revision 167793) +++ gcc/config/darwin.c (working copy) @@ -1145,19 +1145,6 @@ darwin_mark_decl_preserved (const char *name) } static section * -darwin_text_section (int reloc, int weak) -{ - if (reloc) - return (weak - ? darwin_sections[text_unlikely_coal_section] - : unlikely_text_section ()); - else - return (weak - ? darwin_sections[text_coal_section] - : text_section); -} - -static section * darwin_rodata_section (int weak, bool zsize) { return (weak @@ -1267,17 +1254,7 @@ machopic_select_section (tree decl, switch (categorize_decl_for_section (decl, reloc)) { case SECCAT_TEXT: - { - struct cgraph_node *node; - if (decl && TREE_CODE (decl) == FUNCTION_DECL - && (node = cgraph_get_node (decl)) != NULL) - base_section = darwin_function_section (decl, - node->frequency, - node->only_called_at_startup, - node->only_called_at_exit); - if (!base_section) - base_section = darwin_text_section (reloc, weak); - } + gcc_unreachable (); break; case SECCAT_RODATA: @@ -2559,17 +2536,6 @@ darwin_override_options (void) if (!global_options_set.x_dwarf_strict) dwarf_strict = 1; - /* Disable -freorder-blocks-and-partition for darwin_emit_unwind_label. */ - if (flag_reorder_blocks_and_partition - && (targetm.asm_out.emit_unwind_label == darwin_emit_unwind_label)) - { - 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) { /* -mkernel implies -fapple-kext for C++ */ @@ -2969,7 +2935,10 @@ darwin_function_section (tree decl, enum node_freq bool startup, bool exit) { if (!flag_reorder_functions) - return NULL; + return (DECL_WEAK (decl) + ? darwin_sections[text_coal_section] + : text_section); + /* Startup code should go to startup subsection unless it is unlikely executed (this happens especially with function splitting where we can split away unnecesary parts of static constructors. */ @@ -2994,7 +2963,9 @@ darwin_function_section (tree decl, enum node_freq return get_named_text_section (decl, "__TEXT,__hot,regular,pure_instructions", "_hot"); default: - return NULL; + return (DECL_WEAK (decl) + ? darwin_sections[text_coal_section] + : text_section); } } Index: gcc/config/darwin.h =================================================================== --- gcc/config/darwin.h (revision 167793) +++ gcc/config/darwin.h (working copy) @@ -664,7 +664,7 @@ extern GTY(()) section * darwin_sections[NUM_DARWI #undef TARGET_ASM_SELECT_SECTION #define TARGET_ASM_SELECT_SECTION machopic_select_section -#define USE_SELECT_SECTION_FOR_FUNCTIONS + #undef TARGET_ASM_FUNCTION_SECTION #define TARGET_ASM_FUNCTION_SECTION darwin_function_section