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: Sequel to PR40521 -- -g causes GCC to generate .eh_frame


On Wed, Mar 31, 2010 at 05:43:05PM +0200, Thomas Schwinge wrote:
> Deleting the definition is different from defining it to zero, as this is
> sort of a tri-state thing: undefined meaning that the DWARF unwinding
> machinery is not implemented, zero meaning that it is implemented but
> shall not be used, and one meaning that it shall be used.  (See my
> documentation update, too.)  For example, compare with this use in
> gcc/c-cppbuiltin.c:c_cpp_builtins:
> 
>     #ifdef DWARF2_UNWIND_INFO
>       if (dwarf2out_do_cfi_asm ())
>         cpp_define (pfile, "__GCC_HAVE_DWARF2_CFI_ASM");
>     #endif

I was expecting this code in defaults.h to handle everything:

/* If we have a definition of INCOMING_RETURN_ADDR_RTX, assume that
   the rest of the DWARF 2 frame unwind support is also provided.  */
#if !defined (DWARF2_UNWIND_INFO) && defined (INCOMING_RETURN_ADDR_RTX) \
    && !defined (TARGET_UNWIND_INFO)
#define DWARF2_UNWIND_INFO 1
#endif

But it sounds like what we want is this instead:

/* If we have a definition of INCOMING_RETURN_ADDR_RTX, assume that
   the rest of the DWARF 2 frame unwind support is also provided.  */
#if !defined (DWARF2_UNWIND_INFO) && defined (INCOMING_RETURN_ADDR_RTX)
# ifdef (TARGET_UNWIND_INFO)
#  define DWARF2_UNWIND_INFO 0
# else
#  define DWARF2_UNWIND_INFO 1
# endif
#endif

Or do the equivalent in config/arm/ as you've done, which is safer.

> Is that patch OK?  Who can approve it?  Jakub can't, he said on IRC.
> 
> gcc/
> 2010-03-31  Thomas Schwinge  <thomas@codesourcery.com>
> 	    Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* doc/tm.texi (DWARF2_UNWIND_INFO, TARGET_UNWIND_INFO): Improve.
> 	* dwarf2out.c (NEED_UNWIND_TABLES): Define.
> 	(dwarf2out_do_frame, dwarf2out_do_cfi_asm, dwarf2out_begin_prologue)
> 	(dwarf2out_frame_finish, dwarf2out_assembly_start): Use it.
> 	(dwarf2out_assembly_start): Correct logic for TARGET_UNWIND_INFO.
> 	* config/arm/arm.h (DWARF2_UNWIND_INFO): Remove definition.
> 	* config/arm/bpabi.h (DWARF2_UNWIND_INFO): Define to zero.

This looks right to me.  Maybe Jason or Richard E. would review it?

-- 
Daniel Jacobowitz
CodeSourcery


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