authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-01-14 10:38:06+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-01-24 12:34:40+01:00
logfa649cad4e1c5a291dfcd7a5f766e8992be28f72
tree7b586dbdb08225c91186f78eae3915e5fea2f7a7
parent9fce2e2233733e1ada2b1440012ae78675e196f9

test/link/macho: test large .tbss section


1 files changed, 22 insertions(+), 0 deletions(-)

test/link/macho.zig+22
...@@ -21,6 +21,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {...@@ -21,6 +21,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
21 macho_step.dependOn(testMhExecuteHeader(b, .{ .target = default_target }));21 macho_step.dependOn(testMhExecuteHeader(b, .{ .target = default_target }));
22 macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target }));22 macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target }));
23 macho_step.dependOn(testSegmentBoundarySymbols(b, .{ .target = default_target }));23 macho_step.dependOn(testSegmentBoundarySymbols(b, .{ .target = default_target }));
24 macho_step.dependOn(testTlsLargeTbss(b, .{ .target = default_target }));
24 macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target }));25 macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target }));
25 macho_step.dependOn(testWeakBind(b, .{ .target = x86_64_target }));26 macho_step.dependOn(testWeakBind(b, .{ .target = x86_64_target }));
2627
...@@ -637,6 +638,27 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step {...@@ -637,6 +638,27 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step {
637 return test_step;638 return test_step;
638}639}
639640
641fn testTlsLargeTbss(b: *Build, opts: Options) *Step {
642 const test_step = addTestStep(b, "macho-tls-large-tbss", opts);
643
644 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
645 \\#include <stdio.h>
646 \\_Thread_local int x[0x8000];
647 \\_Thread_local int y[0x8000];
648 \\int main() {
649 \\ x[0] = 3;
650 \\ x[0x7fff] = 5;
651 \\ printf("%d %d %d %d %d %d\n", x[0], x[1], x[0x7fff], y[0], y[1], y[0x7fff]);
652 \\}
653 });
654
655 const run = addRunArtifact(exe);
656 run.expectStdOutEqual("3 0 5 0 0 0\n");
657 test_step.dependOn(&run.step);
658
659 return test_step;
660}
661
640fn testUndefinedFlag(b: *Build, opts: Options) *Step {662fn testUndefinedFlag(b: *Build, opts: Options) *Step {
641 const test_step = addTestStep(b, "macho-undefined-flag", opts);663 const test_step = addTestStep(b, "macho-undefined-flag", opts);
642664