vself: do not default to tcc on macOS arm64 when it would just fail - #28024
Open
quaesitor-scientiam wants to merge 1 commit into
Open
vself: do not default to tcc on macOS arm64 when it would just fail#28024quaesitor-scientiam wants to merge 1 commit into
quaesitor-scientiam wants to merge 1 commit into
Conversation
Preferences.fill_with_defaults() forces `-prealloc` on for any macOS build of V itself when no real GC is selected, which is exactly what a plain `v self` does via its implicit `-gc none`. `-prealloc` emits its allocator global as `_Thread_local`, a C11 keyword the bundled tcc does not implement, so the compile always fails and silently falls back to `cc`. The builder already guards against defaulting to tcc when prealloc is set, but `v self` bypasses that guard by passing an explicit `-cc tcc` for Apple Silicon before the guard ever runs. Only add `-cc tcc` there when the caller explicitly picked a real GC via `-gc`, which is the one case prealloc isn't forced and tcc stays compatible. Fixes vlang#28023 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Member
|
Not the right fix. Need to use tcc by default. |
Contributor
Author
fixes the warning which is false because it currently bypasses the guard the tcc issue i found is at vlang/tccbin#86 |
Collaborator
|
It may fix the warning, but the right fix will be to make tcc work as expected, rather than just blocking it. |
Contributor
Author
Requires vlang/tccbin#86 to be completed |
Contributor
Author
|
See comments #28023 (comment) |
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.
Summary
v selfon Apple Silicon macOS always fails to compile with the bundledtccand silently falls back tocc, as reported in mac:v selfnot working withtcc#28023.Preferences.fill_with_defaults()forces-preallocon for macOS builds of V itself when no real GC is selected (exactly whatv self's implicit-gc nonedoes).-preallocdeclares its allocator globalg_memory_blockas_Thread_local, a C11 keyword the bundled tcc does not implement.try_to_use_tcc_by_default()already avoids defaulting to tcc when-preallocis set, butcmd/tools/vself.vbypasses that guard by unconditionally injecting an explicit-cc tccfor Apple Silicon before the guard ever runs.-cc tccinvself.vwhen the caller explicitly requested a real GC via-gc(the one case where-preallocisn't forced and tcc remains compatible). Plainv self(andv self -gc none) now goes straight toccwith no failing attempt;v self -gc boehmstill gets the fast tcc path.Test plan
v self→warning: tcc compilation failed, falling back to cc), traced it to the_Thread_local g_memory_blockdeclaration via-keepc.v self,v self -gc none, andv self -gc boehmall build cleanly after the fix, with correct compiler selection in each case.v test vlib/v/builder/cc_tcc_retry_test.vpasses.v fmt -verify cmd/tools/vself.vpasses.Fixes #28023
🤖 Generated with Claude Code