commit bc6904eccc53da5b4de0728c8b52e6d0e9ed522e (tree) parent 1951ecb228d5eb9956ef4487e20be03d87a2153d Author: Josh Wolfe <thejoshwolfe@gmail.com> Date: Thu, 8 Oct 2020 21:40:56 -0400 include compiler_rt and c for wasm static libraries Diffstat:
| M | src/Compilation.zig | | | 5 | ++++- |
| M | src/link/Wasm.zig | | | 2 | +- |
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/Compilation.zig b/src/Compilation.zig @@ -922,7 +922,10 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { try comp.work_queue.writeItem(.libcxx); try comp.work_queue.writeItem(.libcxxabi); } - if (is_exe_or_dyn_lib and build_options.is_stage1) { + + const needs_compiler_rt_and_c = is_exe_or_dyn_lib or + (comp.getTarget().isWasm() and comp.bin_file.options.output_mode != .Obj); + if (needs_compiler_rt_and_c and build_options.is_stage1) { try comp.work_queue.writeItem(.{ .libcompiler_rt = {} }); if (!comp.bin_file.options.link_libc) { try comp.work_queue.writeItem(.{ .zig_libc = {} }); diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig @@ -374,7 +374,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { try argv.append(p); } - if (self.base.options.output_mode == .Exe and !self.base.options.is_compiler_rt_or_libc) { + if (self.base.options.output_mode != .Obj and !self.base.options.is_compiler_rt_or_libc) { if (!self.base.options.link_libc) { try argv.append(comp.libc_static_lib.?.full_object_path); }