runtime: support Go 1.26 stdlib calls from C libraries - #2098
Merged
xushiwei merged 2 commits intoJul 26, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
39 tasks
cpunion
force-pushed
the
codex/go126-c-library-runtime-hooks
branch
2 times, most recently
from
July 19, 2026 13:38
75c7b56 to
4b2d5d1
Compare
This was referenced Jul 19, 2026
cpunion
marked this pull request as draft
July 19, 2026 15:23
cpunion
force-pushed
the
codex/go126-c-library-runtime-hooks
branch
from
July 19, 2026 17:04
bab45a2 to
dc28e83
Compare
cpunion
force-pushed
the
codex/go126-c-library-runtime-hooks
branch
from
July 20, 2026 01:05
037745f to
de1b304
Compare
cpunion
marked this pull request as ready for review
July 20, 2026 01:46
cpunion
marked this pull request as draft
July 20, 2026 01:49
cpunion
force-pushed
the
codex/go126-c-library-runtime-hooks
branch
from
July 20, 2026 03:03
de1b304 to
048bea5
Compare
cpunion
marked this pull request as ready for review
July 20, 2026 03:25
cpunion
force-pushed
the
codex/go126-c-library-runtime-hooks
branch
from
July 20, 2026 06:00
048bea5 to
e4cc229
Compare
cpunion
force-pushed
the
codex/go126-c-library-runtime-hooks
branch
3 times, most recently
from
July 24, 2026 03:29
b91e889 to
eed7973
Compare
cpunion
force-pushed
the
codex/go126-c-library-runtime-hooks
branch
from
July 26, 2026 01:17
eed7973 to
68ce035
Compare
Provide the Darwin CPU, Linux gettimeofday, and all-thread syscall hooks required by Go 1.26 standard-library code in c-shared and c-archive builds. Exercise them from actual C consumers through fmt.Sprintf, syscall.Gettimeofday, and syscall.AllThreadsSyscall.
cpunion
force-pushed
the
codex/go126-c-library-runtime-hooks
branch
from
July 26, 2026 02:20
68ce035 to
6ffdfff
Compare
xushiwei
added a commit
that referenced
this pull request
Jul 26, 2026
[Based on #2098] runtime,test: complete Go 1.26 standard-library coverage
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.
Problem
With Go 1.26,
c-sharedandc-archiveexports that retain standard-library code need runtime hooks LLGo did not provide: Darwin CPU initialization needs the newsysctlbynamebridges, while Linuxsyscallneedsgettimeofday, all-thread syscall, and cgo-caller symbols.Linux
c-sharedalso registered its constructor throughllvm.global_ctors. The raw LLVM target machine lowers that to legacy.ctors, so LLD may not run the runtime and reflection-ABI initialization before C first calls an exported Go function.Fix
internal/cpusysctl bridges through LLGo's dynamic-import trampoline;gettimeofdaybridge and returnENOTSUPfor thread-wide operations LLGo cannot safely implement;c-sharedconstructor in.init_array, retaining the existing platform lowering forc-archiveand Darwin;fmt.Sprintf,syscall.Gettimeofday, andsyscall.AllThreadsSyscallfrom real static and dynamic C consumers.The independent diff against current
mainis+151/-7across 11 files.Validation
c-sharedandc-archivebuild, link, execute, and resolve Go DWARF source locations.internal/buildcoverage is 73.6%;defineLibraryRuntimeInitis 100% covered on both platforms.Closes #2096.