Describe the bug
The thirdparty-macos-arm64 tcc build rejects the C11 _Thread_local storage-class specifier with error: _Thread_local is not implemented, even though it's valid ISO C11 and other tcc targets (and every other C compiler V supports) accept it.
This currently breaks v self on Apple Silicon macOS in the main V repo, since V's -prealloc allocator emits a _Thread_local global — see vlang/v#28023 and the fix in vlang/v#28024 (which works around it on the V side by avoiding tcc whenever _Thread_local would be emitted, but the underlying tcc limitation remains).
Reproduction Steps
// repro.c
_Thread_local int g_x;
int main(void) {
g_x = 1;
return g_x - 1;
}
$ ./tcc.exe -o repro repro.c
repro.c:1: error: _Thread_local is not implemented
Expected Behavior
_Thread_local (and ideally the C11 thread_local alias) compiles successfully, consistent with tcc's support for __thread on other platforms.
Current Behavior
error: _Thread_local is not implemented
Environment details
|
|
| tcc version |
tcc version 0.9.28rc 2026-07-24 HEAD@85ba3ae8 (AArch64 Darwin) |
| tccbin branch/commit |
thirdparty-macos-arm64 @ 274abd2 |
| built via |
TCC_COMMIT=85ba3ae8f1e22044255d54c28be04e5fc3e88ae0 TCC_FOLDER=thirdparty/tcc bash thirdparty/build_scripts/thirdparty-macos-arm64_tcc.sh |
| host OS |
macOS 26 (arm64) |
Additional Information/Context
Given tcc already supports __thread as a GNU-style extension on other Mach-O/ELF targets, a minimal fix may be to alias _Thread_local/thread_local to the same codegen path used for __thread on this target, rather than a full generic TLS implementation.
Describe the bug
The
thirdparty-macos-arm64tcc build rejects the C11_Thread_localstorage-class specifier witherror: _Thread_local is not implemented, even though it's valid ISO C11 and other tcc targets (and every other C compiler V supports) accept it.This currently breaks
v selfon Apple Silicon macOS in the main V repo, since V's-preallocallocator emits a_Thread_localglobal — see vlang/v#28023 and the fix in vlang/v#28024 (which works around it on the V side by avoiding tcc whenever_Thread_localwould be emitted, but the underlying tcc limitation remains).Reproduction Steps
Expected Behavior
_Thread_local(and ideally the C11thread_localalias) compiles successfully, consistent with tcc's support for__threadon other platforms.Current Behavior
Environment details
thirdparty-macos-arm64@ 274abd2TCC_COMMIT=85ba3ae8f1e22044255d54c28be04e5fc3e88ae0 TCC_FOLDER=thirdparty/tcc bash thirdparty/build_scripts/thirdparty-macos-arm64_tcc.shAdditional Information/Context
Given tcc already supports
__threadas a GNU-style extension on other Mach-O/ELF targets, a minimal fix may be to alias_Thread_local/thread_localto the same codegen path used for__threadon this target, rather than a full generic TLS implementation.