Commit 24bdb42a23

Andrew Kelley <andrew@ziglang.org>
2025-01-16 04:44:20
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 parent cf898e2
Changed files (1)
test
link
wasm
shared-memory
test/link/wasm/shared-memory/build.zig
@@ -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);