i386: pass and return bare vectors directly, coercing only 8-byte integer vectors,

i386: treat a bit_field as the aggregate it is in C, fixing a segfault on return,
abi test: document the i386 microarch baseline; do not read a signal exit as a type index
This commit is contained in:
kalsprite
2026-08-14 17:38:21 -07:00
parent 90d658f7d9
commit 1e2d91c38b
2 changed files with 65 additions and 2 deletions

View File

@@ -11,9 +11,19 @@ set -eu
# clang (which targets everything) and qemu-user.
#
# ./cross.sh linux_arm64 aarch64-linux-gnu qemu-aarch64
# ./cross.sh linux_i386 i386-linux-gnu qemu-i386
# ./cross.sh linux_i386 i386-linux-gnu qemu-i386 -microarch:pentium4
# ./cross.sh linux_arm32 arm-linux-gnueabihf qemu-arm
# ./cross.sh linux_riscv64 riscv64-linux-gnu qemu-riscv64
#
# i386 needs a microarch: below SSE2 the x86 backend cannot legalise a
# sub-16-byte `f16` vector, and merely declaring a `proc "c"` that takes a
# `#simd[2]f16` aborts the compiler with "LLVM ERROR: Do not know how to split
# the result of this operator!".
#
# `pentium4` is what clang's own default for `i386-linux-gnu` is, `haswell`
# additionally has F16C, which isolates one non-ABI failure: `hfa4_f16`
# diverges at pentium4 and agrees at haswell. It is `_Float16` conversion
# codegen rather than a calling convention
TARGET=${1:?odin target, e.g. linux_arm64}
TRIPLE=${2:?clang triple, e.g. aarch64-linux-gnu}
@@ -115,6 +125,16 @@ set +e
rc=$?
set -e
# A driver that DIES reports 128+signal, and that collides with the type indices: 139 is both
# SIGSEGV and a perfectly good index, so reading it as an index names an innocent type. There is no
# cheap way to tell them apart here. ABI_SKIP is a compile-time `-define`
if [ "$rc" -gt 128 ] && [ "$rc" -lt 165 ]; then
echo "$TARGET: exit $rc is AMBIGUOUS." >&2
echo " Either type index $rc, or the driver died of signal $((rc-128)) (11 = SIGSEGV)." >&2
echo " Re-run with -define:ABI_SKIP=$((rc+1)): if the result moves it was the type," >&2
echo " and if it does not, a wrong-ABI call is corrupting the process." >&2
fi
if [ "$rc" -eq 0 ]; then
echo "$TARGET: every type agrees with clang"
else