Commit 44d3b5a6e4

David Rubin <daviru007@icloud.com>
2025-02-03 09:04:12
build: add comments explaining why we disable ubsan
1 parent 35b9db3
Changed files (6)
test
link
glibc_compat
wasm
export
export-data
function-table
shared-memory
type
test/link/glibc_compat/build.zig
@@ -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") });
@@ -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") });
@@ -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;
 
test/link/wasm/export/build.zig
@@ -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(.{
@@ -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(.{
@@ -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();
test/link/wasm/export-data/build.zig
@@ -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" };
test/link/wasm/function-table/build.zig
@@ -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(.{
@@ -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_lld = false;
     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();
test/link/wasm/shared-memory/build.zig
@@ -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();
test/link/wasm/type/build.zig
@@ -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);