builder: declare Darwin socket and process symbols - #5636
Open
yohimik wants to merge 2 commits into
Open
Conversation
This was referenced Aug 30, 2026
yohimik
force-pushed
the
upstream-pr/darwin-socket-symbols
branch
from
September 2, 2026 08:50
702b4e8 to
8153e9a
Compare
Author
|
Rebased on dev after the 0.42.0 release. The change applies on top of v0.42.0 |
yohimik
force-pushed
the
upstream-pr/darwin-socket-symbols
branch
from
September 5, 2026 02:28
8153e9a to
e8394f6
Compare
yohimik
added a commit
to yohimik/tinygo
that referenced
this pull request
Sep 5, 2026
Use posix_spawn on hosted Linux and Darwin. Map process files, apply the working directory and process group, and clear the child signal mask. Use wait4 for process status and support Kill and Signal. Mark Darwin pipes close-on-exec under ForkLock. Darwin also needs the fcntl wrapper in PR tinygo-org#5612 and the libSystem symbols in PR tinygo-org#5636. Concurrent spawn and pipe creation need the RWMutex fix in PR tinygo-org#5630. Keep the process stubs on other targets and add process regression tests.
This was referenced Sep 5, 2026
yohimik
added a commit
to yohimik/tinygo
that referenced
this pull request
Sep 5, 2026
Open /dev/null in the child before closing a nil or unnamed descriptor. Save remap sources before these actions. This avoids a parent descriptor check and its race with concurrent open. Use descriptor reads and exec redirection in remap tests. Check nil slots and temporary descriptors. The tests pass with ordinary Go on Darwin and Linux. Both TinyGo os suites pass with released compiler source overlays. Darwin also needs the addopen symbol from PR tinygo-org#5636.
yohimik
added a commit
to yohimik/tinygo
that referenced
this pull request
Sep 5, 2026
Open /dev/null in the child before closing a nil or unnamed descriptor. Save remap sources before these actions. This avoids a parent descriptor check and its race with concurrent open. Use descriptor reads and exec redirection in remap tests. Check nil slots and temporary descriptors. The tests pass with ordinary Go on Darwin and Linux. Both TinyGo os suites pass with released compiler source overlays. Darwin also needs the addopen symbol from PR tinygo-org#5636.
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.
Scope
Add the libSystem declarations needed for Darwin sockets and posix_spawn. The minimal SDK does not provide these symbols. The builder assembles a second stub object and links it with the SDK object.
This branch now contains only the builder change and a direct socket test. The copied fcntl, process, weak-pointer and TLS commits have been removed. The shared builder support moved here from #5634 so that it has one owner. #5634 will depend on this PR instead of carrying a second copy.
This change does not need a net submodule update. A program can call the standard syscall socket API directly. Full netdev support is a separate dependency of tinygo-org/net#74.
The posix_spawn_file_actions_addchdir_np symbol requires macOS 10.15 or later when used by the process implementation.
Verification
The new host-only test testdata/darwinsockets.go creates a loopback listener with the syscall package, obtains its assigned port, connects, accepts, checks the peer address and shuts down the connection. It does not use the TinyGo netdev or require an external service.
The test passed with ordinary Go on native Darwin arm64. CI for the new TinyGo branch is pending. The earlier 24-check result was for the old combined branch and is not a result for this head.
The released fork already uses the same extra-stub mechanism for its socket and process probes. That is integration evidence, not a substitute for the new independent branch test.
Downstream context
The dispat acceptance record covers files, environment variables, pipes, child processes, goroutines, network clients, real TLS, certificate rejection and self-update rollback. See the recorded acceptance. Those results are for the combined fork and the revisions named in that document. They do not prove that this one PR supplies all those features.
Related pull requests
The target partition below keeps each change in one PR. The process branch cleanup is still in progress.
In tinygo-org/net
Full Darwin networking also needs the merged net changes and a later src/net pin update. No upstream merge or current full-suite pass is implied by this list.
Additional independent gaps found in Crier are covered by #5655 (cookie-jar loader merge) and tinygo-org/net#82 (ListenConfig). They do not duplicate the process, TLS, deadline or server-TLS changes above. Current Crier comparison work is separate from its standard-Go release.
Current Crier comparison
The same-source Crier report records 143 passing Linux ARM64 end-to-end tests for Go, TinyGo, and a symbol-stripped TinyGo copy. The last is 13,829,248 bytes versus Go's 30,277,794 bytes. The tests cover the recorded CLI paths, not general Go compatibility. Two render fixtures exceed pixel tolerance, and the tested Darwin TinyGo binary fails before main. This evidence uses the earlier released compiler with the exact source overlays named in the report. It does not validate this PR head or the new fork candidate. The standard-Go Crier release is separate.