From a6747d328cad831ceb07fb47cd0fa3647da21afb Mon Sep 17 00:00:00 2001 From: Luuk de Gram Date: Tue, 31 May 2022 19:13:08 +0200 Subject: 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. --- src/Compilation.zig | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/Compilation.zig') 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; -- cgit v1.2.3