zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 4bffe645c6e621cdda858f9eeb4436980fece25c (tree)
parent 30f2bb8464bdae0af4920752aecaf61a3319b881
Author: Luuk de Gram <luuk@degram.dev>
Date:   Wed, 28 Dec 2022 14:59:53 +0100

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

Diffstat:
Mlib/std/build/LibExeObjStep.zig | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/std/build/LibExeObjStep.zig b/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");