Skip to content

v0.11.0-alpha.7

@hajimehoshi hajimehoshi tagged this 15 Jul 03:35
Pass and return structs by value when calling C functions under the
ELFv2 ABI: a homogeneous floating-point aggregate is passed and returned
in the floating-point registers whatever its size, any other aggregate
occupies successive doublewords in the general-purpose registers and the
parameter save area, and a non-homogeneous aggregate larger than two
doublewords is returned through a caller-allocated buffer. Scalar float32
arguments are passed in double-precision format, matching the FMOVD-based
convention already used for float32 struct members and float returns;
reading float32 callback arguments does the inverse conversion.

Widen structReturnInMemory to take the return type rather than its size,
so ppc64le can keep a homogeneous floating-point aggregate in registers
regardless of size while every other architecture keeps its size-only
rule.

Struct arguments and returns in callbacks remain unsupported, as on the
other non-amd64/arm64 architectures. Aggregates that need more than eight
floating-point argument registers, and functions taking mixed scalar
floating-point and integer arguments, are not yet handled; the latter
needs the ELFv2 general-purpose register shadowing that purego does not
model for scalar arguments.

Updates #474

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Assets 2
Loading