| ... | @@ -26,6 +26,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { | ... | @@ -26,6 +26,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 26 | macho_step.dependOn(testReexportsZig(b, .{ .use_llvm = false, .target = x86_64_target })); | 26 | macho_step.dependOn(testReexportsZig(b, .{ .use_llvm = false, .target = x86_64_target })); |
| 27 | macho_step.dependOn(testRelocatableZig(b, .{ .use_llvm = false, .target = x86_64_target })); | 27 | macho_step.dependOn(testRelocatableZig(b, .{ .use_llvm = false, .target = x86_64_target })); |
| 28 | macho_step.dependOn(testTlsZig(b, .{ .use_llvm = false, .target = x86_64_target })); | 28 | macho_step.dependOn(testTlsZig(b, .{ .use_llvm = false, .target = x86_64_target })); |
| | 29 | macho_step.dependOn(testUnresolvedError(b, .{ .use_llvm = false, .target = x86_64_target })); |
| 29 | | 30 | |
| 30 | // Exercise linker with LLVM backend | 31 | // Exercise linker with LLVM backend |
| 31 | macho_step.dependOn(testDeadStrip(b, .{ .target = default_target })); | 32 | macho_step.dependOn(testDeadStrip(b, .{ .target = default_target })); |
| ... | @@ -59,6 +60,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { | ... | @@ -59,6 +60,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 59 | macho_step.dependOn(testTlsLargeTbss(b, .{ .target = default_target })); | 60 | macho_step.dependOn(testTlsLargeTbss(b, .{ .target = default_target })); |
| 60 | macho_step.dependOn(testTlsZig(b, .{ .target = default_target })); | 61 | macho_step.dependOn(testTlsZig(b, .{ .target = default_target })); |
| 61 | macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target })); | 62 | macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target })); |
| | 63 | macho_step.dependOn(testUnresolvedError(b, .{ .target = default_target })); |
| 62 | macho_step.dependOn(testUnwindInfo(b, .{ .target = default_target })); | 64 | macho_step.dependOn(testUnwindInfo(b, .{ .target = default_target })); |
| 63 | macho_step.dependOn(testUnwindInfoNoSubsectionsX64(b, .{ .target = x86_64_target })); | 65 | macho_step.dependOn(testUnwindInfoNoSubsectionsX64(b, .{ .target = x86_64_target })); |
| 64 | macho_step.dependOn(testUnwindInfoNoSubsectionsArm64(b, .{ .target = aarch64_target })); | 66 | macho_step.dependOn(testUnwindInfoNoSubsectionsArm64(b, .{ .target = aarch64_target })); |
| ... | @@ -2499,6 +2501,33 @@ fn testUndefinedFlag(b: *Build, opts: Options) *Step { | ... | @@ -2499,6 +2501,33 @@ fn testUndefinedFlag(b: *Build, opts: Options) *Step { |
| 2499 | return test_step; | 2501 | return test_step; |
| 2500 | } | 2502 | } |
| 2501 | | 2503 | |
| | 2504 | fn testUnresolvedError(b: *Build, opts: Options) *Step { |
| | 2505 | const test_step = addTestStep(b, "unresolved-error", opts); |
| | 2506 | |
| | 2507 | const obj = addObject(b, opts, .{ .name = "a", .zig_source_bytes = |
| | 2508 | \\extern fn foo() i32; |
| | 2509 | \\export fn bar() i32 { return foo() + 1; } |
| | 2510 | }); |
| | 2511 | |
| | 2512 | const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes = |
| | 2513 | \\const std = @import("std"); |
| | 2514 | \\extern fn foo() i32; |
| | 2515 | \\extern fn bar() i32; |
| | 2516 | \\pub fn main() void { |
| | 2517 | \\ std.debug.print("foo() + bar() = {d}", .{foo() + bar()}); |
| | 2518 | \\} |
| | 2519 | }); |
| | 2520 | exe.addObject(obj); |
| | 2521 | |
| | 2522 | expectLinkErrors(exe, test_step, .{ .exact = &.{ |
| | 2523 | "error: undefined symbol: _foo", |
| | 2524 | "note: referenced by /?/a.o:_bar", |
| | 2525 | "note: referenced by /?/main.o:_a.main", |
| | 2526 | } }); |
| | 2527 | |
| | 2528 | return test_step; |
| | 2529 | } |
| | 2530 | |
| 2502 | fn testUnwindInfo(b: *Build, opts: Options) *Step { | 2531 | fn testUnwindInfo(b: *Build, opts: Options) *Step { |
| 2503 | const test_step = addTestStep(b, "unwind-info", opts); | 2532 | const test_step = addTestStep(b, "unwind-info", opts); |
| 2504 | | 2533 | |