diff --git a/test/link/macho.zig b/test/link/macho.zig index 39efb02065..cddd9954ba 100644 --- a/test/link/macho.zig +++ b/test/link/macho.zig @@ -25,6 +25,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { macho_step.dependOn(testMhExecuteHeader(b, .{ .target = default_target })); macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target })); macho_step.dependOn(testSegmentBoundarySymbols(b, .{ .target = default_target })); + macho_step.dependOn(testTentative(b, .{ .target = default_target })); macho_step.dependOn(testThunks(b, .{ .target = aarch64_target })); macho_step.dependOn(testTlsLargeTbss(b, .{ .target = default_target })); macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target })); @@ -645,6 +646,32 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step { return test_step; } +fn testTentative(b: *Build, opts: Options) *Step { + const test_step = addTestStep(b, "macho-tentative", opts); + + const exe = addExecutable(b, opts, .{ .name = "main" }); + addCSourceBytes(exe, + \\int foo; + \\int bar; + \\int baz = 42; + , &.{"-fcommon"}); + addCSourceBytes(exe, + \\#include + \\int foo; + \\int bar = 5; + \\int baz; + \\int main() { + \\ printf("%d %d %d\n", foo, bar, baz); + \\} + , &.{"-fcommon"}); + + const run = addRunArtifact(exe); + run.expectStdOutEqual("0 5 42\n"); + test_step.dependOn(&run.step); + + return test_step; +} + fn testThunks(b: *Build, opts: Options) *Step { const test_step = addTestStep(b, "macho-thunks", opts);