Skip to content

Commit

Permalink
macho: fix tls test
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Jan 6, 2024
1 parent e3dacf8 commit 004a609
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/macho.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2525,13 +2525,14 @@ fn testTls(b: *Build, opts: Options) *Step {
const test_step = b.step("test-macho-tls", "");

const dylib = cc(b, opts);
dylib.addArg("-shared");
dylib.addCSource(
\\_Thread_local int a;
\\int getA() {
\\ return a;
\\}
);
dylib.addArgs(&.{ "-shared", "-Wl,-install_name,@rpath/liba.dylib" });
const dylib_out = dylib.saveOutputAs("liba.dylib");

const exe = cc(b, opts);
exe.addCSource(
Expand All @@ -2548,7 +2549,8 @@ fn testTls(b: *Build, opts: Options) *Step {
\\}
);
exe.addArg("-la");
exe.addPrefixedDirectorySource("-L", dylib.saveOutputAs("liba.dylib").dir);
exe.addPrefixedDirectorySource("-L", dylib_out.dir);
exe.addPrefixedDirectorySource("-Wl,-rpath,", dylib_out.dir);

const run = exe.run();
run.expectStdOutEqual("2 2 2");
Expand Down

0 comments on commit 004a609

Please sign in to comment.