aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-03-02 21:43:39 -0800
committerGitHub <noreply@github.com>2024-03-02 21:43:39 -0800
commit90c1a2c41aafb1e35e075fb7d0bdcf04c00db913 (patch)
tree1037ffb947dc331e68a1dba73e590771113dcec3 /src/codegen
parent33de937fd91c64cd65894369cf7d92665a8e582e (diff)
parent282b398f6da967f413e223b452457d37e93a70b3 (diff)
downloadzig-90c1a2c41aafb1e35e075fb7d0bdcf04c00db913.tar.gz
zig-90c1a2c41aafb1e35e075fb7d0bdcf04c00db913.zip
Merge pull request #19152 from antlilja/llvm-broken-debug
LLVM: Fail to emit if LLVM encounters broken debug info
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/llvm.zig6
-rw-r--r--src/codegen/llvm/bindings.zig6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 3e55fe5e9d..a7e2815e73 100644
--- a/src/codegen/llvm.zig
+++ b/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 };
diff --git a/src/codegen/llvm/bindings.zig b/src/codegen/llvm/bindings.zig
index affadef882..ee87aef6ac 100644
--- a/src/codegen/llvm/bindings.zig
+++ b/src/codegen/llvm/bindings.zig
@@ -37,6 +37,12 @@ pub const Context = opaque {
pub const setOptBisectLimit = ZigLLVMSetOptBisectLimit;
extern fn ZigLLVMSetOptBisectLimit(C: *Context, limit: c_int) void;
+
+ pub const enableBrokenDebugInfoCheck = ZigLLVMEnableBrokenDebugInfoCheck;
+ extern fn ZigLLVMEnableBrokenDebugInfoCheck(C: *Context) void;
+
+ pub const getBrokenDebugInfo = ZigLLVMGetBrokenDebugInfo;
+ extern fn ZigLLVMGetBrokenDebugInfo(C: *Context) bool;
};
pub const Module = opaque {