authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-10-09 21:39:13+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-10-09 21:39:45+02:00
log33401ff3bb9359c656d21d2b1a0277c9fc5b85d1
treef7d4694ab756022c663685306ebb22170b5d3cf9
parentd43b0cb31f82dedc210468bd28c142d4995864ba

test/link/macho: test reporting undefined special symbols


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

test/link/macho.zig+26
...@@ -63,6 +63,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {...@@ -63,6 +63,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
63 macho_step.dependOn(testTlsZig(b, .{ .target = default_target }));63 macho_step.dependOn(testTlsZig(b, .{ .target = default_target }));
64 macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target }));64 macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target }));
65 macho_step.dependOn(testUnresolvedError(b, .{ .target = default_target }));65 macho_step.dependOn(testUnresolvedError(b, .{ .target = default_target }));
66 macho_step.dependOn(testUnresolvedError2(b, .{ .target = default_target }));
66 macho_step.dependOn(testUnwindInfo(b, .{ .target = default_target }));67 macho_step.dependOn(testUnwindInfo(b, .{ .target = default_target }));
67 macho_step.dependOn(testUnwindInfoNoSubsectionsX64(b, .{ .target = x86_64_target }));68 macho_step.dependOn(testUnwindInfoNoSubsectionsX64(b, .{ .target = x86_64_target }));
68 macho_step.dependOn(testUnwindInfoNoSubsectionsArm64(b, .{ .target = aarch64_target }));69 macho_step.dependOn(testUnwindInfoNoSubsectionsArm64(b, .{ .target = aarch64_target }));
...@@ -2610,6 +2611,31 @@ fn testUnresolvedError(b: *Build, opts: Options) *Step {...@@ -2610,6 +2611,31 @@ fn testUnresolvedError(b: *Build, opts: Options) *Step {
2610 return test_step;2611 return test_step;
2611}2612}
26122613
2614fn testUnresolvedError2(b: *Build, opts: Options) *Step {
2615 const test_step = addTestStep(b, "unresolved-error-2", opts);
2616
2617 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =
2618 \\pub fn main() !void {
2619 \\ const msg_send_fn = @extern(
2620 \\ *const fn () callconv(.C) usize,
2621 \\ .{ .name = "objc_msgSend$initWithContentRect:styleMask:backing:defer:screen:" },
2622 \\ );
2623 \\ _ = @call(
2624 \\ .auto,
2625 \\ msg_send_fn,
2626 \\ .{},
2627 \\ );
2628 \\}
2629 });
2630
2631 expectLinkErrors(exe, test_step, .{ .exact = &.{
2632 "error: undefined symbol: _objc_msgSend",
2633 "note: referenced implicitly",
2634 } });
2635
2636 return test_step;
2637}
2638
2613fn testUnwindInfo(b: *Build, opts: Options) *Step {2639fn testUnwindInfo(b: *Build, opts: Options) *Step {
2614 const test_step = addTestStep(b, "unwind-info", opts);2640 const test_step = addTestStep(b, "unwind-info", opts);
26152641