Add AArch64 objects with floating-point arguments - #216
Conversation
tests/aarch64/manyfloatsum is the existing tests_src/manyfloatsum.c built for AArch64, which had builds for i386, s390x and x86_64 only. tests_src/arch/aarch64/hfa_args_aarch64.c is new: its functions take homogeneous floating-point aggregates, which AAPCS64 spreads one member per SIMD register.
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Validation record for head
Read back with angr at Build toolchain: Caveats: this repository has no executable test suite, so nothing here runs beyond the readback above; the objects are exercised by the angr pull request that links this one. |
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Both new objects loaded and called through Before — every floating-point argument is laid out on the stack and every aggregate one angr masterAfter — every call returns the value the compiled AArch64 code computes: with the consumer pull request applied |
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS
Problem
Nothing tracked here lets a consumer assert what angr does with an AArch64 floating-point
argument.
tests_src/manyfloatsum.cis the repository's own input for that question andls tests/*/manyfloatsumreturnsi386,s390xandx86_64, so the three architecturesangr's
run_manyfloatsumcovers are all ones whose floating-point arguments share theinteger registers or the stack. No object here takes a homogeneous floating-point aggregate
by value either: the AArch64 aggregate-argument object added in #214 holds
Point{long,long},Big{long x5}andBlob{int[4]}, all integer.Root cause
AAPCS64 passes floating-point and short-vector arguments in
v0-v7, a register file noother architecture built here uses that way, and an aggregate whose members are all the same
floating-point type is spread one member per register. Neither shape exists in any committed
AArch64 object.
Fix
Two objects, both reproduced byte for byte from the commands recorded with them.
tests/aarch64/manyfloatsum, 13488 bytes, is the existingtests_src/manyfloatsum.cbuiltwith
aarch64-unknown-linux-gnu-gcc -O0 -Wl,--dynamic-linker=/lib/ld-linux-aarch64.so.1 -Wl,--build-id=none -Wl,--strip-debug -Wl,-z,max-page-size=4096, thenpatchelf --remove-rpath.tests/aarch64/hfa_args_aarch64.so, 5872 bytes, is built fromtests_src/arch/aarch64/hfa_args_aarch64.cwith the recipe at the top of that source; itsfour functions take a two-double aggregate, a three-float aggregate, an aggregate beside an
integer and a double, and an aggregate that arrives one register too late to fit.
Testing
Loading
hfa_args_aarch64.sowith angr ata9ca247a5and asking for the argument locationsof
take_pairraisesTypeError: <SimCCAArch64> doesn't know how to store aggregate type,and calling
sum_floatsinmanyfloatsumreturns a symbolicw0where the same call ontests/x86_64/manyfloatsumreturns 171.0. The consumer is the angr pull request that linksthis one.
Validation: #216 (comment)
session: sharpen