Skip to content

Commit

Permalink
build: add comments explaining why we disable ubsan
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexicon226 committed Feb 3, 2025
1 parent faab52f commit a1292f7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions test/link/glibc_compat/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ pub fn build(b: *std.Build) void {
.link_libc = true,
}),
});
// We disable UBSAN for these tests as the libc being tested here is
// so old, it doesn't even support compiling our UBSAN implementation.
exe.bundle_ubsan_rt = false;
exe.root_module.sanitize_c = false;
exe.root_module.addCSourceFile(.{ .file = b.path("main.c") });
Expand Down Expand Up @@ -64,6 +66,8 @@ pub fn build(b: *std.Build) void {
.link_libc = true,
}),
});
// We disable UBSAN for these tests as the libc being tested here is
// so old, it doesn't even support compiling our UBSAN implementation.
exe.bundle_ubsan_rt = false;
exe.root_module.sanitize_c = false;
exe.root_module.addCSourceFile(.{ .file = b.path("glibc_runtime_check.c") });
Expand Down Expand Up @@ -165,6 +169,8 @@ pub fn build(b: *std.Build) void {
.link_libc = true,
}),
});
// We disable UBSAN for these tests as the libc being tested here is
// so old, it doesn't even support compiling our UBSAN implementation.
exe.bundle_ubsan_rt = false;
exe.root_module.sanitize_c = false;

Expand Down
1 change: 1 addition & 0 deletions test/link/wasm/export-data/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub fn build(b: *std.Build) void {
}),
});
lib.entry = .disabled;
// Disabling due to self-hosted wasm linker bug.
lib.bundle_ubsan_rt = false;
lib.use_lld = false;
lib.root_module.export_symbol_names = &.{ "foo", "bar" };
Expand Down
4 changes: 3 additions & 1 deletion test/link/wasm/export/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
no_export.entry = .disabled;
no_export.use_llvm = false;
no_export.use_lld = false;
// Don't pull in ubsan, since we're just expecting a very minimal executable.
no_export.bundle_ubsan_rt = false;

const dynamic_export = b.addExecutable(.{
Expand All @@ -33,7 +34,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
dynamic_export.rdynamic = true;
dynamic_export.use_llvm = false;
dynamic_export.use_lld = false;
// don't pull in ubsan, since we're just expecting a minimal executable
// Don't pull in ubsan, since we're just expecting a very minimal executable.
dynamic_export.bundle_ubsan_rt = false;

const force_export = b.addExecutable(.{
Expand All @@ -48,6 +49,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
force_export.root_module.export_symbol_names = &.{"foo"};
force_export.use_llvm = false;
force_export.use_lld = false;
// Don't pull in ubsan, since we're just expecting a very minimal executable.
force_export.bundle_ubsan_rt = false;

const check_no_export = no_export.checkObject();
Expand Down
4 changes: 3 additions & 1 deletion test/link/wasm/function-table/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
export_table.use_lld = false;
export_table.export_table = true;
export_table.link_gc_sections = false;
// Don't pull in ubsan, since we're just expecting a very minimal executable.
export_table.bundle_ubsan_rt = false;

const regular_table = b.addExecutable(.{
Expand All @@ -34,7 +35,8 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
regular_table.entry = .disabled;
regular_table.use_llvm = false;
regular_table.use_lld = false;
regular_table.link_gc_sections = false; // Ensure function table is not empty
regular_table.link_gc_sections = false; // Ensure function table is not empty]
// Don't pull in ubsan, since we're just expecting a very minimal executable.
regular_table.bundle_ubsan_rt = false;

const check_export = export_table.checkObject();
Expand Down
1 change: 1 addition & 0 deletions test/link/wasm/shared-memory/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt
exe.shared_memory = true;
exe.max_memory = 67108864;
exe.root_module.export_symbol_names = &.{"foo"};
// Don't pull in ubsan, since we're just expecting a very minimal executable.
exe.bundle_ubsan_rt = false;

const check_exe = exe.checkObject();
Expand Down
1 change: 1 addition & 0 deletions test/link/wasm/type/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
exe.use_llvm = false;
exe.use_lld = false;
exe.root_module.export_symbol_names = &.{"foo"};
// Don't pull in ubsan, since we're just expecting a very minimal executable.
exe.bundle_ubsan_rt = false;
b.installArtifact(exe);

Expand Down

0 comments on commit a1292f7

Please sign in to comment.