authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-01-14 11:07:16+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-01-24 12:34:40+01:00
logfa161c205943116f630975a097a04a9ac6ea1586
tree3ed40666a5d1a1712e83b3fe22be91b136147b68
parent49a4b429954826fba3bd9d952ec28a058addf31c

test/link/macho: test tentative definitions


1 files changed, 27 insertions(+), 0 deletions(-)

test/link/macho.zig+27
......@@ -25,6 +25,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
2525 macho_step.dependOn(testMhExecuteHeader(b, .{ .target = default_target }));
2626 macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target }));
2727 macho_step.dependOn(testSegmentBoundarySymbols(b, .{ .target = default_target }));
28 macho_step.dependOn(testTentative(b, .{ .target = default_target }));
2829 macho_step.dependOn(testThunks(b, .{ .target = aarch64_target }));
2930 macho_step.dependOn(testTlsLargeTbss(b, .{ .target = default_target }));
3031 macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target }));
......@@ -645,6 +646,32 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step {
645646 return test_step;
646647}
647648
649fn testTentative(b: *Build, opts: Options) *Step {
650 const test_step = addTestStep(b, "macho-tentative", opts);
651
652 const exe = addExecutable(b, opts, .{ .name = "main" });
653 addCSourceBytes(exe,
654 \\int foo;
655 \\int bar;
656 \\int baz = 42;
657 , &.{"-fcommon"});
658 addCSourceBytes(exe,
659 \\#include<stdio.h>
660 \\int foo;
661 \\int bar = 5;
662 \\int baz;
663 \\int main() {
664 \\ printf("%d %d %d\n", foo, bar, baz);
665 \\}
666 , &.{"-fcommon"});
667
668 const run = addRunArtifact(exe);
669 run.expectStdOutEqual("0 5 42\n");
670 test_step.dependOn(&run.step);
671
672 return test_step;
673}
674
648675fn testThunks(b: *Build, opts: Options) *Step {
649676 const test_step = addTestStep(b, "macho-thunks", opts);
650677