authorgravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2022-12-28 14:59:53+01:00
committergravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2022-12-28 15:57:19+01:00
log4bffe645c6e621cdda858f9eeb4436980fece25c
treea7a0d4b435ac6e464aad981837e9fe5b279cb9ca
parent30f2bb8464bdae0af4920752aecaf61a3319b881
signaturelock-open Commit is signed but in an unrecognized format.

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 files changed, 6 insertions(+), 2 deletions(-)

lib/std/build/LibExeObjStep.zig+6-2
...@@ -74,6 +74,9 @@ disable_sanitize_c: bool,...@@ -74,6 +74,9 @@ disable_sanitize_c: bool,
74sanitize_thread: bool,74sanitize_thread: bool,
75rdynamic: bool,75rdynamic: bool,
76import_memory: bool = false,76import_memory: bool = false,
77/// For WebAssembly targets, this will allow for undefined symbols to
78/// be imported from the host environment.
79import_symbols: bool = false,
77import_table: bool = false,80import_table: bool = false,
78export_table: bool = false,81export_table: bool = false,
79initial_memory: ?u64 = null,82initial_memory: ?u64 = null,
...@@ -1458,6 +1461,9 @@ fn make(step: *Step) !void {...@@ -1458,6 +1461,9 @@ fn make(step: *Step) !void {
1458 if (self.import_memory) {1461 if (self.import_memory) {
1459 try zig_args.append("--import-memory");1462 try zig_args.append("--import-memory");
1460 }1463 }
1464 if (self.import_symbols) {
1465 try zig_args.append("--import-symbols");
1466 }
1461 if (self.import_table) {1467 if (self.import_table) {
1462 try zig_args.append("--import-table");1468 try zig_args.append("--import-table");
1463 }1469 }
...@@ -1609,8 +1615,6 @@ fn make(step: *Step) !void {...@@ -1609,8 +1615,6 @@ fn make(step: *Step) !void {
1609 try zig_args.append(bin_name);1615 try zig_args.append(bin_name);
1610 try zig_args.append("--test-cmd");1616 try zig_args.append("--test-cmd");
1611 try zig_args.append("--dir=.");1617 try zig_args.append("--dir=.");
1612 try zig_args.append("--test-cmd");
1613 try zig_args.append("--allow-unknown-exports"); // TODO: Remove when stage2 is default compiler
1614 try zig_args.append("--test-cmd-bin");1618 try zig_args.append("--test-cmd-bin");
1615 } else {1619 } else {
1616 try zig_args.append("--test-no-exec");1620 try zig_args.append("--test-no-exec");