| ... | @@ -211,12 +211,16 @@ fn initTLS() void { | ... | @@ -211,12 +211,16 @@ fn initTLS() void { |
| 211 | } | 211 | } |
| 212 | } | 212 | } |
| 213 | | 213 | |
| 214 | // If the cpu is ARM-based, check if it supports the TLS register | 214 | // ARMv6 targets (and earlier) have no support for TLS in hardware |
| 215 | if (comptime builtin.arch.isARM() and at_hwcap & std.os.linux.HWCAP_TLS == 0) { | 215 | // FIXME: Elide the check for targets >= ARMv7 when the target feature API |
| 216 | // If the CPU does not support TLS via a coprocessor register, | 216 | // becomes less verbose (and more usable). |
| 217 | // a kernel helper function can be used instead on certain linux kernels. | 217 | if (comptime builtin.arch.isARM()) { |
| 218 | // See linux/arch/arm/include/asm/tls.h and musl/src/thread/arm/__set_thread_area.c. | 218 | if (at_hwcap & std.os.linux.HWCAP_TLS == 0) { |
| 219 | @panic("TODO: Implement ARM fallback TLS functionality"); | 219 | // FIXME: Make __aeabi_read_tp call the kernel helper kuser_get_tls |
| | 220 | // For the time being use a simple abort instead of a @panic call to |
| | 221 | // keep the binary bloat under control. |
| | 222 | std.os.abort(); |
| | 223 | } |
| 220 | } | 224 | } |
| 221 | | 225 | |
| 222 | var tls_align_factor: usize = undefined; | 226 | var tls_align_factor: usize = undefined; |