Problem with DWARF2 debug info for DJGPP

Andris Pavenis
Mon Aug 12 00:11:00 GMT 2002

On Fri, 9 Aug 2002, Mark E. wrote:

> > I'm getting error message about wrong DWARF2 abbrev when attemting to link 
> > program which contains reference to unresolved symbol 
> If you could provide a simple testcase, I'll look into it...

Ok. Here is simple testcase. I run it under Linux using cross-compiler
(simply Linux is booted now), but it's reproducible also with native tools
for DJGPP.


---------------------  Test example ------------------------------
#! /bin/sh
i586-pc-msdosdjgpp-gcc -gdwarf-2 -v -x c - -o foo.exe << 'EOF'
#include <stdio.h>
int foo (void);
int main (void)
   return foo ();


Reading specs from /usr/lib/gcc-lib/i586-pc-msdosdjgpp/3.1/specs
Configured with: ../gnu/gcc-3.1/configure --build=i586-pc-linux-gnu --host=i586-pc-linux-gnu --target=i586-pc-msdosdjgpp --with-as=/usr/bin/i586-pc-msdosdjgpp-as --with-ld=/usr/bin/i586-pc-msdosdjgpp-ld --disable-nls --prefix=/usr --enable-languages=c,c++,f77,objc --enable-version-specific-runtime-libs
Thread model: single
gcc version 3.1
 /usr/lib/gcc-lib/i586-pc-msdosdjgpp/3.1/cc1 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -D__MSDOS__ -D__GO32__ -D__DJGPP__=2 -D__unix__ -D__MSDOS__ -D__GO32__ -D__DJGPP__=2 -D__unix__ -Asystem=msdos -Asystem=unix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i586__ -D__tune_pentium__ -DMSDOS -DGO32 -DDJGPP=2 -Dunix -remap -imacros /usr/lib/gcc-lib/i586-pc-msdosdjgpp/3.1/djgpp.ver - -quiet -dumpbase - -gdwarf-2 -version -o /tmp/cchNDUkj.s
GNU CPP version 3.1 (cpplib) (80386, BSD syntax)
GNU C version 3.1 (i586-pc-msdosdjgpp)
	compiled by GNU C version 3.1.
ignoring duplicate directory "/usr/i586-pc-msdosdjgpp/include"
#include "..." search starts here:
#include <...> search starts here:
End of search list.
 /usr/bin/i586-pc-msdosdjgpp-as --traditional-format -o /tmp/ccybbc1v.o /tmp/cchNDUkj.s
 /usr/lib/gcc-lib/i586-pc-msdosdjgpp/3.1/collect2 -o foo.exe /usr/lib/gcc-lib/i586-pc-msdosdjgpp/3.1/../../../../i586-pc-msdosdjgpp/lib/crt0.o -L/usr/lib/gcc-lib/i586-pc-msdosdjgpp/3.1 -L/usr/lib/gcc-lib/i586-pc-msdosdjgpp/3.1/../../../../i586-pc-msdosdjgpp/lib /tmp/ccybbc1v.o -lgcc -lc -lgcc -Tdjgpp-x.djl
/usr/bin/i586-pc-msdosdjgpp-ld: Dwarf Error: Could not find abbrev number 1.
/tmp/ccybbc1v.o(.text+0x11):<stdin>: undefined reference to `_foo'
collect2: ld returned 1 exit status

Output from 'i586-pc-msdosdjgpp-ld --version':

GNU ld version 2.12.1
Copyright 2002 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.

More information about the Binutils mailing list