aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2024-01-14 10:38:06 +0100
committerJakub Konka <kubkon@jakubkonka.com>2024-01-24 12:34:40 +0100
commitfa649cad4e1c5a291dfcd7a5f766e8992be28f72 (patch)
tree7b586dbdb08225c91186f78eae3915e5fea2f7a7 /test
parent9fce2e2233733e1ada2b1440012ae78675e196f9 (diff)
downloadzig-fa649cad4e1c5a291dfcd7a5f766e8992be28f72.tar.gz
zig-fa649cad4e1c5a291dfcd7a5f766e8992be28f72.zip
test/link/macho: test large .tbss section
Diffstat (limited to 'test')
-rw-r--r--test/link/macho.zig22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/link/macho.zig b/test/link/macho.zig
index 4387a614c5..58ef007565 100644
--- a/test/link/macho.zig
+++ b/test/link/macho.zig
@@ -21,6 +21,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
macho_step.dependOn(testMhExecuteHeader(b, .{ .target = default_target }));
macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target }));
macho_step.dependOn(testSegmentBoundarySymbols(b, .{ .target = default_target }));
+ macho_step.dependOn(testTlsLargeTbss(b, .{ .target = default_target }));
macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target }));
macho_step.dependOn(testWeakBind(b, .{ .target = x86_64_target }));
@@ -637,6 +638,27 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step {
return test_step;
}
+fn testTlsLargeTbss(b: *Build, opts: Options) *Step {
+ const test_step = addTestStep(b, "macho-tls-large-tbss", opts);
+
+ const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
+ \\#include <stdio.h>
+ \\_Thread_local int x[0x8000];
+ \\_Thread_local int y[0x8000];
+ \\int main() {
+ \\ x[0] = 3;
+ \\ x[0x7fff] = 5;
+ \\ printf("%d %d %d %d %d %d\n", x[0], x[1], x[0x7fff], y[0], y[1], y[0x7fff]);
+ \\}
+ });
+
+ const run = addRunArtifact(exe);
+ run.expectStdOutEqual("3 0 5 0 0 0\n");
+ test_step.dependOn(&run.step);
+
+ return test_step;
+}
+
fn testUndefinedFlag(b: *Build, opts: Options) *Step {
const test_step = addTestStep(b, "macho-undefined-flag", opts);