Bug 45171 - Invalid DWARF...DIE 0x00006a1d has multiple AT_byte_size attributes.
Summary: Invalid DWARF...DIE 0x00006a1d has multiple AT_byte_size attributes.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: Richard Henderson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-03 14:32 UTC by Jack Howarth
Modified: 2010-08-20 12:02 UTC (History)
2 users (show)

See Also:
Host: x86_64-apple-darwin10
Target: x86_64-apple-darwin10
Build: x86_64-apple-darwin10
Known to work:
Known to fail:
Last reconfirmed: 2010-08-04 19:33:43


Attachments
assembly file for libjava jvmti.exp's linking events on x86_64-apple-darwin10 (2.91 KB, text/plain)
2010-08-03 14:36 UTC, Jack Howarth
Details
preprocessed source for libjava/testsuite/libjava.jvmti/natgetallthreads.cc from x86_64-apple-darwin10 at -m64 (42.44 KB, text/plain)
2010-08-03 15:38 UTC, Jack Howarth
Details
assembly for libjava/testsuite/libjava.jvmti/natgetallthreads.cc from x86_64-apple-darwin10 at -m64 (55.84 KB, text/plain)
2010-08-03 15:39 UTC, Jack Howarth
Details
natevents.o with duplicate AT_byte_size attributes from x86_64-apple-darwin10 (35.77 KB, application/octet-stream)
2010-08-03 22:59 UTC, Jack Howarth
Details
bz2 compressed dwarfdump of natevents.o (41.30 KB, application/octet-stream)
2010-08-03 23:02 UTC, Jack Howarth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jack Howarth 2010-08-03 14:32:26 UTC
At r162841, four new libjava testsuite failures appear on x86_64-apple-darwin10 at both -m32 and -m64...

FAIL: linking events
FAIL: linking getallthreads
FAIL: linking geterrorname
FAIL: linking getmethodname

These are of the form...

Executing on host: /sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.4.0/libjava/testsuite/../libtool --silent --tag=GCJ --mode=link /sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/gcj -B/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/ --encoding=UTF-8 -B/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.4.0/libjava/testsuite/../ /sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100802/libjava/testsuite/libjava.jvmti/events.jar natevents.o  -w  -bind_at_load -multiply_defined suppress -Wl,-allow_stack_execute --main=events -g  -L/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.4.0/i386/libjava/.libs -lm   -m32 -o events    (timeout = 300)
error: Invalid DWARF in /sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.4.0/libjava/testsuite/natevents.o: DIE 0x00006a1d has multiple  AT_byte_size attributes.
compiler exited with status 1
output is:
error: Invalid DWARF in /sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.4.0/libjava/testsuite/natevents.o: DIE 0x00006a1d has multiple  AT_byte_size attributes.

FAIL: linking events
XFAIL: running events

and were not present at r162730.
Comment 1 Jack Howarth 2010-08-03 14:36:20 UTC
Created attachment 21376 [details]
assembly file for libjava jvmti.exp's linking events on x86_64-apple-darwin10
Comment 2 Jack Howarth 2010-08-03 15:38:03 UTC
Created attachment 21378 [details]
preprocessed source for libjava/testsuite/libjava.jvmti/natgetallthreads.cc from x86_64-apple-darwin10 at -m64
Comment 3 Jack Howarth 2010-08-03 15:39:38 UTC
Created attachment 21379 [details]
assembly for libjava/testsuite/libjava.jvmti/natgetallthreads.cc from x86_64-apple-darwin10 at -m64
Comment 4 Jack Howarth 2010-08-03 15:52:59 UTC
This failure is likely due to using Xcode 3.2.3 and is described in the thread at...

http://lists.apple.com/archives/xcode-users/2010/Jun/msg00189.html

New checks have been added to the linker to catch bad debug information... 

http://lists.apple.com/archives/xcode-users/2010/Jun/msg00291.html
Comment 5 Jack Howarth 2010-08-03 22:50:53 UTC
The linkage of events succeeds if done manually (without using libtool which invokes dsymutil)...


[MacPro:~/bad_dwarf] howarth% /sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/as -arch x86_64 -force_cpusubtype_ALL -o eventsmain.o eventsmain.s
[MacPro:~/bad_dwarf] howarth% /sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/collect2 -dynamic -arch x86_64 -bind_at_load -macosx_version_min 10.6.4 -multiply_defined suppress -weak_reference_mismatches non-weak -w -o events -lcrt1.10.5.o -L/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.4.0/./libjava/.libs -L/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc -L/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.4.0/libjava/testsuite/.. eventsmain.o events.o natevents.o -allow_stack_execute -lm -lgcc_s.10.5 -lgcc_ext.10.5 -lgcc -lgcj -lm -L/sw/lib -liconv -lpthread -lz -allow_stack_execute -ldl -lgcc_s.10.5 -lgcc_ext.10.5 -lgcc -no_compact_unwind -lSystem

however the resulting executable triggers the warning with dsymutil...

dsymutil events
error: Invalid DWARF in /Users/howarth/bad_dwarf/natevents.o: DIE 0x00006c58 has multiple  AT_byte_size attributes.

dwarfdump natevents.o > natevents.o.dwarfdump

shows...


0x00006c58:     TAG_structure_type [39] *
                 AT_byte_size( 0x18 )
                 AT_decl_file( "/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100803/libjava/classpath/include/jni.h" )
                 AT_decl_line( 213 )
                 AT_byte_size( 0x18 )
                 AT_decl_file( "/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100803/libjava/classpath/include/jni.h" )
                 AT_decl_line( 213 )
                 AT_sibling( {0x00006c90} )
Comment 6 Jack Howarth 2010-08-03 22:59:57 UTC
Created attachment 21383 [details]
natevents.o with duplicate AT_byte_size attributes from x86_64-apple-darwin10
Comment 7 Jack Howarth 2010-08-03 23:02:36 UTC
Created attachment 21385 [details]
bz2 compressed dwarfdump of natevents.o
Comment 8 Jack Howarth 2010-08-03 23:29:07 UTC
Apparently this structure is generating the duplicate AT_byte_size attributes...


/* This structure is used when registering native methods.  */
typedef struct
{
  char *name;
  char *signature;
  void *fnPtr;                  /* Sigh.  */
} JNINativeMethod;

since it is at line 213 of libjava/classpath/include/jni.h and dwarfdump shows...


0x00006c58:     TAG_structure_type [39] *
                 AT_byte_size( 0x18 )
                 AT_decl_file( "/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100803/libjava/classpath/include/jni.h" )
                 AT_decl_line( 213 )
                 AT_byte_size( 0x18 )
                 AT_decl_file( "/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100803/libjava/classpath/include/jni.h" )
                 AT_decl_line( 213 )
                 AT_sibling( {0x00006c90} )

0x00006c63:         TAG_member [12]  
                     AT_name( "name" )
                     AT_decl_file( "/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100803/libjava/classpath/include/jni.h" )
                     AT_decl_line( 214 )
                     AT_type( {0x000005eb} ( char* ) )
                     AT_data_member_location( +0 )

0x00006c71:         TAG_member [12]  
                     AT_name( "signature" )
                     AT_decl_file( "/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100803/libjava/classpath/include/jni.h" )
                     AT_decl_line( 215 )
                     AT_type( {0x000005eb} ( char* ) )
                     AT_data_member_location( +8 )

0x00006c7f:         TAG_member [13]  
                     AT_name( "fnPtr" )
                     AT_decl_file( "/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100803/libjava/classpath/include/jni.h" )
                     AT_decl_line( 216 )
                     AT_type( {0x000005f9} ( * ) )
                     AT_data_member_location( +16 )

0x00006c8f:         NULL

0x00006c90:     TAG_typedef [2]  
                 AT_name( "JNINativeMethod" )
                 AT_decl_file( "/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100803/libjava/classpath/include/jni.h" )
                 AT_decl_line( 217 )
                 AT_type( {0x00006c58} ( struct  ) )
Comment 9 Jack Howarth 2010-08-03 23:35:46 UTC
This same structure for JNINativeMethod appears to be the source of the duplicate AT_byte_size in all four failing libjava testcases.
Comment 10 Richard Henderson 2010-08-04 19:33:43 UTC
Verified with

  typedef struct { int a, b; } x;

./cc1plus -g -fno-eliminate-unused-debug-types -dA z.c

        .uleb128 0x2    # (DIE (0x2d) DW_TAG_structure_type)
        .byte   0x8     # DW_AT_byte_size
        .byte   0x1     # DW_AT_decl_file (z.c)
        .byte   0x3     # DW_AT_decl_line
        .byte   0x8     # DW_AT_byte_size
        .byte   0x1     # DW_AT_decl_file (z.c)
        .byte   0x3     # DW_AT_decl_line

Note that both byte_size and and the decl location are replicated.
This happens with the C++ compiler, but not the C compiler.
Comment 11 Richard Henderson 2010-08-04 23:21:12 UTC
This is fallout from c++/44188.
Comment 12 Richard Henderson 2010-08-04 23:32:26 UTC
Subject: Bug 45171

Author: rth
Date: Wed Aug  4 23:32:08 2010
New Revision: 162882

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162882
Log:
PR debug/45171
* dwarf2out.c (gen_typedef_die): Don't re-generate the die of
an is_naming_typedef_decl.

Added:
    trunk/gcc/testsuite/g++.dg/debug/dwarf2/typedef4.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c

Comment 13 Richard Henderson 2010-08-04 23:41:57 UTC
Should be fixed, but I'll leave the bug open until you get a chance
to test the whole build against that darwin linker.
Comment 14 Jack Howarth 2010-08-20 12:02:06 UTC
Fixed with r162882.