This is the mail archive of the binutils@sources.redhat.com 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: RFC: Patch to fix MIPS -mno-shared with multi-got...


Thiemo Seufer wrote:
David Daney wrote:
[snip]

WRT possible breakge to things expecting the real "_gp": I agree that
might be a problem.  One possibility would be to define a new symbol,
something like __gnu_local_gp, and make -mno-shared use that instead
of plain _gp.  -mno-shared is a new option, so there's no backwards
compatiblity problem.

OK, I kind of like this idea. But I am not an ABI authority. I am assuming the the meaning of "_gp_disp" is defined somewhere in the ABI specs. I know _gp is specified. Does anybody have objections to adding the new magic __gnu_local_gp symbol?


I have the general (and still vague) idea to have multigot-capable object
files, with _gp _gp.1 .. _gp.n and _gp_disp _gp_disp.1 .. _gp_disp.n
depending on the GOT in use, and with the single got case staying binary
compatible. I think this would cover your case as well, but it's of
course much more work.


I don't think that solves the problem we are talking about.


The main problem is that with -mno-shared you get object files with this:

    lui    $gp,%hi(_gp)
    addiu    $gp,$gp,%lo(_gp)

Where _gp refers to which ever GOT that the linker assignes to the module.

But it is possible to have C code like this:

extern int _gp;


int foo() { int *bar = &_gp; /* Do something with the primary GOT */ }

In this case the existing semantics are clear. It is the primary GOT.


My original patch changed the semantics of the above C program. Richard's suggestion to use __gnu_local_gp lets us have the desired semantics for .cpload with out changing those of the C program.


David Daney.



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