| ... | @@ -38,8 +38,8 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { | ... | @@ -38,8 +38,8 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 38 | macho_step.dependOn(testLayout(b, .{ .target = default_target })); | 38 | macho_step.dependOn(testLayout(b, .{ .target = default_target })); |
| 39 | macho_step.dependOn(testLinkingStaticLib(b, .{ .target = default_target })); | 39 | macho_step.dependOn(testLinkingStaticLib(b, .{ .target = default_target })); |
| 40 | macho_step.dependOn(testLinksection(b, .{ .target = default_target })); | 40 | macho_step.dependOn(testLinksection(b, .{ .target = default_target })); |
| 41 | macho_step.dependOn(testMergeLiterals(b, .{ .target = aarch64_target })); | 41 | macho_step.dependOn(testMergeLiteralsArm64(b, .{ .target = aarch64_target })); |
| 42 | macho_step.dependOn(testMergeLiterals2(b, .{ .target = aarch64_target })); | 42 | macho_step.dependOn(testMergeLiteralsArm642(b, .{ .target = aarch64_target })); |
| 43 | macho_step.dependOn(testMhExecuteHeader(b, .{ .target = default_target })); | 43 | macho_step.dependOn(testMhExecuteHeader(b, .{ .target = default_target })); |
| 44 | macho_step.dependOn(testNoDeadStrip(b, .{ .target = default_target })); | 44 | macho_step.dependOn(testNoDeadStrip(b, .{ .target = default_target })); |
| 45 | macho_step.dependOn(testNoExportsDylib(b, .{ .target = default_target })); | 45 | macho_step.dependOn(testNoExportsDylib(b, .{ .target = default_target })); |
| ... | @@ -917,7 +917,7 @@ fn testLinksection(b: *Build, opts: Options) *Step { | ... | @@ -917,7 +917,7 @@ fn testLinksection(b: *Build, opts: Options) *Step { |
| 917 | return test_step; | 917 | return test_step; |
| 918 | } | 918 | } |
| 919 | | 919 | |
| 920 | fn testMergeLiterals(b: *Build, opts: Options) *Step { | 920 | fn testMergeLiteralsArm64(b: *Build, opts: Options) *Step { |
| 921 | const test_step = addTestStep(b, "merge-literals", opts); | 921 | const test_step = addTestStep(b, "merge-literals", opts); |
| 922 | | 922 | |
| 923 | const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes = | 923 | const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes = |
| ... | @@ -988,22 +988,27 @@ fn testMergeLiterals(b: *Build, opts: Options) *Step { | ... | @@ -988,22 +988,27 @@ fn testMergeLiterals(b: *Build, opts: Options) *Step { |
| 988 | \\} | 988 | \\} |
| 989 | }); | 989 | }); |
| 990 | | 990 | |
| | 991 | const runWithChecks = struct { |
| | 992 | fn runWithChecks(step: *Step, exe: *Compile) void { |
| | 993 | const run = addRunArtifact(exe); |
| | 994 | run.expectStdOutEqual("hello, hello, world, 1.234500, 1.234500"); |
| | 995 | step.dependOn(&run.step); |
| | 996 | |
| | 997 | const check = exe.checkObject(); |
| | 998 | check.dumpSection("__TEXT,__const"); |
| | 999 | check.checkContains("\x8d\x97n\x12\x83\xc0\xf3?"); |
| | 1000 | check.dumpSection("__TEXT,__cstring"); |
| | 1001 | check.checkContains("hello\x00world\x00%s, %s, %s, %f, %f\x00"); |
| | 1002 | step.dependOn(&check.step); |
| | 1003 | } |
| | 1004 | }.runWithChecks; |
| | 1005 | |
| 991 | { | 1006 | { |
| 992 | const exe = addExecutable(b, opts, .{ .name = "main1" }); | 1007 | const exe = addExecutable(b, opts, .{ .name = "main1" }); |
| 993 | exe.addObject(a_o); | 1008 | exe.addObject(a_o); |
| 994 | exe.addObject(b_o); | 1009 | exe.addObject(b_o); |
| 995 | exe.addObject(main_o); | 1010 | exe.addObject(main_o); |
| 996 | | 1011 | runWithChecks(test_step, exe); |
| 997 | const run = addRunArtifact(exe); | | |
| 998 | run.expectStdOutEqual("hello, hello, world, 1.234500, 1.234500"); | | |
| 999 | test_step.dependOn(&run.step); | | |
| 1000 | | | |
| 1001 | const check = exe.checkObject(); | | |
| 1002 | check.dumpSection("__TEXT,__const"); | | |
| 1003 | check.checkContains("\x8d\x97n\x12\x83\xc0\xf3?"); | | |
| 1004 | check.dumpSection("__TEXT,__cstring"); | | |
| 1005 | check.checkContains("hello\x00world\x00%s, %s, %s, %f, %f\x00"); | | |
| 1006 | test_step.dependOn(&check.step); | | |
| 1007 | } | 1012 | } |
| 1008 | | 1013 | |
| 1009 | { | 1014 | { |
| ... | @@ -1011,17 +1016,7 @@ fn testMergeLiterals(b: *Build, opts: Options) *Step { | ... | @@ -1011,17 +1016,7 @@ fn testMergeLiterals(b: *Build, opts: Options) *Step { |
| 1011 | exe.addObject(b_o); | 1016 | exe.addObject(b_o); |
| 1012 | exe.addObject(a_o); | 1017 | exe.addObject(a_o); |
| 1013 | exe.addObject(main_o); | 1018 | exe.addObject(main_o); |
| 1014 | | 1019 | runWithChecks(test_step, exe); |
| 1015 | const run = addRunArtifact(exe); | | |
| 1016 | run.expectStdOutEqual("hello, hello, world, 1.234500, 1.234500"); | | |
| 1017 | test_step.dependOn(&run.step); | | |
| 1018 | | | |
| 1019 | const check = exe.checkObject(); | | |
| 1020 | check.dumpSection("__TEXT,__const"); | | |
| 1021 | check.checkContains("\x8d\x97n\x12\x83\xc0\xf3?"); | | |
| 1022 | check.dumpSection("__TEXT,__cstring"); | | |
| 1023 | check.checkContains("hello\x00world\x00%s, %s, %s, %f, %f\x00"); | | |
| 1024 | test_step.dependOn(&check.step); | | |
| 1025 | } | 1020 | } |
| 1026 | | 1021 | |
| 1027 | { | 1022 | { |
| ... | @@ -1032,17 +1027,7 @@ fn testMergeLiterals(b: *Build, opts: Options) *Step { | ... | @@ -1032,17 +1027,7 @@ fn testMergeLiterals(b: *Build, opts: Options) *Step { |
| 1032 | | 1027 | |
| 1033 | const exe = addExecutable(b, opts, .{ .name = "main3" }); | 1028 | const exe = addExecutable(b, opts, .{ .name = "main3" }); |
| 1034 | exe.addObject(c_o); | 1029 | exe.addObject(c_o); |
| 1035 | | 1030 | runWithChecks(test_step, exe); |
| 1036 | const run = addRunArtifact(exe); | | |
| 1037 | run.expectStdOutEqual("hello, hello, world, 1.234500, 1.234500"); | | |
| 1038 | test_step.dependOn(&run.step); | | |
| 1039 | | | |
| 1040 | const check = exe.checkObject(); | | |
| 1041 | check.dumpSection("__TEXT,__const"); | | |
| 1042 | check.checkContains("\x8d\x97n\x12\x83\xc0\xf3?"); | | |
| 1043 | check.dumpSection("__TEXT,__cstring"); | | |
| 1044 | check.checkContains("hello\x00world\x00%s, %s, %s, %f, %f\x00"); | | |
| 1045 | test_step.dependOn(&check.step); | | |
| 1046 | } | 1031 | } |
| 1047 | | 1032 | |
| 1048 | return test_step; | 1033 | return test_step; |
| ... | @@ -1052,7 +1037,7 @@ fn testMergeLiterals(b: *Build, opts: Options) *Step { | ... | @@ -1052,7 +1037,7 @@ fn testMergeLiterals(b: *Build, opts: Options) *Step { |
| 1052 | /// However, this is by design as we want to test that the linker does not panic when linking it | 1037 | /// However, this is by design as we want to test that the linker does not panic when linking it |
| 1053 | /// which is also the case for the system linker and lld - linking succeeds, runtime segfaults. | 1038 | /// which is also the case for the system linker and lld - linking succeeds, runtime segfaults. |
| 1054 | /// It should also be mentioned that runtime segfault is not due to the linker but faulty input asm. | 1039 | /// It should also be mentioned that runtime segfault is not due to the linker but faulty input asm. |
| 1055 | fn testMergeLiterals2(b: *Build, opts: Options) *Step { | 1040 | fn testMergeLiteralsArm642(b: *Build, opts: Options) *Step { |
| 1056 | const test_step = addTestStep(b, "merge-literals-2", opts); | 1041 | const test_step = addTestStep(b, "merge-literals-2", opts); |
| 1057 | | 1042 | |
| 1058 | const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes = | 1043 | const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes = |