aboutsummaryrefslogtreecommitdiff
path: root/test/link/macho.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2024-02-02 14:05:51 +0100
committerJakub Konka <kubkon@jakubkonka.com>2024-02-02 22:00:16 +0100
commit92deebcd668750bd4042c5874bf35b447828cd8a (patch)
tree412ac01bd1ee8c20bf4fc55281626e885e8fd0e4 /test/link/macho.zig
parent9eda6ccefce370c76209ea50dd57fe65bfe25536 (diff)
downloadzig-92deebcd668750bd4042c5874bf35b447828cd8a.tar.gz
zig-92deebcd668750bd4042c5874bf35b447828cd8a.zip
cli+build: handle -ObjC flag and route it to MachO linker
Diffstat (limited to 'test/link/macho.zig')
-rw-r--r--test/link/macho.zig41
1 files changed, 30 insertions, 11 deletions
diff --git a/test/link/macho.zig b/test/link/macho.zig
index e1ce182a6a..1feb509af3 100644
--- a/test/link/macho.zig
+++ b/test/link/macho.zig
@@ -969,19 +969,38 @@ fn testObjc(b: *Build, opts: Options) *Step {
\\@end
});
- const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" });
- exe.root_module.linkSystemLibrary("a", .{});
- exe.root_module.linkFramework("Foundation", .{});
- exe.root_module.addLibraryPath(lib.getEmittedBinDirectory());
+ {
+ const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" });
+ exe.root_module.linkSystemLibrary("a", .{});
+ exe.root_module.linkFramework("Foundation", .{});
+ exe.root_module.addLibraryPath(lib.getEmittedBinDirectory());
- const check = exe.checkObject();
- check.checkInSymtab();
- check.checkContains("_OBJC_");
- test_step.dependOn(&check.step);
+ const check = exe.checkObject();
+ check.checkInSymtab();
+ check.checkNotPresent("_OBJC_");
+ test_step.dependOn(&check.step);
- const run = addRunArtifact(exe);
- run.expectExitCode(0);
- test_step.dependOn(&run.step);
+ const run = addRunArtifact(exe);
+ run.expectExitCode(0);
+ test_step.dependOn(&run.step);
+ }
+
+ {
+ const exe = addExecutable(b, opts, .{ .name = "main2", .c_source_bytes = "int main() { return 0; }" });
+ exe.root_module.linkSystemLibrary("a", .{});
+ exe.root_module.linkFramework("Foundation", .{});
+ exe.root_module.addLibraryPath(lib.getEmittedBinDirectory());
+ exe.force_load_objc = true;
+
+ const check = exe.checkObject();
+ check.checkInSymtab();
+ check.checkContains("_OBJC_");
+ test_step.dependOn(&check.step);
+
+ const run = addRunArtifact(exe);
+ run.expectExitCode(0);
+ test_step.dependOn(&run.step);
+ }
return test_step;
}