| ... | @@ -133,7 +133,7 @@ pub fn initTLS() void { | ... | @@ -133,7 +133,7 @@ pub fn initTLS() void { |
| 133 | var at_phent: usize = undefined; | 133 | var at_phent: usize = undefined; |
| 134 | var at_phnum: usize = undefined; | 134 | var at_phnum: usize = undefined; |
| 135 | var at_phdr: usize = undefined; | 135 | var at_phdr: usize = undefined; |
| 136 | var at_hwcap: ?usize = null; | 136 | var at_hwcap: usize = undefined; |
| 137 | | 137 | |
| 138 | var i: usize = 0; | 138 | var i: usize = 0; |
| 139 | while (auxv[i].a_type != std.elf.AT_NULL) : (i += 1) { | 139 | while (auxv[i].a_type != std.elf.AT_NULL) : (i += 1) { |
| ... | @@ -146,16 +146,6 @@ pub fn initTLS() void { | ... | @@ -146,16 +146,6 @@ pub fn initTLS() void { |
| 146 | } | 146 | } |
| 147 | } | 147 | } |
| 148 | | 148 | |
| 149 | // If the cpu is arm-based, check if it supports the TLS register | | |
| 150 | if (at_hwcap) |hwcap| { | | |
| 151 | if (builtin.arch == builtin.Arch.arm and hwcap & std.os.linux.HWCAP_TLS == 0) { | | |
| 152 | // If the CPU does not support TLS via a coprocessor register, | | |
| 153 | // a kernel helper function can be used instead on certain linux kernels. | | |
| 154 | // See linux/arch/arm/include/asm/tls.h and musl/src/thread/arm/__set_thread_area.c. | | |
| 155 | @panic("TODO: Implement ARM fallback TLS functionality"); | | |
| 156 | } | | |
| 157 | } | | |
| 158 | | | |
| 159 | // Sanity check | 149 | // Sanity check |
| 160 | assert(at_phent == @sizeOf(elf.Phdr)); | 150 | assert(at_phent == @sizeOf(elf.Phdr)); |
| 161 | | 151 | |
| ... | @@ -171,6 +161,14 @@ pub fn initTLS() void { | ... | @@ -171,6 +161,14 @@ pub fn initTLS() void { |
| 171 | } | 161 | } |
| 172 | | 162 | |
| 173 | if (tls_phdr) |phdr| { | 163 | if (tls_phdr) |phdr| { |
| | 164 | // If the cpu is arm-based, check if it supports the TLS register |
| | 165 | if (builtin.arch == builtin.Arch.arm and hwcap & std.os.linux.HWCAP_TLS == 0) { |
| | 166 | // If the CPU does not support TLS via a coprocessor register, |
| | 167 | // a kernel helper function can be used instead on certain linux kernels. |
| | 168 | // See linux/arch/arm/include/asm/tls.h and musl/src/thread/arm/__set_thread_area.c. |
| | 169 | @panic("TODO: Implement ARM fallback TLS functionality"); |
| | 170 | } |
| | 171 | |
| 174 | // Offsets into the allocated TLS area | 172 | // Offsets into the allocated TLS area |
| 175 | var tcb_offset: usize = undefined; | 173 | var tcb_offset: usize = undefined; |
| 176 | var dtv_offset: usize = undefined; | 174 | var dtv_offset: usize = undefined; |