mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
macho: test TLS in Zig with x86_64 backend
This commit is contained in:
parent
234aa86802
commit
f9fbd6302f
1 changed files with 28 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
|
|||
macho_step.dependOn(testLinkingStaticLib(b, .{ .use_llvm = false, .target = x86_64_target }));
|
||||
macho_step.dependOn(testReexportsZig(b, .{ .use_llvm = false, .target = x86_64_target }));
|
||||
macho_step.dependOn(testRelocatableZig(b, .{ .use_llvm = false, .target = x86_64_target }));
|
||||
macho_step.dependOn(testTlsZig(b, .{ .use_llvm = false, .target = x86_64_target }));
|
||||
|
||||
// Exercise linker with LLVM backend
|
||||
macho_step.dependOn(testDeadStrip(b, .{ .target = default_target }));
|
||||
|
|
@ -56,6 +57,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
|
|||
macho_step.dependOn(testTentative(b, .{ .target = default_target }));
|
||||
macho_step.dependOn(testThunks(b, .{ .target = aarch64_target }));
|
||||
macho_step.dependOn(testTlsLargeTbss(b, .{ .target = default_target }));
|
||||
macho_step.dependOn(testTlsZig(b, .{ .target = default_target }));
|
||||
macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target }));
|
||||
macho_step.dependOn(testUnwindInfo(b, .{ .target = default_target }));
|
||||
macho_step.dependOn(testUnwindInfoNoSubsectionsX64(b, .{ .target = x86_64_target }));
|
||||
|
|
@ -2274,6 +2276,32 @@ fn testTlsLargeTbss(b: *Build, opts: Options) *Step {
|
|||
return test_step;
|
||||
}
|
||||
|
||||
fn testTlsZig(b: *Build, opts: Options) *Step {
|
||||
const test_step = addTestStep(b, "tls-zig", opts);
|
||||
|
||||
const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =
|
||||
\\const std = @import("std");
|
||||
\\threadlocal var x: i32 = 0;
|
||||
\\threadlocal var y: i32 = -1;
|
||||
\\pub fn main() void {
|
||||
\\ std.io.getStdOut().writer().print("{d} {d}\n", .{x, y}) catch unreachable;
|
||||
\\ x -= 1;
|
||||
\\ y += 1;
|
||||
\\ std.io.getStdOut().writer().print("{d} {d}\n", .{x, y}) catch unreachable;
|
||||
\\}
|
||||
});
|
||||
|
||||
const run = addRunArtifact(exe);
|
||||
run.expectStdOutEqual(
|
||||
\\0 -1
|
||||
\\-1 0
|
||||
\\
|
||||
);
|
||||
test_step.dependOn(&run.step);
|
||||
|
||||
return test_step;
|
||||
}
|
||||
|
||||
fn testTwoLevelNamespace(b: *Build, opts: Options) *Step {
|
||||
const test_step = addTestStep(b, "two-level-namespace", opts);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue