mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 16:45:27 +00:00
cb1fffb29e
`__xl_a` is just a global variable containing a null function pointer. There's nothing magical about it or its name at all. The section names used on `__xl_a` and `__xl_b` (`.CRT$XLA` and `.CRT$XLZ`) are the real magic here. The compiler emits TLS variables into `.CRT$XL<x>` sections, where `x` is an uppercase letter between A and Z (exclusive). The linker then sorts those sections alphabetically (due to the `$`), and the result is a neat array of TLS initialization callbacks between `__xl_a` and `__xl_z`. That array is null-terminated, though! Normally, `__xl_z` serves as the null terminator; however, by pointing `AddressesOfCallBacks` to `__xl_a`, which just contains a null function pointer, we've effectively made it so that the PE loader will just immediately stop invoking TLS callbacks. Fix that by pointing to the first actual TLS callback instead (or `__xl_z` if there are none). |
||
---|---|---|
.. | ||
advapi32.zig | ||
crypt32.zig | ||
kernel32.zig | ||
lang.zig | ||
nls.zig | ||
ntdll.zig | ||
ntstatus.zig | ||
sublang.zig | ||
test.zig | ||
tls.zig | ||
win32error.zig | ||
ws2_32.zig |