diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-07-21 23:52:32 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-07-22 14:26:17 -0700 |
| commit | bde8c4a46ac924504ef851c733947cb6364d8add (patch) | |
| tree | 91373889b3b57f5992c8c59f1a755e7121c8722b /lib/std/start.zig | |
| parent | 25198810c88d474c63ff537e3647f12e7df6297c (diff) | |
| download | zig-bde8c4a46ac924504ef851c733947cb6364d8add.tar.gz zig-bde8c4a46ac924504ef851c733947cb6364d8add.zip | |
update start code to use `@disableInstrumentation`
This prevents it from trying to access thread local storage before it
has set up thread local storage, particularly when code coverage
instrumentation is enabled.
Diffstat (limited to 'lib/std/start.zig')
| -rw-r--r-- | lib/std/start.zig | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig index e0f99b4762..88a5ca3ab2 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -387,6 +387,10 @@ fn wWinMainCRTStartup() callconv(std.os.windows.WINAPI) noreturn { } fn posixCallMainAndExit(argc_argv_ptr: [*]usize) callconv(.C) noreturn { + // We're not ready to panic until thread local storage is initialized. + @setRuntimeSafety(false); + // Code coverage instrumentation might try to use thread local variables. + @disableInstrumentation(); const argc = argc_argv_ptr[0]; const argv = @as([*][*:0]u8, @ptrCast(argc_argv_ptr + 1)); @@ -429,9 +433,9 @@ fn posixCallMainAndExit(argc_argv_ptr: [*]usize) callconv(.C) noreturn { if (comptime native_arch.isARM()) { if (at_hwcap & std.os.linux.HWCAP.TLS == 0) { // FIXME: Make __aeabi_read_tp call the kernel helper kuser_get_tls - // For the time being use a simple abort instead of a @panic call to + // For the time being use a simple trap instead of a @panic call to // keep the binary bloat under control. - std.posix.abort(); + @trap(); } } |
