diff options
| author | xReveres <pawel.ko@interia.pl> | 2022-02-22 15:31:12 +0100 |
|---|---|---|
| committer | Luuk de Gram <luuk@degram.dev> | 2022-02-23 08:57:20 +0100 |
| commit | fb7cde30711705c8b73d1518830489eeda436048 (patch) | |
| tree | 60f0ab921ccd2ff9bd7afd37b9f35f5ecec31812 /src/main.zig | |
| parent | b2805666a7ced0fd11ab7f25f7599d372e766c42 (diff) | |
| download | zig-fb7cde30711705c8b73d1518830489eeda436048.tar.gz zig-fb7cde30711705c8b73d1518830489eeda436048.zip | |
wasm: shared memory checks
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig index aafd0ecaae..afca7a26e3 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2012,6 +2012,18 @@ fn buildOutputType( link_libcpp = true; } + if (target_info.target.cpu.arch.isWasm() and linker_shared_memory) { + if (output_mode == .Obj) { + fatal("shared memory is not allowed in object files", .{}); + } + + if (!target_info.target.cpu.features.isEnabled(@enumToInt(std.Target.wasm.Feature.atomics)) or + !target_info.target.cpu.features.isEnabled(@enumToInt(std.Target.wasm.Feature.bulk_memory))) + { + fatal("'atomics' and 'bulk-memory' features must be used in order to use shared memory", .{}); + } + } + // Now that we have target info, we can find out if any of the system libraries // are part of libc or libc++. We remove them from the list and communicate their // existence via flags instead. |
