aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-09-29 00:13:21 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-09-29 00:13:21 -0700
commit99961f22dca7e01b85b7819dcea814ad01b65af5 (patch)
tree9c788bb803cf52cbb9928137b811b915097b46a7 /src/Compilation.zig
parent33e77f127d8237088b561fae2ca0f4412bc1d6c9 (diff)
downloadzig-99961f22dca7e01b85b7819dcea814ad01b65af5.tar.gz
zig-99961f22dca7e01b85b7819dcea814ad01b65af5.zip
stage2: enable building compiler_rt when using LLVM backend
* AstGen: fix emitting `store_to_inferred_ptr` when it should be emitting `store` for a variable that has an explicit alignment. * Compilation: fix a couple memory leaks * Sema: implement support for locals that have specified alignment. * Sema: implement `@intCast` when it needs to emit an AIR instruction. * Sema: implement `@alignOf` * Implement debug printing for extended alloc ZIR instructions.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index ef762dae1e..cb19a21c15 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -1574,10 +1574,11 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
// 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;
- const capable_of_building_ssp = comp.bin_file.options.use_stage1;
+ const capable_of_building_compiler_rt = comp.bin_file.options.use_stage1 or
+ comp.bin_file.options.use_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;
if (comp.bin_file.options.include_compiler_rt and capable_of_building_compiler_rt) {
if (is_exe_or_dyn_lib) {
@@ -1648,6 +1649,9 @@ pub fn destroy(self: *Compilation) void {
if (self.compiler_rt_static_lib) |*crt_file| {
crt_file.deinit(gpa);
}
+ if (self.compiler_rt_obj) |*crt_file| {
+ crt_file.deinit(gpa);
+ }
if (self.libssp_static_lib) |*crt_file| {
crt_file.deinit(gpa);
}
@@ -3977,6 +3981,7 @@ fn buildOutputFromZig(
},
.root_src_path = src_basename,
};
+ defer main_pkg.deinitTable(comp.gpa);
const root_name = src_basename[0 .. src_basename.len - std.fs.path.extension(src_basename).len];
const target = comp.getTarget();
const bin_basename = try std.zig.binNameAlloc(comp.gpa, .{