Skip to content

Commit

Permalink
ubsan: update wording
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexicon226 committed Feb 24, 2025
1 parent 1c465ae commit 88eee58
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
13 changes: 8 additions & 5 deletions lib/ubsan_rt.zig
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const Value = extern struct {
) !void {
comptime assert(fmt.len == 0);

// Work around x86_64 backend limitation.
if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag == .windows) {
try writer.writeAll("(unknown)");
return;
Expand Down Expand Up @@ -646,6 +647,7 @@ fn exportHandler(
handler: anytype,
comptime sym_name: []const u8,
) void {
// Work around x86_64 backend limitation.
const linkage = if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag == .windows) .internal else .weak;
const N = "__ubsan_handle_" ++ sym_name;
@export(handler, .{ .name = N, .linkage = linkage });
Expand All @@ -656,6 +658,7 @@ fn exportHandlerWithAbort(
abort_handler: anytype,
comptime sym_name: []const u8,
) void {
// Work around x86_64 backend limitation.
const linkage = if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag == .windows) .internal else .weak;
{
const N = "__ubsan_handle_" ++ sym_name;
Expand Down Expand Up @@ -697,12 +700,12 @@ comptime {
exportHandler(&missingReturn, "missing_return");
}

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

// we disable -fsanitize=function for reasons explained in src/Compilation.zig
// exportHelper("function-type-mismatch", "function_type_mismatch", true);
// exportHelper("function-type-mismatch-v1", "function_type_mismatch_v1", true);
// exportHandlerWithAbort(&functionTypeMismatch, &functionTypeMismatchAbort, "function-type-mismatch");
// exportHandlerWithAbort(&functionTypeMismatchV1, &functionTypeMismatchV1Abort, "function-type-mismatch-v1");
}
6 changes: 4 additions & 2 deletions test/link/elf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2049,7 +2049,8 @@ fn testLargeBss(b: *Build, opts: Options) *Step {
\\}
, &.{});
exe.linkLibC();
// Disabled to work around an ELF linker bug.
// Disabled to work around the ELF linker crashing.
// Can be reproduced on a x86_64-linux host by commenting out the line below.
exe.root_module.sanitize_c = false;

const run = addRunArtifact(exe);
Expand Down Expand Up @@ -3554,7 +3555,8 @@ fn testTlsLargeTbss(b: *Build, opts: Options) *Step {
\\}
, &.{});
exe.linkLibC();
// Disabled to work around an ELF linker bug.
// Disabled to work around the ELF linker crashing.
// Can be reproduced on a x86_64-linux host by commenting out the line below.
exe.root_module.sanitize_c = false;

const run = addRunArtifact(exe);
Expand Down
3 changes: 2 additions & 1 deletion test/link/wasm/export-data/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ pub fn build(b: *std.Build) void {
}),
});
lib.entry = .disabled;
// Disabling due to self-hosted wasm linker bug.
// Disabled to work around the Wasm linker crashing.
// Can be reproduced by commenting out the line below.
lib.bundle_ubsan_rt = false;
lib.use_lld = false;
lib.root_module.export_symbol_names = &.{ "foo", "bar" };
Expand Down

0 comments on commit 88eee58

Please sign in to comment.