zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 44d3b5a6e47c0caa3b5b3fe998ad52ef1d83e032 (tree)
parent 35b9db3b1549668c5a3a464f97aed1441b18d791
Author: David Rubin <daviru007@icloud.com>
Date:   Mon,  3 Feb 2025 00:04:12 -0800

build: add comments explaining why we disable ubsan

Diffstat:
Mtest/link/glibc_compat/build.zig | 6++++++
Mtest/link/wasm/export-data/build.zig | 1+
Mtest/link/wasm/export/build.zig | 4+++-
Mtest/link/wasm/function-table/build.zig | 2++
Mtest/link/wasm/shared-memory/build.zig | 1+
Mtest/link/wasm/type/build.zig | 1+
6 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/test/link/glibc_compat/build.zig b/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; diff --git a/test/link/wasm/export-data/build.zig b/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" }; diff --git a/test/link/wasm/export/build.zig b/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(); diff --git a/test/link/wasm/function-table/build.zig b/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(); diff --git a/test/link/wasm/shared-memory/build.zig b/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(); diff --git a/test/link/wasm/type/build.zig b/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);