aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
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/Compilation.zig
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/Compilation.zig')
-rw-r--r--src/Compilation.zig10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index b7660718de..df48e5a391 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -981,16 +981,20 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
// Once it is capable this condition should be removed.
if (build_options.is_stage1) {
if (comp.bin_file.options.include_compiler_rt) {
- if (is_exe_or_dyn_lib) {
+ if (is_exe_or_dyn_lib or comp.getTarget().isWasm()) {
try comp.work_queue.writeItem(.{ .compiler_rt_lib = {} });
} else {
try comp.work_queue.writeItem(.{ .compiler_rt_obj = {} });
- if (comp.bin_file.options.object_format != .elf) {
+ if (comp.bin_file.options.object_format != .elf and
+ comp.bin_file.options.output_mode == .Obj)
+ {
// For ELF we can rely on using -r to link multiple objects together into one,
// but to truly support `build-obj -fcompiler-rt` will require virtually
// injecting `_ = @import("compiler_rt.zig")` into the root source file of
// the compilation.
- fatal("Embedding compiler-rt into non-ELF objects is not yet implemented.", .{});
+ fatal("Embedding compiler-rt into {s} objects is not yet implemented.", .{
+ @tagName(comp.bin_file.options.object_format),
+ });
}
}
}