0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/lib/std/os
Alex Rønne Petersen 736d37ad16
move std.os.linux.tls to compiler_rt as __zig_elf_static_tls_*
As with __zig_elf_auxv, we need a canonical location for __tls_get_addr (or
__tls_get_offset on s390x), and compiler-rt is the obvious place. But that also
means that moving all of std.os.linux.tls there just makes sense. I decided not
to namespace this under linux because it's expected that most of this code will
apply to the BSDs too.

The ABI that std now expects is:

    extern fn __zig_elf_static_tls_init(phdrs: [*]elf.ElfN.Phdr, phnum: usize) void;
    extern fn __zig_elf_static_tls_fill(area: [*]u8) usize;
    extern var __zig_elf_static_tls: extern struct {
        size: usize,
        alignment: usize,
        gdt_entry_number: usize,
    };

Users can override all three weak symbols with strong symbols if they want to
provide their own ELF TLS implementation, which may be useful to do when doing
manual dynamic loading from a static executable. Note that __tls_get_addr (or
__tls_get_offset on s390x) must also be provided, per the ELF TLS specification.
History 2026-10-05 03:26:41 +02:00
..
linux move std.os.linux.tls to compiler_rt as __zig_elf_static_tls_* 2026-10-05 03:26:41 +02:00
plan9 zig fmt 2026-07-17 23:30:26 +02:00
uefi zig fmt 2026-07-17 23:30:26 +02:00
windows Threaded.createFileMap: fix handling of populate on Windows 2026-09-29 02:46:27 +02:00
emscripten.zig Give pollfd.revents a default value 2026-08-20 21:53:39 +02:00
linux.zig move std.os.linux.tls to compiler_rt as __zig_elf_static_tls_* 2026-10-05 03:26:41 +02:00
plan9.zig zig fmt 2026-07-17 23:30:26 +02:00
uefi.zig zig fmt 2026-07-17 23:30:26 +02:00
wasi.zig remove support for wasi-libc 2026-10-04 18:23:18 +02:00
windows.zig Threaded.createFileMap: fix handling of populate on Windows 2026-09-29 02:46:27 +02:00