ld - references to merged SEC_MERGED .debug_str not adjusted

Paul Shortis pshortis@dataworx.com.au
Wed May 14 09:21:00 GMT 2014


I forgot, binutils 2.23

On 14/05/14 08:56, Paul Shortis wrote:
> I've ported bfd, gas etc to my custom processor, and all is 
> functioning well with one exception ...
>
> I've trimmed down a test case to ...
>
> #include <stdio.h>
>
> int main( int argc, char *argv[])
> {
>     return 0;
> }
>
> The object file produced by gcc/gas looks fine with indirect 
> string offsets in .debug_info pointing to the correct places in 
> .debug_str .
>
> However after linking to create a binary, dumping the binary 
> reveals that unused entries in .debug_str have been deleted (I 
> assume because this is a SEC_MERGE section), however the 
> indirect string offsets in .debug_info that point into 
> .debug_str haven't been adjusted and are therefore invalid.
>
> gdb, of course objects to loading the linked binary.
>
> I've started stepping through ld execution to see what is 
> happening but I could lose a few days familiarizing myself with 
> the internals.
>
> I'm assuming I'm repeating some sort of a newbie blunder but 
> Google hasn't been helpful. Does anyone have any pointers that 
> may get me closer to a solution to the problem ?
>
> Thanks, Paul.
>



More information about the Binutils mailing list