| ... | @@ -11,6 +11,10 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { | ... | @@ -11,6 +11,10 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 11 | .cpu_arch = .x86_64, | 11 | .cpu_arch = .x86_64, |
| 12 | .os_tag = .macos, | 12 | .os_tag = .macos, |
| 13 | }); | 13 | }); |
| | 14 | const aarch64_target = b.resolveTargetQuery(.{ |
| | 15 | .cpu_arch = .aarch64, |
| | 16 | .os_tag = .macos, |
| | 17 | }); |
| 14 | | 18 | |
| 15 | macho_step.dependOn(testDeadStrip(b, .{ .target = default_target })); | 19 | macho_step.dependOn(testDeadStrip(b, .{ .target = default_target })); |
| 16 | macho_step.dependOn(testEntryPointDylib(b, .{ .target = default_target })); | 20 | macho_step.dependOn(testEntryPointDylib(b, .{ .target = default_target })); |
| ... | @@ -21,6 +25,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { | ... | @@ -21,6 +25,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 21 | macho_step.dependOn(testMhExecuteHeader(b, .{ .target = default_target })); | 25 | macho_step.dependOn(testMhExecuteHeader(b, .{ .target = default_target })); |
| 22 | macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target })); | 26 | macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target })); |
| 23 | macho_step.dependOn(testSegmentBoundarySymbols(b, .{ .target = default_target })); | 27 | macho_step.dependOn(testSegmentBoundarySymbols(b, .{ .target = default_target })); |
| | 28 | macho_step.dependOn(testThunks(b, .{ .target = aarch64_target })); |
| 24 | macho_step.dependOn(testTlsLargeTbss(b, .{ .target = default_target })); | 29 | macho_step.dependOn(testTlsLargeTbss(b, .{ .target = default_target })); |
| 25 | macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target })); | 30 | macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target })); |
| 26 | macho_step.dependOn(testWeakBind(b, .{ .target = x86_64_target })); | 31 | macho_step.dependOn(testWeakBind(b, .{ .target = x86_64_target })); |
| ... | @@ -639,6 +644,35 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step { | ... | @@ -639,6 +644,35 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step { |
| 639 | return test_step; | 644 | return test_step; |
| 640 | } | 645 | } |
| 641 | | 646 | |
| | 647 | fn testThunks(b: *Build, opts: Options) *Step { |
| | 648 | const test_step = addTestStep(b, "macho-thunks", opts); |
| | 649 | |
| | 650 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = |
| | 651 | \\#include <stdio.h> |
| | 652 | \\__attribute__((aligned(0x8000000))) int bar() { |
| | 653 | \\ return 42; |
| | 654 | \\} |
| | 655 | \\int foobar(); |
| | 656 | \\int foo() { |
| | 657 | \\ return bar() - foobar(); |
| | 658 | \\} |
| | 659 | \\__attribute__((aligned(0x8000000))) int foobar() { |
| | 660 | \\ return 42; |
| | 661 | \\} |
| | 662 | \\int main() { |
| | 663 | \\ printf("bar=%d, foo=%d, foobar=%d", bar(), foo(), foobar()); |
| | 664 | \\ return foo(); |
| | 665 | \\} |
| | 666 | }); |
| | 667 | |
| | 668 | const run = addRunArtifact(exe); |
| | 669 | run.expectStdOutEqual("bar=42, foo=0, foobar=42"); |
| | 670 | run.expectExitCode(0); |
| | 671 | test_step.dependOn(&run.step); |
| | 672 | |
| | 673 | return test_step; |
| | 674 | } |
| | 675 | |
| 642 | fn testTlsLargeTbss(b: *Build, opts: Options) *Step { | 676 | fn testTlsLargeTbss(b: *Build, opts: Options) *Step { |
| 643 | const test_step = addTestStep(b, "macho-tls-large-tbss", opts); | 677 | const test_step = addTestStep(b, "macho-tls-large-tbss", opts); |
| 644 | | 678 | |