zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 1691074b4b1f080b3a1f7ca7dc7426c6ef4c242a (tree)
parent 7e11ef79d67d000675e90ddf93fdb78d71cc695d
Author: Andrew Kelley <superjoe30@gmail.com>
Date:   Thu, 27 Apr 2017 18:40:17 -0400

add no-elim-base-pointer to __zig_fail function

fixes missing frame for unwrapping an error

closes #345

Diffstat:
MREADME.md | 2+-
Msrc/codegen.cpp | 5+++++
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md @@ -75,7 +75,7 @@ the Zig compiler itself: #### Library Dependencies These libraries must be installed on your system, with the development files -available. The Zig compiler dynamically links against them. +available. The Zig compiler links against them. * LLVM, Clang, and LLD libraries == 4.x diff --git a/src/codegen.cpp b/src/codegen.cpp @@ -720,6 +720,11 @@ static LLVMValueRef get_safety_crash_err_fn(CodeGen *g) { addLLVMFnAttr(fn_val, "cold"); LLVMSetLinkage(fn_val, LLVMInternalLinkage); LLVMSetFunctionCallConv(fn_val, LLVMFastCallConv); + addLLVMFnAttr(fn_val, "nounwind"); + if (!g->is_release_build) { + ZigLLVMAddFunctionAttr(fn_val, "no-frame-pointer-elim", "true"); + ZigLLVMAddFunctionAttr(fn_val, "no-frame-pointer-elim-non-leaf", nullptr); + } LLVMBasicBlockRef entry_block = LLVMAppendBasicBlock(fn_val, "Entry"); LLVMBasicBlockRef prev_block = LLVMGetInsertBlock(g->builder);