Repository navigation
release: v0.6.7 - #107
Merged
Merged
release: v0.6.7#107
Conversation
CHANGELOG [0.6.7] and ROADMAP for the release. README and ARCHITECTURE describe struct returns per ABI (Win64 hidden pointer for sizes other than 1, 2, 4 and 8 bytes, System V float structs in XMM0, arm64 single-member HFA in S0/D0) and drop the note that Windows rejects struct arguments with float members: Win64 passes struct members only in integer slots or by reference, and the float-pair argument test passes on windows-latest. README lists the race detector and FreeBSD VM jobs in CI.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changed
cmd/variadic-test/main.go,examples/struct/main.go,examples/struct/structlib.c,ffi/struct_return_e2e_amd64_test.go,ffi/variadic_e2e_test.go) had an Apache-2.0 header copied from elsewhere and now carry the MIT header. Original files contributed under an Apache-2.0 header keep it until their authors agree to the change. A new CI check (scripts/check-spdx.sh) rejects an Apache-2.0 header without purego's copyright line on any other file.Added
CGO_ENABLED=1test job on Linux, macOS and Windows amd64 (and the FreeBSD VM job) also runsgo test -race; windows/arm64 has no race detector.-raceturns on checkptr, which stops a test when anunsafe.Pointerconversion reaches past a Go allocation — it catches the struct argument over-read fixed below.go testwithCGO_ENABLED=0andCGO_ENABLED=1on FreeBSD 14 and 15 in a VM, on Go 1.25 and the latest stable Go, with the base system C compiler for the C-backed end-to-end tests; it is required for merging. FreeBSD arm64 is still cross-compiled only.Fixed
types.CallInterfacewritten as a struct literal returned some structs wrong. WithoutPrepareCallInterface,Flagsstays 0. Arguments do not depend on it, but struct results do: on System V amd64 a 9–16 byte struct with a floating-point eightbyte ({double, double}such asCGPoint,{int64, double},{double, int64}) was read from RAX:RDX instead of XMM0/XMM1, and on arm64 an HFA (e.g.{double, double}) was read from X0:X1 instead of D0–D3, and a struct larger than 16 bytes was called without the indirect result register X8. No error was returned.CallFunctionnow classifies the struct result of such a CallInterface on each call, on a copy, so a CallInterface shared between goroutines is never written; a CallInterface fromPrepareCallInterfacetakes the same path as before. A nilReturnTypeis now an*InvalidCallInterfaceErrorinstead of a nil-pointer panic, and so is a struct result whoseSizeorAlignmentis not set (onlyPrepareCallInterfacecomputes them). Thetypes.CallInterfacedocumentation now describes both ways of filling it.rvalue. Struct arguments of those sizes are passed as a pointer to a copy, as Win64 requires, instead of a pointer to the caller's value, which the callee was free to modify. The struct-return and{float, float}argument tests no longer skip on Windows.rvalue, which is the caller's struct; for a 3-byte struct five bytes past it were overwritten. Exactly the struct's size is written now.-racecheckptr stopped the program (converted pointer straddles multiple allocations). Struct arguments and the bytes of their last eightbyte are now read with their exact size.float/doublemembers ({float},{double},{float, float}) was read from RAX; the ABI returns it in XMM0. It is now read from XMM0. Win64 is unchanged: it returns such structs in RAX.floatordoublewas read from X0; as a one-member HFA it is returned in S0/D0. It is now read from there.rvaluefor a struct larger than 16 bytes crashed in the callee on System V amd64 and arm64: the result is returned through a hidden pointer, which was then nil. As with libffi, goffi now supplies a temporary buffer for every result returned through a hidden pointer (on Win64 also for the sizes above) and discards it.LoadLibraryorGetSymbolcould belong to another call, or be garbage.dlerror()reports the calling thread's last dynamic-linking error, and its string is valid only until the nextdlerror()on that thread. goffi calleddlopen/dlsymanddlerrorin two separate runtime calls, between which the goroutine could move to another OS thread and another goroutine could use the first one. With 32 goroutines failing at once, errors saidunknown error, named another goroutine's library or symbol, or contained bytes of a freed string. The failed call,dlerror()and the copy of its message now run on one locked OS thread. A new test fails loads and lookups from many goroutines and checks that each error names its own library or symbol.internal/arch/amd64tests could not start (ld-elf.so.1: /lib/libc.so.7: Undefined symbol "environ"): their test binary used the C library withoutinternal/fakecgo, which suppliesenvironon FreeBSD, as theffipackage always does. Seven tests that call the system C library were skipped because they did not know its name on FreeBSD; the C and math library names now live in one place for all tests.