[PATCH] Debug info read problem

Andrew Stubbs ams@codesourcery.com
Thu Mar 12 14:25:00 GMT 2009

I have been investigating a problem in which I see this message, in 
addition to "undefined reference to" messages:

> arm-none-eabi-ld: Dwarf Error: Offset (273) greater than or equal to .debug_str size (268).

The problem is that it mis-reads the size of the .debug_str section. 
This leads to valid offsets appearing out-of-range.

Debugging shows that the section "rawsize" field contains the correct 
size, but the code prefers the "size" field, which does not.

It's not entirely clear to me why there would be two different sizes for 
this section - the comments on the fields talk about relaxation and 
such, but I don't understand how this related to debug info. It does say 
that, if set, the field contains the original size of the input section 
on disk. This would appear to be the right thing, in this case.

The attached patch fixes the problem for the test case, but I don't if 
I'm fixing the symptom, or the root cause.

Note that this code is usually only called for building diagnostic 
messages from debug info.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: section-size.patch
Type: text/x-diff
Size: 976 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20090312/005a07b4/attachment.bin>

More information about the Binutils mailing list