This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Adding stubs with new symbols and relocs to a (elf32) bfd from within the linker.


I have a made a binutils back-end for a processor we are using for
research purposes.
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?



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]