From 957ac465a7c88a33b92660c86544ca522cb3a1d9 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Mon, 4 Dec 2023 23:16:55 +0100 Subject: [PATCH] macho: test entry in archive with -dead_strip --- test/macho.zig | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/test/macho.zig b/test/macho.zig index 8c669f0a..e082a23d 100644 --- a/test/macho.zig +++ b/test/macho.zig @@ -372,12 +372,23 @@ fn testEntryPointArchive(b: *Build, opts: Options) *Step { const lib = ar(b); lib.addFileSource(obj.out); - const exe = cc(b, opts); - exe.addArg("-lmain"); - exe.addPrefixedDirectorySource("-L", lib.saveOutputAs("libmain.a").dir); + { + const exe = cc(b, opts); + exe.addArg("-lmain"); + exe.addPrefixedDirectorySource("-L", lib.saveOutputAs("libmain.a").dir); - const run = exe.run(); - test_step.dependOn(run.step()); + const run = exe.run(); + test_step.dependOn(run.step()); + } + + { + const exe = cc(b, opts); + exe.addArgs(&.{ "-lmain", "-Wl,-dead_strip" }); + exe.addPrefixedDirectorySource("-L", lib.saveOutputAs("libmain.a").dir); + + const run = exe.run(); + test_step.dependOn(run.step()); + } return test_step; }