authorgravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2025-02-24 03:49:45-08:00
committergravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2025-02-25 11:22:33-08:00
logca83f52fd95fa6ebf28b7d51d4ef396a2ccf4be4
treee81e24fa172fdc72ee09efde50b9a6c4f04fa403
parent2447b87d98ee4b0fe13938c9b2acf2bb06cab572

ubsan: update wording


3 files changed, 14 insertions(+), 8 deletions(-)

lib/ubsan_rt.zig+8-5
...@@ -127,6 +127,7 @@ const Value = extern struct {...@@ -127,6 +127,7 @@ const Value = extern struct {
127 ) !void {127 ) !void {
128 comptime assert(fmt.len == 0);128 comptime assert(fmt.len == 0);
129129
130 // Work around x86_64 backend limitation.
130 if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag == .windows) {131 if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag == .windows) {
131 try writer.writeAll("(unknown)");132 try writer.writeAll("(unknown)");
132 return;133 return;
...@@ -646,6 +647,7 @@ fn exportHandler(...@@ -646,6 +647,7 @@ fn exportHandler(
646 handler: anytype,647 handler: anytype,
647 comptime sym_name: []const u8,648 comptime sym_name: []const u8,
648) void {649) void {
650 // Work around x86_64 backend limitation.
649 const linkage = if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag == .windows) .internal else .weak;651 const linkage = if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag == .windows) .internal else .weak;
650 const N = "__ubsan_handle_" ++ sym_name;652 const N = "__ubsan_handle_" ++ sym_name;
651 @export(handler, .{ .name = N, .linkage = linkage });653 @export(handler, .{ .name = N, .linkage = linkage });
...@@ -656,6 +658,7 @@ fn exportHandlerWithAbort(...@@ -656,6 +658,7 @@ fn exportHandlerWithAbort(
656 abort_handler: anytype,658 abort_handler: anytype,
657 comptime sym_name: []const u8,659 comptime sym_name: []const u8,
658) void {660) void {
661 // Work around x86_64 backend limitation.
659 const linkage = if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag == .windows) .internal else .weak;662 const linkage = if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag == .windows) .internal else .weak;
660 {663 {
661 const N = "__ubsan_handle_" ++ sym_name;664 const N = "__ubsan_handle_" ++ sym_name;
...@@ -697,12 +700,12 @@ comptime {...@@ -697,12 +700,12 @@ comptime {
697 exportHandler(&missingReturn, "missing_return");700 exportHandler(&missingReturn, "missing_return");
698 }701 }
699702
700 // these checks are nearly impossible to duplicate in zig, as they rely on nuances703 // these checks are nearly impossible to replicate in zig, as they rely on nuances
701 // in the Itanium C++ ABI.704 // in the Itanium C++ ABI.
702 // exportHelper("dynamic_type_cache_miss", "dynamic-type-cache-miss", true);705 // exportHandlerWithAbort(&dynamicTypeCacheMiss, &dynamicTypeCacheMissAbort, "dynamic-type-cache-miss");
703 // exportHelper("vptr_type_cache", "vptr-type-cache", true);706 // exportHandlerWithAbort(&vptrTypeCache, &vptrTypeCacheAbort, "vptr-type-cache");
704707
705 // we disable -fsanitize=function for reasons explained in src/Compilation.zig708 // we disable -fsanitize=function for reasons explained in src/Compilation.zig
706 // exportHelper("function-type-mismatch", "function_type_mismatch", true);709 // exportHandlerWithAbort(&functionTypeMismatch, &functionTypeMismatchAbort, "function-type-mismatch");
707 // exportHelper("function-type-mismatch-v1", "function_type_mismatch_v1", true);710 // exportHandlerWithAbort(&functionTypeMismatchV1, &functionTypeMismatchV1Abort, "function-type-mismatch-v1");
708}711}
test/link/elf.zig+4-2
...@@ -2049,7 +2049,8 @@ fn testLargeBss(b: *Build, opts: Options) *Step {...@@ -2049,7 +2049,8 @@ fn testLargeBss(b: *Build, opts: Options) *Step {
2049 \\}2049 \\}
2050 , &.{});2050 , &.{});
2051 exe.linkLibC();2051 exe.linkLibC();
2052 // Disabled to work around an ELF linker bug.2052 // Disabled to work around the ELF linker crashing.
2053 // Can be reproduced on a x86_64-linux host by commenting out the line below.
2053 exe.root_module.sanitize_c = false;2054 exe.root_module.sanitize_c = false;
20542055
2055 const run = addRunArtifact(exe);2056 const run = addRunArtifact(exe);
...@@ -3554,7 +3555,8 @@ fn testTlsLargeTbss(b: *Build, opts: Options) *Step {...@@ -3554,7 +3555,8 @@ fn testTlsLargeTbss(b: *Build, opts: Options) *Step {
3554 \\}3555 \\}
3555 , &.{});3556 , &.{});
3556 exe.linkLibC();3557 exe.linkLibC();
3557 // Disabled to work around an ELF linker bug.3558 // Disabled to work around the ELF linker crashing.
3559 // Can be reproduced on a x86_64-linux host by commenting out the line below.
3558 exe.root_module.sanitize_c = false;3560 exe.root_module.sanitize_c = false;
35593561
3560 const run = addRunArtifact(exe);3562 const run = addRunArtifact(exe);
test/link/wasm/export-data/build.zig+2-1
...@@ -13,7 +13,8 @@ pub fn build(b: *std.Build) void {...@@ -13,7 +13,8 @@ pub fn build(b: *std.Build) void {
13 }),13 }),
14 });14 });
15 lib.entry = .disabled;15 lib.entry = .disabled;
16 // Disabling due to self-hosted wasm linker bug.16 // Disabled to work around the Wasm linker crashing.
17 // Can be reproduced by commenting out the line below.
17 lib.bundle_ubsan_rt = false;18 lib.bundle_ubsan_rt = false;
18 lib.use_lld = false;19 lib.use_lld = false;
19 lib.root_module.export_symbol_names = &.{ "foo", "bar" };20 lib.root_module.export_symbol_names = &.{ "foo", "bar" };