aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2024-10-09 21:39:13 +0200
committerJakub Konka <kubkon@jakubkonka.com>2024-10-09 21:39:45 +0200
commit33401ff3bb9359c656d21d2b1a0277c9fc5b85d1 (patch)
treef7d4694ab756022c663685306ebb22170b5d3cf9 /test
parentd43b0cb31f82dedc210468bd28c142d4995864ba (diff)
downloadzig-33401ff3bb9359c656d21d2b1a0277c9fc5b85d1.tar.gz
zig-33401ff3bb9359c656d21d2b1a0277c9fc5b85d1.zip
test/link/macho: test reporting undefined special symbols
Diffstat (limited to 'test')
-rw-r--r--test/link/macho.zig26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/link/macho.zig b/test/link/macho.zig
index 31e6de1d04..1d790b20c6 100644
--- a/test/link/macho.zig
+++ b/test/link/macho.zig
@@ -63,6 +63,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
macho_step.dependOn(testTlsZig(b, .{ .target = default_target }));
macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target }));
macho_step.dependOn(testUnresolvedError(b, .{ .target = default_target }));
+ macho_step.dependOn(testUnresolvedError2(b, .{ .target = default_target }));
macho_step.dependOn(testUnwindInfo(b, .{ .target = default_target }));
macho_step.dependOn(testUnwindInfoNoSubsectionsX64(b, .{ .target = x86_64_target }));
macho_step.dependOn(testUnwindInfoNoSubsectionsArm64(b, .{ .target = aarch64_target }));
@@ -2610,6 +2611,31 @@ fn testUnresolvedError(b: *Build, opts: Options) *Step {
return test_step;
}
+fn testUnresolvedError2(b: *Build, opts: Options) *Step {
+ const test_step = addTestStep(b, "unresolved-error-2", opts);
+
+ const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =
+ \\pub fn main() !void {
+ \\ const msg_send_fn = @extern(
+ \\ *const fn () callconv(.C) usize,
+ \\ .{ .name = "objc_msgSend$initWithContentRect:styleMask:backing:defer:screen:" },
+ \\ );
+ \\ _ = @call(
+ \\ .auto,
+ \\ msg_send_fn,
+ \\ .{},
+ \\ );
+ \\}
+ });
+
+ expectLinkErrors(exe, test_step, .{ .exact = &.{
+ "error: undefined symbol: _objc_msgSend",
+ "note: referenced implicitly",
+ } });
+
+ return test_step;
+}
+
fn testUnwindInfo(b: *Build, opts: Options) *Step {
const test_step = addTestStep(b, "unwind-info", opts);