| ... | ... | @@ -53,6 +53,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 53 | 53 | macho_step.dependOn(testRelocatable(b, .{ .target = default_target })); |
| 54 | 54 | macho_step.dependOn(testRelocatableZig(b, .{ .target = default_target })); |
| 55 | 55 | macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target })); |
| 56 | macho_step.dependOn(testSectionBoundarySymbols2(b, .{ .target = default_target })); |
| 56 | 57 | macho_step.dependOn(testSegmentBoundarySymbols(b, .{ .target = default_target })); |
| 57 | 58 | macho_step.dependOn(testSymbolStabs(b, .{ .target = default_target })); |
| 58 | 59 | macho_step.dependOn(testStackSize(b, .{ .target = default_target })); |
| ... | ... | @@ -1962,6 +1963,43 @@ fn testSectionBoundarySymbols(b: *Build, opts: Options) *Step { |
| 1962 | 1963 | return test_step; |
| 1963 | 1964 | } |
| 1964 | 1965 | |
| 1966 | fn testSectionBoundarySymbols2(b: *Build, opts: Options) *Step { |
| 1967 | const test_step = addTestStep(b, "section-boundary-symbols-2", opts); |
| 1968 | |
| 1969 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = |
| 1970 | \\#include <stdio.h> |
| 1971 | \\struct pair { int a; int b; }; |
| 1972 | \\struct pair first __attribute__((section("__DATA,__pairs"))) = { 1, 2 }; |
| 1973 | \\struct pair second __attribute__((section("__DATA,__pairs"))) = { 3, 4 }; |
| 1974 | \\extern struct pair pairs_start __asm("section$start$__DATA$__pairs"); |
| 1975 | \\extern struct pair pairs_end __asm("section$end$__DATA$__pairs"); |
| 1976 | \\int main() { |
| 1977 | \\ printf("%d,%d\n", first.a, first.b); |
| 1978 | \\ printf("%d,%d\n", second.a, second.b); |
| 1979 | \\ struct pair* p; |
| 1980 | \\ for (p = &pairs_start; p < &pairs_end; p++) { |
| 1981 | \\ p->a = 0; |
| 1982 | \\ } |
| 1983 | \\ printf("%d,%d\n", first.a, first.b); |
| 1984 | \\ printf("%d,%d\n", second.a, second.b); |
| 1985 | \\ return 0; |
| 1986 | \\} |
| 1987 | }); |
| 1988 | |
| 1989 | const run = b.addRunArtifact(exe); |
| 1990 | run.skip_foreign_checks = true; |
| 1991 | run.expectStdOutEqual( |
| 1992 | \\1,2 |
| 1993 | \\3,4 |
| 1994 | \\0,2 |
| 1995 | \\0,4 |
| 1996 | \\ |
| 1997 | ); |
| 1998 | test_step.dependOn(&run.step); |
| 1999 | |
| 2000 | return test_step; |
| 2001 | } |
| 2002 | |
| 1965 | 2003 | fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step { |
| 1966 | 2004 | const test_step = addTestStep(b, "segment-boundary-symbols", opts); |
| 1967 | 2005 | |