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
This commit is contained in:
Andrew Kelley 2025-01-15 19:44:20 -08:00
parent cf898e242a
commit 24bdb42a23

View File

@ -70,23 +70,27 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt
check_exe.checkExact("type function");
if (optimize_mode == .Debug) {
check_exe.checkExact("name __wasm_init_memory");
check_exe.checkExact("name __wasm_init_tls");
}
check_exe.checkExact("name __wasm_init_tls");
check_exe.checkExact("type global");
// In debug mode the symbol __tls_base is resolved to an undefined symbol
// from the object file, hence its placement differs than in release modes
// where the entire tls segment is optimized away, and tls_base will have
// its original position.
check_exe.checkExact("name __tls_base");
check_exe.checkExact("name __tls_size");
check_exe.checkExact("name __tls_align");
check_exe.checkExact("type data_segment");
if (optimize_mode == .Debug) {
check_exe.checkExact("name __tls_base");
check_exe.checkExact("name __tls_size");
check_exe.checkExact("name __tls_align");
check_exe.checkExact("type data_segment");
check_exe.checkExact("names 1");
check_exe.checkExact("index 0");
check_exe.checkExact("name .tdata");
} else {
check_exe.checkNotPresent("name __tls_base");
check_exe.checkNotPresent("name __tls_size");
check_exe.checkNotPresent("name __tls_align");
}
test_step.dependOn(&check_exe.step);