| author | |
| committer | |
| log | d84282174c449325b4bc43fed4d65289445399d4 |
| tree | 58dd1fe1ef5698e427b44a59a8a5be0a03487756 |
| parent | a12abc6d6c8b89a09befdcbd9019247ccc3bd641 |
This test was always really testing correct behavior of our in-house
MachO linker to begin with.7 files changed, 43 insertions(+), 47 deletions(-)
test/link.zig+4-9| ... | ... | @@ -3,11 +3,6 @@ const builtin = @import("builtin"); |
| 3 | 3 | const tests = @import("tests.zig"); |
| 4 | 4 | |
| 5 | 5 | pub fn addCases(cases: *tests.StandaloneContext) void { |
| 6 | if (builtin.os.tag == .windows) { | |
| 7 | // https://github.com/ziglang/zig/issues/12421 | |
| 8 | return; | |
| 9 | } | |
| 10 | ||
| 11 | 6 | cases.addBuildFile("test/link/bss/build.zig", .{ |
| 12 | 7 | .build_modes = false, // we only guarantee zerofill for undefined in Debug |
| 13 | 8 | }); |
| ... | ... | @@ -28,10 +23,6 @@ pub fn addCases(cases: *tests.StandaloneContext) void { |
| 28 | 23 | .build_modes = true, |
| 29 | 24 | }); |
| 30 | 25 | |
| 31 | cases.addBuildFile("test/link/tls/build.zig", .{ | |
| 32 | .build_modes = true, | |
| 33 | }); | |
| 34 | ||
| 35 | 26 | cases.addBuildFile("test/link/wasm/type/build.zig", .{ |
| 36 | 27 | .build_modes = true, |
| 37 | 28 | .requires_stage2 = true, |
| ... | ... | @@ -115,4 +106,8 @@ pub fn addCases(cases: *tests.StandaloneContext) void { |
| 115 | 106 | .build_modes = true, |
| 116 | 107 | .requires_macos_sdk = true, |
| 117 | 108 | }); |
| 109 | ||
| 110 | cases.addBuildFile("test/link/macho/tls/build.zig", .{ | |
| 111 | .build_modes = true, | |
| 112 | }); | |
| 118 | 113 | } |
test/link/macho/tls/a.c created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | _Thread_local int a; | |
| 2 | ||
| 3 | int getA() { | |
| 4 | return a; | |
| 5 | } |
test/link/macho/tls/build.zig created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | const Builder = @import("std").build.Builder; | |
| 2 | ||
| 3 | pub fn build(b: *Builder) void { | |
| 4 | const mode = b.standardReleaseOptions(); | |
| 5 | const target: std.zig.CrossTarget = .{ .os_tag = .macos }; | |
| 6 | ||
| 7 | const lib = b.addSharedLibrary("a", null, b.version(1, 0, 0)); | |
| 8 | lib.setBuildMode(mode); | |
| 9 | lib.addCSourceFile("a.c", &.{}); | |
| 10 | lib.linkLibC(); | |
| 11 | ||
| 12 | const test_exe = b.addTest("main.zig"); | |
| 13 | test_exe.setBuildMode(mode); | |
| 14 | test_exe.linkLibrary(lib); | |
| 15 | test_exe.linkLibC(); | |
| 16 | ||
| 17 | const test_step = b.step("test", "Test it"); | |
| 18 | test_step.dependOn(&test_exe.step); | |
| 19 | } |
test/link/macho/tls/main.zig created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | extern threadlocal var a: i32; | |
| 4 | extern fn getA() i32; | |
| 5 | ||
| 6 | fn getA2() i32 { | |
| 7 | return a; | |
| 8 | } | |
| 9 | ||
| 10 | test { | |
| 11 | a = 2; | |
| 12 | try std.testing.expect(getA() == 2); | |
| 13 | try std.testing.expect(2 == getA2()); | |
| 14 | try std.testing.expect(getA() == getA2()); | |
| 15 | } |
test/link/tls/a.c deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | _Thread_local int a; | |
| 2 | ||
| 3 | int getA() { | |
| 4 | return a; | |
| 5 | } |
test/link/tls/build.zig deleted-18| ... | ... | @@ -1,18 +0,0 @@ |
| 1 | const Builder = @import("std").build.Builder; | |
| 2 | ||
| 3 | pub fn build(b: *Builder) void { | |
| 4 | const mode = b.standardReleaseOptions(); | |
| 5 | ||
| 6 | const lib = b.addSharedLibrary("a", null, b.version(1, 0, 0)); | |
| 7 | lib.setBuildMode(mode); | |
| 8 | lib.addCSourceFile("a.c", &.{}); | |
| 9 | lib.linkLibC(); | |
| 10 | ||
| 11 | const test_exe = b.addTest("main.zig"); | |
| 12 | test_exe.setBuildMode(mode); | |
| 13 | test_exe.linkLibrary(lib); | |
| 14 | test_exe.linkLibC(); | |
| 15 | ||
| 16 | const test_step = b.step("test", "Test it"); | |
| 17 | test_step.dependOn(&test_exe.step); | |
| 18 | } |
test/link/tls/main.zig deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | extern threadlocal var a: i32; | |
| 4 | extern fn getA() i32; | |
| 5 | ||
| 6 | fn getA2() i32 { | |
| 7 | return a; | |
| 8 | } | |
| 9 | ||
| 10 | test { | |
| 11 | a = 2; | |
| 12 | try std.testing.expect(getA() == 2); | |
| 13 | try std.testing.expect(2 == getA2()); | |
| 14 | try std.testing.expect(getA() == getA2()); | |
| 15 | } |