aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-10-10 11:23:39 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-10-10 11:23:39 -0700
commitda7e4fb31a05f2063eb829c4c383a44b38ed21e1 (patch)
treea038ac670ba752adea3293c65bd0a06d864cb9d0 /src/Compilation.zig
parent33ef01d16b91a537696272ca286d6423abbdd632 (diff)
downloadzig-da7e4fb31a05f2063eb829c4c383a44b38ed21e1.tar.gz
zig-da7e4fb31a05f2063eb829c4c383a44b38ed21e1.zip
revert compiler_rt: no need to put it in a static library
This mostly reverts 6e0904504155d3cba80955c108116170fd739aec however it leaves intact the linker supporting both obj and lib files, and the frontend choosing which one to create.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index b10adad01b..25d0d63b1e 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -112,6 +112,7 @@ unwind_tables: bool,
test_evented_io: bool,
debug_compiler_runtime_libs: bool,
debug_compile_errors: bool,
+job_queued_compiler_rt_lib: bool = false,
job_queued_compiler_rt_obj: bool = false,
alloc_failure_occurred: bool = false,
formatted_panics: bool = false,
@@ -157,6 +158,9 @@ libssp_static_lib: ?CRTFile = null,
/// Populated when we build the libc static library. A Job to build this is placed in the queue
/// and resolved before calling linker.flush().
libc_static_lib: ?CRTFile = null,
+/// Populated when we build the libcompiler_rt static library. A Job to build this is indicated
+/// by setting `job_queued_compiler_rt_lib` and resolved before calling linker.flush().
+compiler_rt_lib: ?CRTFile = null,
/// Populated when we build the compiler_rt_obj object. A Job to build this is indicated
/// by setting `job_queued_compiler_rt_obj` and resolved before calling linker.flush().
compiler_rt_obj: ?CRTFile = null,
@@ -1879,8 +1883,13 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
}
if (comp.bin_file.options.include_compiler_rt and capable_of_building_compiler_rt) {
- if (is_exe_or_dyn_lib or options.output_mode != .Obj) {
+ if (is_exe_or_dyn_lib) {
+ log.debug("queuing a job to build compiler_rt_lib", .{});
+ comp.job_queued_compiler_rt_lib = true;
+ } else if (options.output_mode != .Obj) {
log.debug("queuing a job to build compiler_rt_obj", .{});
+ // In this case we are making a static library, so we ask
+ // for a compiler-rt object to put in it.
comp.job_queued_compiler_rt_obj = true;
}
}
@@ -1935,6 +1944,9 @@ pub fn destroy(self: *Compilation) void {
if (self.libcxxabi_static_lib) |*crt_file| {
crt_file.deinit(gpa);
}
+ if (self.compiler_rt_lib) |*crt_file| {
+ crt_file.deinit(gpa);
+ }
if (self.compiler_rt_obj) |*crt_file| {
crt_file.deinit(gpa);
}
@@ -3401,6 +3413,11 @@ pub fn performAllTheWork(
break;
}
+ if (comp.job_queued_compiler_rt_lib) {
+ comp.job_queued_compiler_rt_lib = false;
+ buildCompilerRtOneShot(comp, .Lib, &comp.compiler_rt_lib, main_progress_node);
+ }
+
if (comp.job_queued_compiler_rt_obj) {
comp.job_queued_compiler_rt_obj = false;
buildCompilerRtOneShot(comp, .Obj, &comp.compiler_rt_obj, main_progress_node);