build: add comments explaining why we disable ubsan

This commit is contained in:
David Rubin 2025-02-03 00:04:12 -08:00 committed by David Rubin
parent 35b9db3b15
commit 44d3b5a6e4
6 changed files with 14 additions and 1 deletions

View File

@ -22,6 +22,8 @@ pub fn build(b: *std.Build) void {
.link_libc = true, .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.bundle_ubsan_rt = false;
exe.root_module.sanitize_c = false; exe.root_module.sanitize_c = false;
exe.root_module.addCSourceFile(.{ .file = b.path("main.c") }); exe.root_module.addCSourceFile(.{ .file = b.path("main.c") });
@ -64,6 +66,8 @@ pub fn build(b: *std.Build) void {
.link_libc = true, .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.bundle_ubsan_rt = false;
exe.root_module.sanitize_c = false; exe.root_module.sanitize_c = false;
exe.root_module.addCSourceFile(.{ .file = b.path("glibc_runtime_check.c") }); exe.root_module.addCSourceFile(.{ .file = b.path("glibc_runtime_check.c") });
@ -165,6 +169,8 @@ pub fn build(b: *std.Build) void {
.link_libc = true, .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.bundle_ubsan_rt = false;
exe.root_module.sanitize_c = false; exe.root_module.sanitize_c = false;

View File

@ -13,6 +13,7 @@ pub fn build(b: *std.Build) void {
}), }),
}); });
lib.entry = .disabled; lib.entry = .disabled;
// Disabling due to self-hosted wasm linker bug.
lib.bundle_ubsan_rt = false; lib.bundle_ubsan_rt = false;
lib.use_lld = false; lib.use_lld = false;
lib.root_module.export_symbol_names = &.{ "foo", "bar" }; lib.root_module.export_symbol_names = &.{ "foo", "bar" };

View File

@ -19,6 +19,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
no_export.entry = .disabled; no_export.entry = .disabled;
no_export.use_llvm = false; no_export.use_llvm = false;
no_export.use_lld = 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; no_export.bundle_ubsan_rt = false;
const dynamic_export = b.addExecutable(.{ const dynamic_export = b.addExecutable(.{
@ -33,7 +34,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
dynamic_export.rdynamic = true; dynamic_export.rdynamic = true;
dynamic_export.use_llvm = false; dynamic_export.use_llvm = false;
dynamic_export.use_lld = 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; dynamic_export.bundle_ubsan_rt = false;
const force_export = b.addExecutable(.{ const force_export = b.addExecutable(.{
@ -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.root_module.export_symbol_names = &.{"foo"};
force_export.use_llvm = false; force_export.use_llvm = false;
force_export.use_lld = 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; force_export.bundle_ubsan_rt = false;
const check_no_export = no_export.checkObject(); const check_no_export = no_export.checkObject();

View File

@ -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.use_lld = false;
export_table.export_table = true; export_table.export_table = true;
export_table.link_gc_sections = false; 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; export_table.bundle_ubsan_rt = false;
const regular_table = b.addExecutable(.{ const regular_table = b.addExecutable(.{
@ -35,6 +36,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
regular_table.use_llvm = false; regular_table.use_llvm = false;
regular_table.use_lld = 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; regular_table.bundle_ubsan_rt = false;
const check_export = export_table.checkObject(); const check_export = export_table.checkObject();

View File

@ -31,6 +31,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt
exe.shared_memory = true; exe.shared_memory = true;
exe.max_memory = 67108864; exe.max_memory = 67108864;
exe.root_module.export_symbol_names = &.{"foo"}; 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; exe.bundle_ubsan_rt = false;
const check_exe = exe.checkObject(); const check_exe = exe.checkObject();

View File

@ -21,6 +21,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
exe.use_llvm = false; exe.use_llvm = false;
exe.use_lld = false; exe.use_lld = false;
exe.root_module.export_symbol_names = &.{"foo"}; 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; exe.bundle_ubsan_rt = false;
b.installArtifact(exe); b.installArtifact(exe);