aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorLuuk de Gram <luuk@degram.dev>2022-05-31 19:13:08 +0200
committerLuuk de Gram <luuk@degram.dev>2022-06-24 08:12:17 +0200
commita6747d328cad831ceb07fb47cd0fa3647da21afb (patch)
tree1d91b7a8b7df925681d798177c5c0c5f86799aa2 /src/Compilation.zig
parent9015efe4059b7e8448a9c09c3a116cb6b2550957 (diff)
downloadzig-a6747d328cad831ceb07fb47cd0fa3647da21afb.tar.gz
zig-a6747d328cad831ceb07fb47cd0fa3647da21afb.zip
stage2: Enable compiler-rt when LLVM is existant
Rather than checking if the user wants to use LLVM for the current compilation, check for the existance of LLVM as part of the compiler. This is temporarily, until other backends gain the ability to compiler LLVM themselves. This means that when a user passed `-fno-LLVM` we will use the native backend for the user's code, but use LLVM for compiler-rt. This also fixes emitting names for symbols in the Wasm linker, by deduplicating symbol names when multiple symbols point the same object.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 525835ce61..0a97ee9f7e 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -1914,13 +1914,12 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
try comp.work_queue.writeItem(.libtsan);
}
- // The `use_stage1` condition is here only because stage2 cannot yet build compiler-rt.
- // Once it is capable this condition should be removed. When removing this condition,
- // also test the use case of `build-obj -fcompiler-rt` with the self-hosted compiler
- // and make sure the compiler-rt symbols are emitted. Currently this is hooked up for
- // stage1 but not stage2.
- const capable_of_building_compiler_rt = comp.bin_file.options.use_stage1 or
- comp.bin_file.options.use_llvm;
+ // The `have_llvm` condition is here only because native backends cannot yet build compiler-rt.
+ // Once they are capable this condition could be removed. When removing this condition,
+ // also test the use case of `build-obj -fcompiler-rt` with the native backends
+ // and make sure the compiler-rt symbols are emitted.
+ const capable_of_building_compiler_rt = build_options.have_llvm;
+
const capable_of_building_zig_libc = comp.bin_file.options.use_stage1 or
comp.bin_file.options.use_llvm;
const capable_of_building_ssp = comp.bin_file.options.use_stage1;