readelf bug exposed with change from 2003-12-29
Wed Jan 7 16:05:00 GMT 2004
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.
More information about the Binutils