This is the mail archive of the
mailing list for the binutils project.
readelf bug exposed with change from 2003-12-29
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: nickc at redhat dot com
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 7 Jan 2004 17:04:59 +0100
- Subject: readelf bug exposed with change from 2003-12-29
Hi. Since this change:
2003-12-29 Nick Clifton <firstname.lastname@example.org>
* readelf.c (debug_line_pointer_size): Replace with an array
(num_debug_line_pointer_sizes): New variable.
(display_debug_lines): Extract pointer size from the
(prescan_debug_info): Fill in the debug_line_pointer_sizes
I'm getting these errors:
Running /home/hp/binutils/cvs_latest/src/gas/testsuite/gas/cris/cris.exp ...
In gas.log they all look like:
../as-new --em=criself --gdwarf2 -o dump.o /home/hp/binutils/cvs_latest/src/gas/testsuite/gas/cris/addi.s
/dsk/c0t3s2/hptmp2/autobuildbinu/binu/gas/testsuite/../../binutils/readelf -wl dump.o > dump.out
readelf: Error: Not enough comp units for .debug_lines section
Looking at readelf.c code nearby the change, sections are
iterated in file order and a function display_debug_section is
called, iterating on an array called debug_displays, calling
some functions for certain section names. The function
prescan_debug_info is called for ".debug_info". That function
needs to be called to initialize pointer sizes before users of
that information, like display_debug_lines (for ".debug_lines")
are called, else the latter functions hork as seen above.
The current scheme seems to rely on the section ".debug_info"
being located before ".debug_lines" in a file, which would be
pure coincidence, breaking here when encountering GAS-generated
debug info. It worked before the patch above which seems to
have removed a fallback to assume pointer size = 4.
Unfortunately I see no small and obvious fix. Reinstating the
fallback would just be a hack.