libffi PowerPC64 ELFv1 fp arg fixes
Segher Boessenkool
segher@kernel.crashing.org
Fri May 4 11:02:00 GMT 2018
On Fri, May 04, 2018 at 07:40:20PM +0930, Alan Modra wrote:
> The attached patch has been accepted into upstream libffi. It fixes
> powerpc64-linux problems shown up by Bruno Haible's new libffi
> testsuite tests. Bootstrapped and regression tested powerpc64-linux
> and powerpc64le-linux. OK mainline and active branches?
That looks fine, and since it is in upstream it counts as obvious I
think?
Is there a test for this, btw?
Segher
> >From a3b6c9db017d3f142031636a9dd6088c5478ca28 Mon Sep 17 00:00:00 2001
> From: Alan Modra <amodra@gmail.com>
> Date: Wed, 2 May 2018 19:10:53 +0930
> Subject: [PATCH] libffi PowerPC64 ELFv1 fp arg fixes
>
> The ELFv1 ABI says: "Single precision floating point values are mapped
> to the second word in a single doubleword" and also "Floating point
> registers f1 through f13 are used consecutively to pass up to 13
> floating point values, one member aggregates passed by value
> containing a floating point value, and to pass complex floating point
> values".
>
> libffi wasn't expecting float args in the second word, and wasn't
> passing one member aggregates in fp registers. This patch fixes those
> problems, making use of the existing ELFv2 homogeneous aggregate
> support since a one element fp struct is a special case of an
> homogeneous aggregate.
>
> I've also set a flag when returning pointers that might be used one
> day. This is just a tidy since the ppc64 assembly support code
> currently doesn't test FLAG_RETURNS_64BITS for integer types..
>
> * src/powerpc/ffi_linux64.c (discover_homogeneous_aggregate):
> Compile for ELFv1 too, handling single element aggregates.
> (ffi_prep_cif_linux64_core): Call discover_homogeneous_aggregate
> for ELFv1. Set FLAG_RETURNS_64BITS for FFI_TYPE_POINTER return.
> (ffi_prep_args64): Call discover_homogeneous_aggregate for ELFv1,
> and handle single element structs containing float or double
> as if the element wasn't wrapped in a struct. Store floats in
> second word of doubleword slot when big-endian.
> (ffi_closure_helper_LINUX64): Similarly.
More information about the Gcc-patches
mailing list