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


David Daney wrote:
> 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.

With the proposed scheme it could be _gp.n, with a renumbering from the
intermediate object to the final module (and _gp for the primary GOT).

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

Whithout having looked it up, I doubt the ABI gives the program any
guarantee about the contents of the GOT.


Thiemo


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