| ... | @@ -28,6 +28,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { | ... | @@ -28,6 +28,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 28 | macho_step.dependOn(testNoDeadStrip(b, .{ .target = default_target })); | 28 | macho_step.dependOn(testNoDeadStrip(b, .{ .target = default_target })); |
| 29 | macho_step.dependOn(testNoExportsDylib(b, .{ .target = default_target })); | 29 | macho_step.dependOn(testNoExportsDylib(b, .{ .target = default_target })); |
| 30 | macho_step.dependOn(testPagezeroSize(b, .{ .target = default_target })); | 30 | macho_step.dependOn(testPagezeroSize(b, .{ .target = default_target })); |
| | 31 | macho_step.dependOn(testReexportsZig(b, .{ .target = default_target })); |
| 31 | macho_step.dependOn(testRelocatable(b, .{ .target = default_target })); | 32 | macho_step.dependOn(testRelocatable(b, .{ .target = default_target })); |
| 32 | macho_step.dependOn(testRelocatableZig(b, .{ .target = default_target })); | 33 | macho_step.dependOn(testRelocatableZig(b, .{ .target = default_target })); |
| 33 | macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target })); | 34 | macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target })); |
| ... | @@ -897,6 +898,35 @@ fn testPagezeroSize(b: *Build, opts: Options) *Step { | ... | @@ -897,6 +898,35 @@ fn testPagezeroSize(b: *Build, opts: Options) *Step { |
| 897 | return test_step; | 898 | return test_step; |
| 898 | } | 899 | } |
| 899 | | 900 | |
| | 901 | fn testReexportsZig(b: *Build, opts: Options) *Step { |
| | 902 | const test_step = addTestStep(b, "macho-reexports-zig", opts); |
| | 903 | |
| | 904 | const lib = addStaticLibrary(b, opts, .{ .name = "a", .zig_source_bytes = |
| | 905 | \\const x: i32 = 42; |
| | 906 | \\export fn foo() i32 { |
| | 907 | \\ return x; |
| | 908 | \\} |
| | 909 | \\comptime { |
| | 910 | \\ @export(foo, .{ .name = "bar", .linkage = .Strong }); |
| | 911 | \\} |
| | 912 | }); |
| | 913 | |
| | 914 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = |
| | 915 | \\extern int foo(); |
| | 916 | \\extern int bar(); |
| | 917 | \\int main() { |
| | 918 | \\ return bar() - foo(); |
| | 919 | \\} |
| | 920 | }); |
| | 921 | exe.linkLibrary(lib); |
| | 922 | |
| | 923 | const run = addRunArtifact(exe); |
| | 924 | run.expectExitCode(0); |
| | 925 | test_step.dependOn(&run.step); |
| | 926 | |
| | 927 | return test_step; |
| | 928 | } |
| | 929 | |
| 900 | fn testRelocatable(b: *Build, opts: Options) *Step { | 930 | fn testRelocatable(b: *Build, opts: Options) *Step { |
| 901 | const test_step = addTestStep(b, "macho-relocatable", opts); | 931 | const test_step = addTestStep(b, "macho-relocatable", opts); |
| 902 | | 932 | |