authorgravatar for pawel.ko@interia.plxReveres <pawel.ko@interia.pl> 2022-02-22 15:31:12+01:00
committergravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2022-02-23 08:57:20+01:00
logfb7cde30711705c8b73d1518830489eeda436048
tree60f0ab921ccd2ff9bd7afd37b9f35f5ecec31812
parentb2805666a7ced0fd11ab7f25f7599d372e766c42

wasm: shared memory checks


1 files changed, 12 insertions(+), 0 deletions(-)

src/main.zig+12
...@@ -2012,6 +2012,18 @@ fn buildOutputType(...@@ -2012,6 +2012,18 @@ fn buildOutputType(
2012 link_libcpp = true;2012 link_libcpp = true;
2013 }2013 }
20142014
2015 if (target_info.target.cpu.arch.isWasm() and linker_shared_memory) {
2016 if (output_mode == .Obj) {
2017 fatal("shared memory is not allowed in object files", .{});
2018 }
2019
2020 if (!target_info.target.cpu.features.isEnabled(@enumToInt(std.Target.wasm.Feature.atomics)) or
2021 !target_info.target.cpu.features.isEnabled(@enumToInt(std.Target.wasm.Feature.bulk_memory)))
2022 {
2023 fatal("'atomics' and 'bulk-memory' features must be used in order to use shared memory", .{});
2024 }
2025 }
2026
2015 // Now that we have target info, we can find out if any of the system libraries2027 // Now that we have target info, we can find out if any of the system libraries
2016 // are part of libc or libc++. We remove them from the list and communicate their2028 // are part of libc or libc++. We remove them from the list and communicate their
2017 // existence via flags instead.2029 // existence via flags instead.