| ... | ... | @@ -11,32 +11,28 @@ |
| 11 | 11 | |
| 12 | 12 | const builtin = @import("builtin"); |
| 13 | 13 | const std = @import("std"); |
| 14 | | |
| 15 | | const compiler_rt = @import("../../compiler_rt.zig"); |
| 16 | | const symbol = compiler_rt.symbol; |
| 17 | | |
| 18 | 14 | const elf = std.elf; |
| 19 | 15 | const assert = std.debug.assert; |
| 20 | 16 | const native_arch = builtin.cpu.arch; |
| 21 | 17 | const linux = std.os.linux; |
| 22 | 18 | const page_size_min = std.heap.page_size_min; |
| 23 | 19 | |
| 20 | const compiler_rt = @import("../../compiler_rt.zig"); |
| 21 | const symbol = compiler_rt.symbol; |
| 22 | |
| 24 | 23 | comptime { |
| 25 | | // FreeBSD, NetBSD, and OpenBSD are expected to also use this in the future. |
| 26 | | if (!builtin.link_libc and builtin.target.os.tag == .linux) { |
| 27 | | symbol(&__zig_elf_static_tls, "__zig_elf_static_tls"); |
| 28 | | symbol(&__zig_elf_static_tls_init, "__zig_elf_static_tls_init"); |
| 29 | | symbol(&__zig_elf_static_tls_fill, "__zig_elf_static_tls_fill"); |
| 30 | | |
| 31 | | // To make static executables without libc work, it is our job to provide the TLS accessor |
| 32 | | // function for the GD and LD models. This function is unlikely to actually be used, since |
| 33 | | // the linker should be able to relax every TLS access to the LE model and therefore |
| 34 | | // eliminate all calls to this function, but that isn't guaranteed. |
| 35 | | if (native_arch == .s390x) |
| 36 | | symbol(&__tls_get_offset, "__tls_get_offset") |
| 37 | | else |
| 38 | | symbol(&__tls_get_addr, "__tls_get_addr"); |
| 39 | | } |
| 24 | symbol(&__zig_elf_static_tls, "__zig_elf_static_tls"); |
| 25 | symbol(&__zig_elf_static_tls_init, "__zig_elf_static_tls_init"); |
| 26 | symbol(&__zig_elf_static_tls_fill, "__zig_elf_static_tls_fill"); |
| 27 | |
| 28 | // To make static executables without libc work, it is our job to provide the TLS accessor |
| 29 | // function for the GD and LD models. This function is unlikely to actually be used, since the |
| 30 | // linker should be able to relax every TLS access to the LE model and therefore eliminate all |
| 31 | // calls to this function, but that isn't guaranteed. |
| 32 | if (native_arch == .s390x) |
| 33 | symbol(&__tls_get_offset, "__tls_get_offset") |
| 34 | else |
| 35 | symbol(&__tls_get_addr, "__tls_get_addr"); |
| 40 | 36 | } |
| 41 | 37 | |
| 42 | 38 | /// Represents an ELF TLS variant. |