ld - references to merged SEC_MERGED .debug_str not adjusted

Paul Shortis pshortis@dataworx.com.au
Tue May 13 22:56:00 GMT 2014


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. Doesn't anyone have any pointers that 
may get me closer to a solution to the problem ?

Thanks, Paul.



More information about the Binutils mailing list