aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-11-30 17:46:10 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-11-30 17:46:10 -0700
commit8c9919ec7b409d11ca73ca5764f44282dec0fe25 (patch)
tree159a7fb087adc240a9b72602d07e3a63f5b121b8 /src/link
parent205af5b14828d64c10f5c67e05cebf32b882c646 (diff)
downloadzig-8c9919ec7b409d11ca73ca5764f44282dec0fe25.tar.gz
zig-8c9919ec7b409d11ca73ca5764f44282dec0fe25.zip
fix regression on wasm targets
The previous commit broke wasm targets because the linking step would look for the compiler-rt lib in the wrong place. Fixed in this commit.
Diffstat (limited to 'src/link')
-rw-r--r--src/link/Wasm.zig20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig
index 580a5df576..51535d47ed 100644
--- a/src/link/Wasm.zig
+++ b/src/link/Wasm.zig
@@ -282,6 +282,11 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {
break :blk full_obj_path;
} else null;
+ const compiler_rt_path: ?[]const u8 = if (self.base.options.include_compiler_rt)
+ comp.compiler_rt_static_lib.?.full_object_path
+ else
+ null;
+
const target = self.base.options.target;
const id_symlink_basename = "lld.id";
@@ -302,6 +307,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {
_ = try man.addFile(entry.key.status.success.object_path, null);
}
try man.addOptionalFile(module_obj_path);
+ try man.addOptionalFile(compiler_rt_path);
man.hash.addOptional(self.base.options.stack_size_override);
man.hash.addListOfBytes(self.base.options.extra_lld_args);
@@ -381,11 +387,15 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {
try argv.append(p);
}
- 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);
- }
- try argv.append(comp.compiler_rt_static_lib.?.full_object_path);
+ if (self.base.options.output_mode != .Obj and
+ !self.base.options.is_compiler_rt_or_libc and
+ !self.base.options.link_libc)
+ {
+ try argv.append(comp.libc_static_lib.?.full_object_path);
+ }
+
+ if (compiler_rt_path) |p| {
+ try argv.append(p);
}
if (self.base.options.verbose_link) {