This is the mail archive of the gcc@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]

Re: DWARF2 Regression


readelf complains "readelf: Warning: The line info appears to be corrupt - the
section is too small".  Looking at the line table dump, I see that the
Prologue Length is negative.  Looking at the .s file, the problem is obvious.

	.4byte	.LSLT0-.LELT0	 # Length of Source Line Info.
.LSLT0:
	.2byte	0x2	 # DWARF Version
	.4byte	.LASLTP0-.LELTP0	 # Prolog Length

Both of these will work better if we subtract the end labels from the start
labels to get a small positive number, instead of a negative number that
overflows to an apparently very large positive number.

It looks like this was broken accidentally when a patch for the mainline
was converted into a patch that would apply to the somewhat different gcc-3
branch.

Try something like this...

Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.242.2.6
diff -p -r1.242.2.6 dwarf2out.c
*** dwarf2out.c	2001/04/12 01:34:47	1.242.2.6
--- dwarf2out.c	2001/05/04 21:35:05
*************** output_line_info ()
*** 6911,6917 ****
    ASM_GENERATE_INTERNAL_LABEL (p1, LN_PROLOG_AS_LABEL, 0);
    ASM_GENERATE_INTERNAL_LABEL (p2, LN_PROLOG_END_LABEL, 0);
  
!   ASM_OUTPUT_DWARF_DELTA (asm_out_file, l1, l2);
    if (flag_debug_asm)
      fprintf (asm_out_file, "\t%s Length of Source Line Info.",
  	     ASM_COMMENT_START);
--- 6912,6918 ----
    ASM_GENERATE_INTERNAL_LABEL (p1, LN_PROLOG_AS_LABEL, 0);
    ASM_GENERATE_INTERNAL_LABEL (p2, LN_PROLOG_END_LABEL, 0);
  
!   ASM_OUTPUT_DWARF_DELTA (asm_out_file, l2, l1);
    if (flag_debug_asm)
      fprintf (asm_out_file, "\t%s Length of Source Line Info.",
  	     ASM_COMMENT_START);
*************** output_line_info ()
*** 6923,6929 ****
      fprintf (asm_out_file, "\t%s DWARF Version", ASM_COMMENT_START);
  
    fputc ('\n', asm_out_file);
!   ASM_OUTPUT_DWARF_DELTA (asm_out_file, p1, p2);
    if (flag_debug_asm)
      fprintf (asm_out_file, "\t%s Prolog Length", ASM_COMMENT_START);
  
--- 6924,6930 ----
      fprintf (asm_out_file, "\t%s DWARF Version", ASM_COMMENT_START);
  
    fputc ('\n', asm_out_file);
!   ASM_OUTPUT_DWARF_DELTA (asm_out_file, p2, p1);
    if (flag_debug_asm)
      fprintf (asm_out_file, "\t%s Prolog Length", ASM_COMMENT_START);
  

Jim


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