commit 03facba4963abd142985c9617ca38de46b1615f1 (tree)
parent 259b7c3f3fc3f8902f8aa4e6e7539df271073a47
Author: Alex Rønne Petersen <alex@alexrp.com>
Date: Wed, 30 Jul 2025 18:59:08 +0200
std.Target: require libc for Android API levels prior to 29
Emulated TLS depends on libc pthread functions.
Closes #24589.
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/std/Target.zig b/lib/std/Target.zig
@@ -2023,7 +2023,12 @@ pub fn requiresLibC(target: *const Target) bool {
.serenity,
=> true,
- .linux
+ // Android API levels prior to 29 did not have native TLS support. For these API levels, TLS
+ // is implemented through calls to `__emutls_get_address`. We provide this function in
+ // compiler-rt, but it's implemented by way of `pthread_key_create` et al, so linking libc
+ // is required.
+ .linux => target.abi.isAndroid() and target.os.version_range.linux.android < 29,
+
.windows,
.freebsd,
.netbsd,