Commit 4bffe645c6

Luuk de Gram <luuk@degram.dev>
2022-12-28 14:59:53
std: remove hack in test step
This hack was initially introduced as we would export all symbols unconditionally, including non-function definitions. This would cause an error from the Wasmtime runtime engine, which this flag would suppress. As we now properly export symbols, this flag is no longer needed and any user running into this error can manually include it. This commit also adds the `--import-symbols` ability to build.zig
1 parent 30f2bb8
Changed files (1)
lib
lib/std/build/LibExeObjStep.zig
@@ -74,6 +74,9 @@ disable_sanitize_c: bool,
 sanitize_thread: bool,
 rdynamic: bool,
 import_memory: bool = false,
+/// For WebAssembly targets, this will allow for undefined symbols to
+/// be imported from the host environment.
+import_symbols: bool = false,
 import_table: bool = false,
 export_table: bool = false,
 initial_memory: ?u64 = null,
@@ -1458,6 +1461,9 @@ fn make(step: *Step) !void {
     if (self.import_memory) {
         try zig_args.append("--import-memory");
     }
+    if (self.import_symbols) {
+        try zig_args.append("--import-symbols");
+    }
     if (self.import_table) {
         try zig_args.append("--import-table");
     }
@@ -1609,8 +1615,6 @@ fn make(step: *Step) !void {
                     try zig_args.append(bin_name);
                     try zig_args.append("--test-cmd");
                     try zig_args.append("--dir=.");
-                    try zig_args.append("--test-cmd");
-                    try zig_args.append("--allow-unknown-exports"); // TODO: Remove when stage2 is default compiler
                     try zig_args.append("--test-cmd-bin");
                 } else {
                     try zig_args.append("--test-no-exec");