Compilation: allow threads for Wasm when shared-memory is enabled

When the user enabled the linker-feature 'shared-memory' we do not force
a singlethreaded build. The linker already verifies all other CPU features
required for threads are enabled. This is true for both WASI and
freestanding.
This commit is contained in:
Luuk de Gram 2023-06-18 18:22:04 +02:00
parent 3819371163
commit 062eb6f3c0
No known key found for this signature in database
GPG Key ID: A8CFE58E4DC7D664
2 changed files with 1 additions and 5 deletions

View File

@ -1029,7 +1029,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
const include_compiler_rt = options.want_compiler_rt orelse needs_c_symbols;
const must_single_thread = target_util.isSingleThreaded(options.target);
const must_single_thread = options.target.isWasm() and !options.linker_shared_memory;
const single_threaded = options.single_threaded orelse must_single_thread;
if (must_single_thread and !single_threaded) {
return error.TargetRequiresSingleThreaded;

View File

@ -207,10 +207,6 @@ pub fn supports_fpic(target: std.Target) bool {
return target.os.tag != .windows and target.os.tag != .uefi;
}
pub fn isSingleThreaded(target: std.Target) bool {
return target.isWasm();
}
/// Valgrind supports more, but Zig does not support them yet.
pub fn hasValgrindSupport(target: std.Target) bool {
switch (target.cpu.arch) {