This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: Fix PR debug/34249, [4.3 Regression] FAIL: gcc.dg/tree-prof/bb-reorg.c compilation, -fprofile-use -D_PROFILE_USE


On Jan 14, 2008 5:12 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> Hello!
>
> The problem is with -freorder-blocks-and-partition flag, where start
> label of a function is put into text section and end label of a function
> is put into text.unlikely section. Assembler is not able to calculate
> the difference of these two sections, leading to assembly error.
>
> It turns out, that the testcase works with -g, simply because we call
> switch_text_sections through debug_hooks for
> NOTE_INSN_SWITCH_TEXT_SECTIONS.  In this case, correct differences are
> output in the FDE.
>
> So, the fix is simple -  for DWARF2_UNWIND_INFO targets, call
> dwarf2out_switch_text_section directly (depending on
> dwarf2out_do_frame). When called, this function sets
> fde->dw_fde_switched_sections flags that triggers specialized output for
> switched text sections.
>
> BTW: I wonder, if we should set flag_inhibit_size_directive for
> -freorder-blocks-and-partition. .size is certainly not correct when half
> of the function is in some other section than start/end labels. The
> documentation says:
>
> `-finhibit-size-directive'
>      Don't output a `.size' assembler directive, or anything else that
>      would cause trouble if the function is split in the middle, and the
>      two halves are placed at locations far apart in memory.  This
>      option is used when compiling `crtstuff.c'; you should not need to
>      use it for anything else.
>
> The patch was boostrapped on x86-pc-linux-gnu and regression tested for
> {,-m32}. The patch fixes bb-reorg.c failure.
>
> OK for mainline?

Ok.

Thanks,
Richard.

> 2008-01-14  Uros Bizjak  <ubizjak@gmail.com>
>
>         PR debug/34249
>         * debug.h (dwarf2out_switch_text_section): Move declaration from ...
>         * dwarf2out.c (dwarf2out_switch_text_section): ... here.  Make
>         function global.
>         * final.c (final_scan_insn) [NOTE_INSN_SWITCH_TEXT_SECTIONS]:
>         Depending on dwarf2out_do_frame, call dwarf2out_switch_text_section
>         for DWARF2_UNWIND_INFO targets.
>
> Uros.
>
> Index: final.c
> ===================================================================
> --- final.c     (revision 131520)
> +++ final.c     (working copy)
> @@ -1777,7 +1777,13 @@ final_scan_insn (rtx insn, FILE *file, i
>
>         case NOTE_INSN_SWITCH_TEXT_SECTIONS:
>           in_cold_section_p = !in_cold_section_p;
> -         (*debug_hooks->switch_text_section) ();
> +#ifdef DWARF2_UNWIND_INFO
> +         if (dwarf2out_do_frame ())
> +           dwarf2out_switch_text_section ();
> +         else
> +#endif
> +           (*debug_hooks->switch_text_section) ();
> +
>           switch_to_section (current_function_section ());
>           break;
>
> Index: debug.h
> ===================================================================
> --- debug.h     (revision 131520)
> +++ debug.h     (working copy)
> @@ -160,6 +160,7 @@ extern void dwarf2out_frame_finish (void
>  /* Decide whether we want to emit frame unwind information for the current
>     translation unit.  */
>  extern int dwarf2out_do_frame (void);
> +extern void dwarf2out_switch_text_section (void);
>
>  extern void debug_flush_symbol_queue (void);
>  extern void debug_queue_symbol (tree);
> Index: dwarf2out.c
> ===================================================================
> --- dwarf2out.c (revision 131520)
> +++ dwarf2out.c (working copy)
> @@ -3659,7 +3659,6 @@ static void dwarf2out_imported_module_or
>  static void dwarf2out_abstract_function (tree);
>  static void dwarf2out_var_location (rtx);
>  static void dwarf2out_begin_function (tree);
> -static void dwarf2out_switch_text_section (void);
>
>  /* The debug hooks structure.  */
>
> @@ -7094,7 +7093,7 @@ dwarf2out_note_section_used (void)
>      cold_text_section_used = true;
>  }
>
> -static void
> +void
>  dwarf2out_switch_text_section (void)
>  {
>    dw_fde_ref fde;
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]