[PATCH] MIPS objdump: Recognize o64 ABI names
Maciej W. Rozycki
macro@orcam.me.uk
Sat Feb 22 21:04:13 GMT 2025
On Sun, 16 Feb 2025, Maximilian Ciric wrote:
> With the recent addition of both EABIs, this completes support for the standard
> ABI options (ABI-breaking options such as -modd-spreg or -mabi=32 -mfp64
> notwithstanding). The names have been verified against GCC's usage of the
> registers. Notably, the only(?) documentation that defines the o64 ABI at
>
> https://gcc.gnu.org/projects/mipso64-abi.html
>
> appears to contain a mistake w.r.t. floating-point arguments. In particular:
>
> > If the first and second arguments floating-point arguments to a function are
> > 32-bit values, they are passed in $f12 and $f14.
>
> This does not happen in GCC's implementation of the ABI; a pair of single-float
> arguments are still passed in $f12 and $f13, the same as when one or both of the
> arguments are double-precision floats. The registers $f12, $f13 and $f14 have
> been named $fa0, $fa1 and $ft10 to match the implementation.
The ABI was amended in GCC 4.0.0 with commit b11a9d5f3f90 back in 2004:
(mips_arg_info): Don't allow fpr_p to affect the register or
stack alignment. Remove o64 silliness.
with the quirk IMHO rightfully referred to as "silliness". So be it, we
set the standard for o64. I think I might be able to fix the web page if
I remember/chase how to do it.
NB we do have a similar quirk still in GCC: on n32/n64 a `long double'
result is correctly returned in $f0/$f2, but a `struct { long double }'
one is oddly returned in $f0/$f1, showing as a bunch of failures in GDB
test results for 20+ years now. The 64-bit MIPS psABI says:
"
* Function results are returned in $2 (and $3 if needed), or $f0 (and $f2
if needed), as appropriate for the type. Composite results (`struct',
`union', or `array') are returned in $2/$f0 and $3/$f2 according to the
following rules:
- A `struct' with only one or two floating point fields is returned in
$f0 (and $f2 if necessary). This is a generalization of the Fortran
COMPLEX case.
[... No further mention of FPRs.]
"
-- making it clear $f1 is not supposed to be used for return values. I
guess it'll have to stay forever for backwards compatibility though, it
was already problematic when I discovered it back those ~20 years ago.
Change applied with a reference to GCC 4.0.0 added and the description
reformatted to fit in 72 columns. Please keep them such with your future
submissions. There was some patch corruption too in the form of broken
long lines which I have fixed up by hand as it wasn't complex.
Thank you for your contribution.
Maciej
More information about the Binutils
mailing list