authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-01-15 19:44:20-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-01-15 19:44:20-08:00
log24bdb42a23828d71238370af5d16a2421bf3216f
treea4edfb3e76eee5525a1f9a9386c53144ee7647dc
parentcf898e242a32b589e63a8de6674a5c2d6f5225bc

test/link/wasm/shared-memory: update to better linker behavior

now it's smarter about omitting tls stuff if there end up being no TLS data sections

1 files changed, 10 insertions(+), 6 deletions(-)

test/link/wasm/shared-memory/build.zig+10-6
...@@ -70,23 +70,27 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt...@@ -70,23 +70,27 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt
70 check_exe.checkExact("type function");70 check_exe.checkExact("type function");
71 if (optimize_mode == .Debug) {71 if (optimize_mode == .Debug) {
72 check_exe.checkExact("name __wasm_init_memory");72 check_exe.checkExact("name __wasm_init_memory");
73 check_exe.checkExact("name __wasm_init_tls");
73 }74 }
74 check_exe.checkExact("name __wasm_init_tls");
75 check_exe.checkExact("type global");75 check_exe.checkExact("type global");
7676
77 // In debug mode the symbol __tls_base is resolved to an undefined symbol77 // In debug mode the symbol __tls_base is resolved to an undefined symbol
78 // from the object file, hence its placement differs than in release modes78 // from the object file, hence its placement differs than in release modes
79 // where the entire tls segment is optimized away, and tls_base will have79 // where the entire tls segment is optimized away, and tls_base will have
80 // its original position.80 // its original position.
81 check_exe.checkExact("name __tls_base");
82 check_exe.checkExact("name __tls_size");
83 check_exe.checkExact("name __tls_align");
84
85 check_exe.checkExact("type data_segment");
86 if (optimize_mode == .Debug) {81 if (optimize_mode == .Debug) {
82 check_exe.checkExact("name __tls_base");
83 check_exe.checkExact("name __tls_size");
84 check_exe.checkExact("name __tls_align");
85
86 check_exe.checkExact("type data_segment");
87 check_exe.checkExact("names 1");87 check_exe.checkExact("names 1");
88 check_exe.checkExact("index 0");88 check_exe.checkExact("index 0");
89 check_exe.checkExact("name .tdata");89 check_exe.checkExact("name .tdata");
90 } else {
91 check_exe.checkNotPresent("name __tls_base");
92 check_exe.checkNotPresent("name __tls_size");
93 check_exe.checkNotPresent("name __tls_align");
90 }94 }
9195
92 test_step.dependOn(&check_exe.step);96 test_step.dependOn(&check_exe.step);