This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH] Fix distinction of 32/64bit addresses in MIPS gas
Richard Sandiford wrote:
> > That's right, but you can't tell if it is actually o32 conformant
> > by looking at the ELF header. There is no flag which says
> > "Warning! This object does not conform to any established ABI".
> > It would be nice to have one.
> Well, there's the O32 flag, which is only set if -mabi=32 is given.
> That bit does guarantee register and address size, just not the lack of
> 64-bit relocs generated by .8byte and the like. Maybe GAS should warn
> about that?
How could it do that? The o32 ABI does _not_ specify this flag,
a file without any ABI flags set is a valid o32 file. I can't
see what the use of the O32 header flag could be.
> > That's all fine for 32bit, but I needed a way to check if 64bit
> > addresses can be used generally (e.g. for dli). Something like
> > ! HAVE_32BIT_ADDRESSES won't do that, because full 64bit support
> > needs a 64bit object format.
> But *limited* 64-bit support is available with elf32 as things stand...
> > Having a HAVE_64BIT_ADDRESSES macro which is _not_ the inverse of
> > HAVE_32BIT_ADDRESSES is ugly.
> ...so I'm still unsure why that's necessary.
I want to have full 64bit support, and it's conceptionally the right
thing to keep the variants of 64bit support at a minimum. AFAICS my
patch doesn't break the limited 64bit support.
> > I also found no reason why there is made use of 64bit instructions
> > like daddiu for a 32bit load. It makes the code look different from
> > o32 while doing the same.
> But if the code was written or compiled with 64-bit addresses in mind,
> it seems natural enough to use daddu in pointer arithmetic. Does it do
> any harm?
Yes, it inflates the number of variants without need.
> The only reason I can see for making HAVE_32BIT_ADDRESSES any
> stricter is if there's a situation in which code written for 32-bit
> addresses can't be assembled that way as things stand, presumably
> because GAS's command-line options are too inflexible.
Then I would need to distinguish between (! HAVE_32BIT_ADDRESSES)
and HAVE_64BIT_ADDRESSES, building a trap for everyone else.
MIPS gas is really complicated enough with ISA, ABI and object