| ... | @@ -68,6 +68,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { | ... | @@ -68,6 +68,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 68 | macho_step.dependOn(testTlsLargeTbss(b, .{ .target = default_target })); | 68 | macho_step.dependOn(testTlsLargeTbss(b, .{ .target = default_target })); |
| 69 | macho_step.dependOn(testTlsZig(b, .{ .target = default_target })); | 69 | macho_step.dependOn(testTlsZig(b, .{ .target = default_target })); |
| 70 | macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target })); | 70 | macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target })); |
| | 71 | macho_step.dependOn(testUndefinedDynamicLookup(b, .{ .target = default_target })); |
| 71 | macho_step.dependOn(testDiscardLocalSymbols(b, .{ .target = default_target })); | 72 | macho_step.dependOn(testDiscardLocalSymbols(b, .{ .target = default_target })); |
| 72 | macho_step.dependOn(testUnresolvedError(b, .{ .target = default_target })); | 73 | macho_step.dependOn(testUnresolvedError(b, .{ .target = default_target })); |
| 73 | macho_step.dependOn(testUnresolvedError2(b, .{ .target = default_target })); | 74 | macho_step.dependOn(testUnresolvedError2(b, .{ .target = default_target })); |
| ... | @@ -2634,6 +2635,29 @@ fn testUndefinedFlag(b: *Build, opts: Options) *Step { | ... | @@ -2634,6 +2635,29 @@ fn testUndefinedFlag(b: *Build, opts: Options) *Step { |
| 2634 | return test_step; | 2635 | return test_step; |
| 2635 | } | 2636 | } |
| 2636 | | 2637 | |
| | 2638 | fn testUndefinedDynamicLookup(b: *Build, opts: Options) *Step { |
| | 2639 | const test_step = addTestStep(b, "undefined-dynamic-lookup", opts); |
| | 2640 | |
| | 2641 | // Create a dylib with an undefined external symbol reference |
| | 2642 | const dylib = addSharedLibrary(b, opts, .{ .name = "a" }); |
| | 2643 | addCSourceBytes(dylib, |
| | 2644 | \\extern int undefined_symbol(void); |
| | 2645 | \\int call_undefined(void) { |
| | 2646 | \\ return undefined_symbol(); |
| | 2647 | \\} |
| | 2648 | , &.{}); |
| | 2649 | dylib.linker_allow_shlib_undefined = true; |
| | 2650 | |
| | 2651 | // Verify the Mach-O header does NOT contain NOUNDEFS flag |
| | 2652 | const check = dylib.checkObject(); |
| | 2653 | check.checkInHeaders(); |
| | 2654 | check.checkExact("header"); |
| | 2655 | check.checkNotPresent("NOUNDEFS"); |
| | 2656 | test_step.dependOn(&check.step); |
| | 2657 | |
| | 2658 | return test_step; |
| | 2659 | } |
| | 2660 | |
| 2637 | fn testUnresolvedError(b: *Build, opts: Options) *Step { | 2661 | fn testUnresolvedError(b: *Build, opts: Options) *Step { |
| 2638 | const test_step = addTestStep(b, "unresolved-error", opts); | 2662 | const test_step = addTestStep(b, "unresolved-error", opts); |
| 2639 | | 2663 | |