Discovered while validating xgo-dev/llgo#2691 and draft PR #43.
The generated modernc.org/libc ABI0 wrapper writes outgoing arguments to SP offsets, then calls a Go implementation:
TEXT ·Y__builtin_mul_overflowUint128(SB),$56-52
MOVQ a_Lo+8(FP), AX
MOVQ AX, 8(SP)
MOVQ a_Hi+16(FP), AX
MOVQ AX, 16(SP)
CALL ·X__builtin_mul_overflowUint128(SB)
The amd64 lowering currently initializes SP to zero unless GOARCH=386 and callSym assembles arguments from simulated registers rather than SP memory. Thus accepting the struct signature only produces LLVM IR; it does not preserve the ABI0 call. The real abi0_linux_amd64.s has 1,875 wrappers, 37 of which also use callback trampolines. Translation must model the outgoing SP frame and callback cases before this library can be considered supported. A run test should verify values arrive in X, not just that the LLVM module verifies.
Discovered while validating xgo-dev/llgo#2691 and draft PR #43.
The generated modernc.org/libc ABI0 wrapper writes outgoing arguments to SP offsets, then calls a Go implementation:
The amd64 lowering currently initializes SP to zero unless GOARCH=386 and
callSymassembles arguments from simulated registers rather than SP memory. Thus accepting the struct signature only produces LLVM IR; it does not preserve the ABI0 call. The realabi0_linux_amd64.shas 1,875 wrappers, 37 of which also use callback trampolines. Translation must model the outgoing SP frame and callback cases before this library can be considered supported. A run test should verify values arrive in X, not just that the LLVM module verifies.