aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2023-08-08 22:34:24 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2023-08-08 23:32:40 -0400
commit3e1dd93bb2ac7e9d99fb340f1f4ca6868a52cb6b (patch)
tree3a67b92da2378f614bc52bf23133bcf22b5a5c4b /src/codegen/llvm.zig
parent53bea0f7e44591e741c357297a1f25310d36ca78 (diff)
downloadzig-3e1dd93bb2ac7e9d99fb340f1f4ca6868a52cb6b.tar.gz
zig-3e1dd93bb2ac7e9d99fb340f1f4ca6868a52cb6b.zip
llvm: force strip without libllvm to avoid unimplemented behavior
Also fix deinit bugs.
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 3a2846ef8c..9f77f8e8a9 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -823,7 +823,7 @@ pub const Object = struct {
var builder = try Builder.init(.{
.allocator = gpa,
.use_lib_llvm = options.use_lib_llvm,
- .strip = options.strip,
+ .strip = options.strip or !options.use_lib_llvm, // TODO
.name = options.root_name,
.target = options.target,
.triple = llvm_target_triple,
@@ -961,14 +961,17 @@ pub const Object = struct {
}
pub fn deinit(self: *Object, gpa: Allocator) void {
- self.di_map.deinit(gpa);
- self.di_type_map.deinit(gpa);
- self.target_data.dispose();
- self.target_machine.dispose();
+ if (self.builder.useLibLlvm()) {
+ self.di_map.deinit(gpa);
+ self.di_type_map.deinit(gpa);
+ self.target_data.dispose();
+ self.target_machine.dispose();
+ }
self.decl_map.deinit(gpa);
self.named_enum_map.deinit(gpa);
self.type_map.deinit(gpa);
self.extern_collisions.deinit(gpa);
+ self.builder.deinit();
self.* = undefined;
}
@@ -1182,6 +1185,9 @@ pub const Object = struct {
emit_asm_msg, emit_bin_msg, emit_llvm_ir_msg, emit_llvm_bc_msg,
});
+ if (emit_asm_path == null and emit_bin_path == null and
+ emit_llvm_ir_path == null and emit_llvm_bc_path == null) return;
+
if (!self.builder.useLibLlvm()) {
log.err("emitting without libllvm not implemented", .{});
return error.FailedToEmit;