This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: MIPS patch to avoid lazy binding in la macros
- From: "Maciej W. Rozycki" <macro at ds2 dot pg dot gda dot pl>
- To: Richard Sandiford <rsandifo at redhat dot com>
- Cc: binutils at sources dot redhat dot com, echristo at redhat dot com
- Date: Mon, 24 Feb 2003 17:50:36 +0100 (MET)
- Subject: Re: MIPS patch to avoid lazy binding in la macros
- Organization: Technical University of Gdansk
On 24 Feb 2003, Richard Sandiford wrote:
> > > Just to be clear, I'm talking about the gcc mips-3_4-rewrite-branch here.
> > > It has two modes: one which uses assembler macros (as current gcc does)
> > > and one that uses explicit %reloc() operators. When using assembler
> > > macros, it gets lazy binding by using "jal foo".
> >
> > So what's the problem in the first place?
>
> Well, there are two problems:
>
> 1) The assembly sequence I posted is an efficient way of testing
> and calling a weak function. It works correctly if assembled
> by an irix assembler.
>
> Now you could say, "well it doesn't work with gas; live with it".
> But IMO this is not really any different from bfd breaking the ABI.
> There have been examples in the past where bfd implemented the
> ABI incorrectly, and it was fixed.
The assembly sequence is OK, but why not simply make gcc use %reloc()
operators for gas and assembler macros for IRIX as?
> Problem (2) is this...
>
> > > > Any "la $25,foo" actually as gcc used not to use the register for
> > > > anything else when emitting SVR4 PIC code.
> > >
> > > Are you sure? What stopped gcc from using $25 for anything else?
> > > Was it declared to be a fixed register?
> >
> > I haven't seen it elsewhere in generated code. But I can't find it being
> > declared a fixed register, either (2.95). It might have been pure luck
> > and I may be wrong, then.
>
> 2) We have two conflicting precedents. On the one hand, gcc treats
> $25 as a general temporary register, on the other, gas treats it
> as special. Both are long-standing, but they aren't compatible.
But with %reloc() operators the problem goes away, doesn't it?
> > BTW, why the naming of "%got" vs "%call16" is inconsistent? I fixed it
> > in my code -- you could do that, too.
>
> Well, I stuck with the NewABI conventions. There doesn't seem
> any point changing to a different name for o32.
There is a point, not necessarily for o32 only: how do you express
something like this (using the notation I used previosly):
la $25,%call(foo)
jal %got(bar)
to get CALL relocations for foo and GOT ones for bar as appropriate for
the selected ABI and GOT model? OK, a minor one, though -- they may be
named say %call_r and %got_r and the NewABI (inconsistent -- who the hell
does invent that stuff?) conventions be left as is.
Frankly, given your %reloc stuff in the trunk I am not that much opposed
to removing the heuristics anymore, but how about deferring it until after
2.14 so that there is a release that can be used either way? That would
ease transition a bit.
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro at ds2 dot pg dot gda dot pl, PGP key available +