diff options
| author | Luuk de Gram <luuk@degram.dev> | 2023-06-18 17:50:51 +0200 |
|---|---|---|
| committer | Luuk de Gram <luuk@degram.dev> | 2023-06-26 20:00:57 +0200 |
| commit | 381937116326400c1162a710c16496152b542443 (patch) | |
| tree | 21e841fedeae8a5a1dac655cec5a2cab724e7175 /src/Compilation.zig | |
| parent | 7322aa118376a635ab077ca833dd152639953337 (diff) | |
| download | zig-381937116326400c1162a710c16496152b542443.tar.gz zig-381937116326400c1162a710c16496152b542443.zip | |
wasm-ld: implement `--export-memory` flag
This flag allows the user to force export the memory to the host
environment. This is useful when the memory is imported from the
host but must also be exported. This is (currently) required
to pass the memory validation for runtimes when using threads.
In this future this may become an error instead.
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 92de342a16..4e0a36d652 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -557,6 +557,7 @@ pub const InitOptions = struct { linker_allow_shlib_undefined: ?bool = null, linker_bind_global_refs_locally: ?bool = null, linker_import_memory: ?bool = null, + linker_export_memory: ?bool = null, linker_import_symbols: bool = false, linker_import_table: bool = false, linker_export_table: bool = false, @@ -1463,6 +1464,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { .module_definition_file = options.linker_module_definition_file, .sort_section = options.linker_sort_section, .import_memory = options.linker_import_memory orelse false, + .export_memory = options.linker_export_memory orelse !(options.linker_import_memory orelse false), .import_symbols = options.linker_import_symbols, .import_table = options.linker_import_table, .export_table = options.linker_export_table, @@ -2324,6 +2326,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes // WASM specific stuff man.hash.add(comp.bin_file.options.import_memory); + man.hash.add(comp.bin_file.options.export_memory); man.hash.addOptional(comp.bin_file.options.initial_memory); man.hash.addOptional(comp.bin_file.options.max_memory); man.hash.add(comp.bin_file.options.shared_memory); |
