Skip to content

Commit 03facba

Browse files
committed
std.Target: require libc for Android API levels prior to 29
Emulated TLS depends on libc pthread functions. Closes #24589.
1 parent 259b7c3 commit 03facba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/std/Target.zig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2023,7 +2023,12 @@ pub fn requiresLibC(target: *const Target) bool {
20232023
.serenity,
20242024
=> true,
20252025

2026-
.linux
2026+
// Android API levels prior to 29 did not have native TLS support. For these API levels, TLS
2027+
// is implemented through calls to `__emutls_get_address`. We provide this function in
2028+
// compiler-rt, but it's implemented by way of `pthread_key_create` et al, so linking libc
2029+
// is required.
2030+
.linux => target.abi.isAndroid() and target.os.version_range.linux.android < 29,
2031+
20272032
.windows,
20282033
.freebsd,
20292034
.netbsd,

0 commit comments

Comments
 (0)