public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld - references to merged SEC_MERGED .debug_str not adjusted
@ 2014-05-13 22:56 Paul Shortis
  2014-05-14  9:21 ` Paul Shortis
  2014-05-16  7:24 ` Alan Modra
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Shortis @ 2014-05-13 22:56 UTC (permalink / raw)
  To: binutils

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ld - references to merged SEC_MERGED .debug_str not adjusted
  2014-05-13 22:56 ld - references to merged SEC_MERGED .debug_str not adjusted Paul Shortis
@ 2014-05-14  9:21 ` Paul Shortis
  2014-05-16  7:24 ` Alan Modra
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Shortis @ 2014-05-14  9:21 UTC (permalink / raw)
  To: binutils

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.
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ld - references to merged SEC_MERGED .debug_str not adjusted
  2014-05-13 22:56 ld - references to merged SEC_MERGED .debug_str not adjusted Paul Shortis
  2014-05-14  9:21 ` Paul Shortis
@ 2014-05-16  7:24 ` Alan Modra
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Modra @ 2014-05-16  7:24 UTC (permalink / raw)
  To: Paul Shortis; +Cc: binutils

On Wed, May 14, 2014 at 08:56:13AM +1000, Paul Shortis wrote:
> 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.

Presumably you have relocations on the .debug_info pointers to
.debug_str..  Are those relocs against the .debug_str section symbol?
Do you use _bfd_elf_rela_local_sym (or _bfd_elf_rel_local_sym) to
adjust the reloc addends?

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-16  7:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-13 22:56 ld - references to merged SEC_MERGED .debug_str not adjusted Paul Shortis
2014-05-14  9:21 ` Paul Shortis
2014-05-16  7:24 ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).