This is the mail archive of the
mailing list for the binutils project.
Adding stubs with new symbols and relocs to a (elf32) bfd from within the linker.
- From: Anthony Brandon <anthony dot brandon at gmail dot com>
- To: binutils at sourceware dot org
- Date: Wed, 7 Oct 2015 23:59:13 +0200
- Subject: Adding stubs with new symbols and relocs to a (elf32) bfd from within the linker.
- Authentication-results: sourceware.org; auth=none
I have a made a binutils back-end for a processor we are using for
The compiler (made by someone else) will emit relative branches to
functions in other objects that might be further away than the maximum
distance a relative branch can branch.
I've been looking at how the elf32-arm port adds in stubs, and it
seems to be leading me in the right direction, but I'm getting stuck
on a couple of issues.
At the moment I'm able to add a little section of binary data at the
end of the text section that is supposed to do a direct jump to the
actual target address.
The problem is that I also want the relocations and symbols to end up
in the output bfd, but I can't figure out how to get this to work.
The reason for this is that the actual system doesn't use elf, but flt.
The flt conversion tool needs all the relocs in place to relocate the
code to the correct address.
(the whole thing runs on physical addresses, so no virtual memory)
Long story short, I need the linker to add data to an existing
input-text section (or in the middle of the output text section), and
to add relocs and symbols in that new data.
Are there some special functions to achieve this?
Is there some other port I can look at that does something similar?
I'm using ld for all of this. Would this be easier if I try gold instead?