[RFA:] dwarf2out.c, tm.texi, defaults.h: Enable EH frame info in data_section

Hans-Peter Nilsson hans-peter.nilsson@axis.com
Wed Nov 15 09:17:00 GMT 2000


This lets a port decide at run-time (meaning run-time of the
compiler) whether data_section is used to emit EH info.

This is necessary when your port does multi-object formats (like
a.out and ELF).  Extra decoration (framing) is needed when EH
info goes into the data section, compared to EXCEPTION_SECTION.
The assumption of the EH-generating machinery is that
EXCEPTION_SECTION is never data_section, which is the default
when none of the EH-section macros is defined.

Bootstrapped on i686-pc-linux-gnu with no regressions with
--disable-libstdcxx-v3, (because that seems the only way to
bootstrap there at the time I started the bootstrap).

Ok to commit?

	* tm.texi (Exception Region Output): Document
	FORCE_EH_FRAME_INFO_IN_DATA_SECTION.
	* dwarf2out.c (output_call_frame_info): Handle
	FORCE_EH_FRAME_INFO_IN_DATA_SECTION.
	* defaults.h (FORCE_EH_FRAME_INFO_IN_DATA_SECTION):
	Provide default.

Index: tm.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tm.texi,v
retrieving revision 1.151
diff -c -p -r1.151 tm.texi
*** tm.texi	2000/11/10 05:56:47	1.151
--- tm.texi	2000/11/15 01:16:20
*************** switch to the appropriate section.
*** 6652,6657 ****
--- 6667,6682 ----
  
  You should define this symbol if your target supports DWARF 2 frame
  unwind information and the default definition does not work.
+ 
+ @findex FORCE_EH_FRAME_INFO_IN_DATA_SECTION
+ @item FORCE_EH_FRAME_INFO_IN_DATA_SECTION
+ A C expression directing where exception frame information will be
+ located, when the exception frame information is specified through
+ @code{EXCEPTION_SECTION}, @code{ASM_OUTPUT_SECTION_NAME} or
+ @code{EH_FRAME_SECTION_ASM_OP}.  If the returned value is non-zero,
+ @code{data_section} will be used, otherwise the section defined through
+ @code{EXCEPTION_SECTION}, @code{ASM_OUTPUT_SECTION_NAME} or
+ @code{EH_FRAME_SECTION_ASM_OP}.
  
  @findex OMIT_EH_TABLE
  @item OMIT_EH_TABLE ()
Index: defaults.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/defaults.h,v
retrieving revision 1.25
diff -c -p -r1.25 defaults.h
*** defaults.h	2000/11/01 00:20:34	1.25
--- defaults.h	2000/11/15 01:16:16
*************** do { ASM_OUTPUT_LABEL(FILE,LABEL_ALTERNA
*** 186,191 ****
--- 186,195 ----
  # endif
  #endif
  
+ #ifndef FORCE_EH_FRAME_INFO_IN_DATA_SECTION
+ #define FORCE_EH_FRAME_INFO_IN_DATA_SECTION 0
+ #endif
+ 
  /* By default, we generate a label at the beginning and end of the
     text section, and compute the size of the text section by
     subtracting the two.  However, on some platforms that doesn't 
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.217
diff -c -p -r1.217 dwarf2out.c
*** dwarf2out.c	2000/11/08 02:17:59	1.217
--- dwarf2out.c	2000/11/15 01:20:08
*************** output_call_frame_info (for_eh)
*** 1792,1806 ****
    if (for_eh)
      {
  #ifdef EH_FRAME_SECTION
!       EH_FRAME_SECTION ();
! #else
!       tree label = get_file_function_name ('F');
! 
!       force_data_section ();
!       ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (DWARF2_ADDR_SIZE));
!       ASM_GLOBALIZE_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
!       ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
  #endif
        assemble_label ("__FRAME_BEGIN__");
      }
    else
--- 1792,1810 ----
    if (for_eh)
      {
  #ifdef EH_FRAME_SECTION
!       if (! FORCE_EH_FRAME_INFO_IN_DATA_SECTION)
! 	EH_FRAME_SECTION ();
!       else
  #endif
+ 	{
+ 	  tree label = get_file_function_name ('F');
+ 
+ 	  force_data_section ();
+ 	  ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (DWARF2_ADDR_SIZE));
+ 	  ASM_GLOBALIZE_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
+ 	  ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
+ 	}
+ 
        assemble_label ("__FRAME_BEGIN__");
      }
    else
*************** output_call_frame_info (for_eh)
*** 1982,1995 ****
        fputc ('\n', asm_out_file);
  #endif
      }
! #ifndef EH_FRAME_SECTION
!   if (for_eh)
      {
        /* Emit terminating zero for table.  */
        ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0);
        fputc ('\n', asm_out_file);
      }
! #endif
  #ifdef MIPS_DEBUGGING_INFO
    /* Work around Irix 6 assembler bug whereby labels at the end of a section
       get a value of 0.  Putting .align 0 after the label fixes it.  */
--- 1986,2003 ----
        fputc ('\n', asm_out_file);
  #endif
      }
! 
!   if (for_eh
! #ifdef EH_FRAME_SECTION
!       && FORCE_EH_FRAME_INFO_IN_DATA_SECTION
! #endif
!       )
      {
        /* Emit terminating zero for table.  */
        ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0);
        fputc ('\n', asm_out_file);
      }
! 
  #ifdef MIPS_DEBUGGING_INFO
    /* Work around Irix 6 assembler bug whereby labels at the end of a section
       get a value of 0.  Putting .align 0 after the label fixes it.  */

brgds, H-P


More information about the Gcc-patches mailing list