include compiler_rt and c for wasm static libraries

This commit is contained in:
Josh Wolfe 2020-10-08 21:40:56 -04:00 committed by Andrew Kelley
parent 1951ecb228
commit bc6904eccc
2 changed files with 5 additions and 2 deletions

View File

@ -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 = {} });

View File

@ -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);
}