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]

Re: MIPS stubs in Gold

Aleksandar Simeonov <> writes:

> Situation is as follows:
> Some function calls need special handling depend on flags and relocation
> type. In that case, some additional stub code is needed. There are two
> types of stubs. One that goes immediately before function and it only
> contains loading of function address in some register and second that
> goes on arbitrary place in .text section (usually at the end) and
> contains loading of function address in some register and jump to that
> function. Also, relocations that are related to that function call has
> to be changed in a way to point to that new code. New relocation has to
> be added to the stub code to fix function address in it. Additional
> problem for the first type of stub is that is has to be just before
> function in .text section (it is only used if function is at the
> beginning of the .text section).
> I looked at ARM code, also I looked at implementation of plt, but I
> didn't manage to find what I needed.
> Can someone give me some hints or ideas what to do and how to proceed
> with this? Also, which details can help and which can't (there are quite
> some code in ARM implementation of Gold :-)).

When scanning relocs you need to figure out what stubs you need.  Then
you need to generate the stubs.

When you say that a stub needs to go immediately before the function, I
assume that you will be compiling with -ffunction-sections, or you will
be generating the stubs in the compiler.  In general the linker can not
pull apart a section which contains two functions in order to put stub
code before the function.  To add a stub before a section you will
probably need a new target hook somewhere in the layout code.

Other than that your question is kind of general, and it's hard to
answer a general question.  Nobody has implemented a MIPS port of gold
before, so we can't tell you exactly what to do.  What you should do is
two different things: 1) figure out as simply and as precisely as
possible exactly what you have to do--this may be done; 2) figure out
how gold works, independently of what you want to do.  Once you've done
those things, it should be fairly obvious what you need to change in the
gold linking process.  I hope that will then lead you to more specific
questions which we can answer.


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