Skip to content

Commit ca83f52

Browse files
committed
ubsan: update wording
1 parent 2447b87 commit ca83f52

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

lib/ubsan_rt.zig

+8-5
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ const Value = extern struct {
127127
) !void {
128128
comptime assert(fmt.len == 0);
129129

130+
// Work around x86_64 backend limitation.
130131
if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag == .windows) {
131132
try writer.writeAll("(unknown)");
132133
return;
@@ -646,6 +647,7 @@ fn exportHandler(
646647
handler: anytype,
647648
comptime sym_name: []const u8,
648649
) void {
650+
// Work around x86_64 backend limitation.
649651
const linkage = if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag == .windows) .internal else .weak;
650652
const N = "__ubsan_handle_" ++ sym_name;
651653
@export(handler, .{ .name = N, .linkage = linkage });
@@ -656,6 +658,7 @@ fn exportHandlerWithAbort(
656658
abort_handler: anytype,
657659
comptime sym_name: []const u8,
658660
) void {
661+
// Work around x86_64 backend limitation.
659662
const linkage = if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag == .windows) .internal else .weak;
660663
{
661664
const N = "__ubsan_handle_" ++ sym_name;
@@ -697,12 +700,12 @@ comptime {
697700
exportHandler(&missingReturn, "missing_return");
698701
}
699702

700-
// these checks are nearly impossible to duplicate in zig, as they rely on nuances
703+
// these checks are nearly impossible to replicate in zig, as they rely on nuances
701704
// in the Itanium C++ ABI.
702-
// exportHelper("dynamic_type_cache_miss", "dynamic-type-cache-miss", true);
703-
// exportHelper("vptr_type_cache", "vptr-type-cache", true);
705+
// exportHandlerWithAbort(&dynamicTypeCacheMiss, &dynamicTypeCacheMissAbort, "dynamic-type-cache-miss");
706+
// exportHandlerWithAbort(&vptrTypeCache, &vptrTypeCacheAbort, "vptr-type-cache");
704707

705708
// we disable -fsanitize=function for reasons explained in src/Compilation.zig
706-
// exportHelper("function-type-mismatch", "function_type_mismatch", true);
707-
// exportHelper("function-type-mismatch-v1", "function_type_mismatch_v1", true);
709+
// exportHandlerWithAbort(&functionTypeMismatch, &functionTypeMismatchAbort, "function-type-mismatch");
710+
// exportHandlerWithAbort(&functionTypeMismatchV1, &functionTypeMismatchV1Abort, "function-type-mismatch-v1");
708711
}

test/link/elf.zig

+4-2
Original file line numberDiff line numberDiff line change
@@ -2049,7 +2049,8 @@ fn testLargeBss(b: *Build, opts: Options) *Step {
20492049
\\}
20502050
, &.{});
20512051
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.
20532054
exe.root_module.sanitize_c = false;
20542055

20552056
const run = addRunArtifact(exe);
@@ -3554,7 +3555,8 @@ fn testTlsLargeTbss(b: *Build, opts: Options) *Step {
35543555
\\}
35553556
, &.{});
35563557
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.
35583560
exe.root_module.sanitize_c = false;
35593561

35603562
const run = addRunArtifact(exe);

test/link/wasm/export-data/build.zig

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ pub fn build(b: *std.Build) void {
1313
}),
1414
});
1515
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.
1718
lib.bundle_ubsan_rt = false;
1819
lib.use_lld = false;
1920
lib.root_module.export_symbol_names = &.{ "foo", "bar" };

0 commit comments

Comments
 (0)