This patch fixes PR rtl-optimizations/57451 by preventing scopes and therefore lexical blocks from crossing split section boundaries. This will prevent debug info generation from using DW_AT_low_pc/high_pc pairs across the section boundary.
Bootstrapped and tested on x86_64-unknown-linux-gnu. With this patch, a profilebootstrap with -freorder-blocks-and-partition force-enabled also passes. Ok for trunk? Thanks, Teresa 2013-08-11 Teresa Johnson <tejohn...@google.com> PR rtl-optimizations/57451 * final.c (reemit_insn_block_notes): Prevent lexical blocks from crossing split section boundaries. Index: final.c =================================================================== --- final.c (revision 201644) +++ final.c (working copy) @@ -1650,12 +1650,26 @@ reemit_insn_block_notes (void) rtx insn, note; insn = get_insns (); - if (!active_insn_p (insn)) - insn = next_active_insn (insn); - for (; insn; insn = next_active_insn (insn)) + for (; insn; insn = next_insn (insn)) { tree this_block; + /* Prevent lexical blocks from straddling section boundaries. */ + if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_SWITCH_TEXT_SECTIONS) + { + for (tree s = cur_block; s != DECL_INITIAL (cfun->decl); + s = BLOCK_SUPERCONTEXT (s)) + { + rtx note = emit_note_before (NOTE_INSN_BLOCK_END, insn); + NOTE_BLOCK (note) = s; + note = emit_note_after (NOTE_INSN_BLOCK_BEG, insn); + NOTE_BLOCK (note) = s; + } + } + + if (!active_insn_p (insn)) + continue; + /* Avoid putting scope notes between jump table and its label. */ if (JUMP_TABLE_DATA_P (insn)) continue; -- Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413