| ... | @@ -187,9 +187,8 @@ fn wWinMainCRTStartup() callconv(std.os.windows.WINAPI) noreturn { | ... | @@ -187,9 +187,8 @@ fn wWinMainCRTStartup() callconv(std.os.windows.WINAPI) noreturn { |
| 187 | | 187 | |
| 188 | // TODO https://github.com/ziglang/zig/issues/265 | 188 | // TODO https://github.com/ziglang/zig/issues/265 |
| 189 | fn posixCallMainAndExit() noreturn { | 189 | fn posixCallMainAndExit() noreturn { |
| 190 | if (builtin.os.tag == .freebsd) { | 190 | @setAlignStack(16); |
| 191 | @setAlignStack(16); | 191 | |
| 192 | } | | |
| 193 | const argc = argc_argv_ptr[0]; | 192 | const argc = argc_argv_ptr[0]; |
| 194 | const argv = @ptrCast([*][*:0]u8, argc_argv_ptr + 1); | 193 | const argv = @ptrCast([*][*:0]u8, argc_argv_ptr + 1); |
| 195 | | 194 | |
| ... | @@ -208,8 +207,13 @@ fn posixCallMainAndExit() noreturn { | ... | @@ -208,8 +207,13 @@ fn posixCallMainAndExit() noreturn { |
| 208 | @import("os/linux/start_pie.zig").apply_relocations(); | 207 | @import("os/linux/start_pie.zig").apply_relocations(); |
| 209 | } | 208 | } |
| 210 | | 209 | |
| 211 | // Initialize the TLS area | 210 | // Initialize the TLS area. We do a runtime check here to make sure |
| 212 | std.os.linux.tls.initStaticTLS(); | 211 | // this code is truly being statically executed and not inside a dynamic |
| | 212 | // loader, otherwise this would clobber the thread ID register. |
| | 213 | const is_dynamic = @import("dynamic_library.zig").get_DYNAMIC() != null; |
| | 214 | if (!is_dynamic) { |
| | 215 | std.os.linux.tls.initStaticTLS(); |
| | 216 | } |
| 213 | | 217 | |
| 214 | // TODO This is disabled because what should we do when linking libc and this code | 218 | // TODO This is disabled because what should we do when linking libc and this code |
| 215 | // does not execute? And also it's causing a test failure in stack traces in release modes. | 219 | // does not execute? And also it's causing a test failure in stack traces in release modes. |