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, testsuite] Fix PR37033, gcc.dg/pch/valid-1b.c failures


On Tue, Nov 18, 2008 at 07:38:15PM +0100, Uros Bizjak wrote:
> So we hit the problem in:
>
> int
> dwarf2out_do_frame (void)
> {
>  /* We want to emit correct CFA location expressions or lists, so we
>     have to return true if we're going to output debug info, even if
>     we're not going to output frame or unwind info.  */
>  return (write_symbols == DWARF2_DEBUG
>      || write_symbols == VMS_AND_DWARF2_DEBUG
>      || DWARF2_FRAME_INFO
> #ifdef DWARF2_UNWIND_INFO
>      || (DWARF2_UNWIND_INFO
>          && (flag_unwind_tables
>          || (flag_exceptions && ! USING_SJLJ_EXCEPTIONS)))
> #endif
>      );
> }
>
> since __GCC_HAVE_DWARF2_CFI_ASM depends on the result of  
> dwarf2out_do_cfi_asm () which further depends on dwarf2out_do_frame ().  
> This function returns 1 with -g (write_symbols == DWARF2_DEBUG) and 0  
> with -g0 (write_symbols == NO_DEBUG) on i686 targets.

The rationale for the macro is to tell inline asm writers whether
they can/should use .cfi* directives in their inline asm or not.
If you do say:
asm volatile ("pushl %eax; pushl %edx; call foo; addl $8, %esp" : ...);
and .cfi_directives are emitted, then it is desirable to tell
the unwinder about the CFA offset changes etc.  After all, this was
the main motivation behind switch to .cfi_* directives, without
them inline asm just can't hook into the containing function's .eh_frame.

But, when .cfi_* directives are not emitted, using .cfi_rel_offset
etc. in the inline asm will result in assembler errors, as they can't
be used without the containing .cfi_{start,end}proc.

IMHO either we define __GCC_HAVE_DWARF2_CFI_ASM only in the
#ifdef DWARF2_UNWIND_INFO
       (DWARF2_UNWIND_INFO
	&& (flag_unwind_tables
	    || (flag_exceptions && ! USING_SJLJ_EXCEPTIONS)))
#endif
case (and, possibly, also use .cfi_* directives only in that case,
as the .cfi_* directives emit both .eh_frame and .debug_frame, not just
.debug_frame), or come up with some inline asm modifier which will expand to
a comment char if .cfi_* directives aren't used and to nothing if they are
used.

	Jakub


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