| ... | ... | @@ -25,6 +25,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 25 | 25 | macho_step.dependOn(testLinkingStaticLib(b, .{ .use_llvm = false, .target = x86_64_target })); |
| 26 | 26 | macho_step.dependOn(testReexportsZig(b, .{ .use_llvm = false, .target = x86_64_target })); |
| 27 | 27 | macho_step.dependOn(testRelocatableZig(b, .{ .use_llvm = false, .target = x86_64_target })); |
| 28 | macho_step.dependOn(testTlsZig(b, .{ .use_llvm = false, .target = x86_64_target })); |
| 28 | 29 | |
| 29 | 30 | // Exercise linker with LLVM backend |
| 30 | 31 | macho_step.dependOn(testDeadStrip(b, .{ .target = default_target })); |
| ... | ... | @@ -56,6 +57,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 56 | 57 | macho_step.dependOn(testTentative(b, .{ .target = default_target })); |
| 57 | 58 | macho_step.dependOn(testThunks(b, .{ .target = aarch64_target })); |
| 58 | 59 | macho_step.dependOn(testTlsLargeTbss(b, .{ .target = default_target })); |
| 60 | macho_step.dependOn(testTlsZig(b, .{ .target = default_target })); |
| 59 | 61 | macho_step.dependOn(testUndefinedFlag(b, .{ .target = default_target })); |
| 60 | 62 | macho_step.dependOn(testUnwindInfo(b, .{ .target = default_target })); |
| 61 | 63 | macho_step.dependOn(testUnwindInfoNoSubsectionsX64(b, .{ .target = x86_64_target })); |
| ... | ... | @@ -2274,6 +2276,32 @@ fn testTlsLargeTbss(b: *Build, opts: Options) *Step { |
| 2274 | 2276 | return test_step; |
| 2275 | 2277 | } |
| 2276 | 2278 | |
| 2279 | fn testTlsZig(b: *Build, opts: Options) *Step { |
| 2280 | const test_step = addTestStep(b, "tls-zig", opts); |
| 2281 | |
| 2282 | const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes = |
| 2283 | \\const std = @import("std"); |
| 2284 | \\threadlocal var x: i32 = 0; |
| 2285 | \\threadlocal var y: i32 = -1; |
| 2286 | \\pub fn main() void { |
| 2287 | \\ std.io.getStdOut().writer().print("{d} {d}\n", .{x, y}) catch unreachable; |
| 2288 | \\ x -= 1; |
| 2289 | \\ y += 1; |
| 2290 | \\ std.io.getStdOut().writer().print("{d} {d}\n", .{x, y}) catch unreachable; |
| 2291 | \\} |
| 2292 | }); |
| 2293 | |
| 2294 | const run = addRunArtifact(exe); |
| 2295 | run.expectStdOutEqual( |
| 2296 | \\0 -1 |
| 2297 | \\-1 0 |
| 2298 | \\ |
| 2299 | ); |
| 2300 | test_step.dependOn(&run.step); |
| 2301 | |
| 2302 | return test_step; |
| 2303 | } |
| 2304 | |
| 2277 | 2305 | fn testTwoLevelNamespace(b: *Build, opts: Options) *Step { |
| 2278 | 2306 | const test_step = addTestStep(b, "two-level-namespace", opts); |
| 2279 | 2307 | |