diff --git a/test/standalone/shared_library/build.zig b/test/standalone/shared_library/build.zig index 2fa0bfdfd694332fce62543a8de8fe30b93ef311..478fcd501704cacb21081cc7f463fe8fc1a386c3 100644 --- a/test/standalone/shared_library/build.zig +++ b/test/standalone/shared_library/build.zig @@ -7,16 +7,42 @@ pub fn build(b: *std.Build) void { const optimize: std.builtin.OptimizeMode = .Debug; const target = b.standardTargetOptions(.{}); - const exe_names: []const []const u8 = &.{ "test", "test-dync", "test-no-llvm", "test-no-llvm-dync" }; - const lib_names: []const []const u8 = &.{ "mathtest", "mathtest-dync", "mathtest-no-llvm", "mathtest-no-llvm-dync" }; - const lib_link_libc: []const bool = &.{ false, true, false, true }; - const lib_use_llvm: []const bool = &.{ true, true, false, false }; + const exe_names: []const []const u8 = &.{ + "test", + "test-dync", + "test-no-llvm", + "test-no-llvm-dync", + "test-exe-no-llvm", + "test-dync-exe-no-llvm", + "test-no-llvm-exe-no-llvm", + "test-no-llvm-dync-exe-no-llvm", + }; + const lib_names: []const []const u8 = &.{ + "mathtest", + "mathtest-dync", + "mathtest-no-llvm", + "mathtest-no-llvm-dync", + "mathtest-exe-no-llvm", + "mathtest-dync-exe-no-llvm", + "mathtest-no-llvm-exe-no-llvm", + "mathtest-no-llvm-dync-exe-no-llvm", + }; + const lib_link_libc: []const bool = &.{ false, true, false, true, false, true, false, true }; + const lib_use_llvm: []const bool = &.{ true, true, false, false, true, true, false, false }; + const exe_use_llvm: []const bool = &.{ true, true, true, true, false, false, false, false }; - for (exe_names, lib_names, lib_link_libc, lib_use_llvm) |exe_name, lib_name, dyn_libc, use_llvm| { - if (!use_llvm and target.result.os.tag == .macos) continue; // TODO: Library not loaded: @rpath/libmathtest-no-llvm.dylib (segment '__CONST_ZIG' vm address out of order) - if (!use_llvm and target.result.os.tag == .freebsd) continue; // TODO: Shared object "libmathtest-no-llvm.so.1" not found - if (!use_llvm and target.result.os.tag == .netbsd) continue; // TODO: Shared object "libmathtest-no-llvm.so.1" not found - if (!use_llvm and target.result.os.tag == .openbsd) continue; // TODO: duplicate symbol definition: atexit + for ( + exe_names, + lib_names, + lib_link_libc, + lib_use_llvm, + exe_use_llvm, + ) |exe_name, lib_name, dyn_libc, lib_llvm, exe_llvm| { + const use_llvm = lib_llvm or exe_llvm; + if (!use_llvm and target.result.os.tag == .macos) continue; // TODO + if (!use_llvm and target.result.os.tag == .freebsd) continue; // TODO + if (!use_llvm and target.result.os.tag == .netbsd) continue; // TODO + if (!use_llvm and target.result.os.tag == .openbsd) continue; // TODO if (!use_llvm and target.result.cpu.arch == .loongarch64) continue; // TODO if (!use_llvm and target.result.cpu.arch == .powerpc64le) continue; // TODO if (!use_llvm and target.result.cpu.arch == .s390x) continue; // TODO @@ -31,7 +57,7 @@ pub fn build(b: *std.Build) void { .optimize = optimize, .link_libc = dyn_libc, }), - .use_llvm = use_llvm, + .use_llvm = lib_llvm, }); const exe = b.addExecutable(.{ @@ -42,6 +68,7 @@ pub fn build(b: *std.Build) void { .optimize = optimize, .link_libc = true, }), + .use_llvm = exe_llvm, }); exe.root_module.addCSourceFile(.{ .file = b.path("test.c"),