Commit d345068ec2

antlilja <liljaanton2001@gmail.com>
2024-03-02 15:45:58
LLVM: Fail to emit if LLVM encounters broken debug info
1 parent e2345f0
Changed files (1)
src
codegen
src/codegen/llvm.zig
@@ -1245,9 +1245,11 @@ pub const Object = struct {
             );
             defer bitcode_memory_buffer.dispose();
 
+            context.enableBrokenDebugInfoCheck();
+
             var module: *llvm.Module = undefined;
-            if (context.parseBitcodeInContext2(bitcode_memory_buffer, &module).toBool()) {
-                std.debug.print("Failed to parse bitcode\n", .{});
+            if (context.parseBitcodeInContext2(bitcode_memory_buffer, &module).toBool() or context.getBrokenDebugInfo()) {
+                log.err("Failed to parse bitcode", .{});
                 return error.FailedToEmit;
             }
             break :emit .{ context, module };