aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os/linux/tls.zig
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-10-18 21:54:24 +0200
committerAndrew Kelley <andrew@ziglang.org>2020-10-21 23:35:06 -0400
commit0c355bef9e424fbf06085f12fc28979d73b3d6af (patch)
treeb7ccd34b0ce21c303ed3fb69fa2f17e10efc9a0e /lib/std/os/linux/tls.zig
parent1e074879046354db1b556fc9eda51bc8dac5c6b7 (diff)
downloadzig-0c355bef9e424fbf06085f12fc28979d73b3d6af.tar.gz
zig-0c355bef9e424fbf06085f12fc28979d73b3d6af.zip
std: Slim down the error code path in initStaticTLS
Calling @panic made the executable ~30x times bigger, use a simple `abort()` and let the user figure out what went wrong. Supporting ARMv6 (and earlier?) platforms is not a priority. Closes #6676
Diffstat (limited to 'lib/std/os/linux/tls.zig')
-rw-r--r--lib/std/os/linux/tls.zig16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/std/os/linux/tls.zig b/lib/std/os/linux/tls.zig
index 0330a4e410..69e7816f13 100644
--- a/lib/std/os/linux/tls.zig
+++ b/lib/std/os/linux/tls.zig
@@ -211,12 +211,16 @@ fn initTLS() void {
}
}
- // If the cpu is ARM-based, check if it supports the TLS register
- if (comptime builtin.arch.isARM() and at_hwcap & std.os.linux.HWCAP_TLS == 0) {
- // If the CPU does not support TLS via a coprocessor register,
- // a kernel helper function can be used instead on certain linux kernels.
- // See linux/arch/arm/include/asm/tls.h and musl/src/thread/arm/__set_thread_area.c.
- @panic("TODO: Implement ARM fallback TLS functionality");
+ // ARMv6 targets (and earlier) have no support for TLS in hardware
+ // FIXME: Elide the check for targets >= ARMv7 when the target feature API
+ // becomes less verbose (and more usable).
+ if (comptime builtin.arch.isARM()) {
+ if (at_hwcap & std.os.linux.HWCAP_TLS == 0) {
+ // FIXME: Make __aeabi_read_tp call the kernel helper kuser_get_tls
+ // For the time being use a simple abort instead of a @panic call to
+ // keep the binary bloat under control.
+ std.os.abort();
+ }
}
var tls_align_factor: usize = undefined;