better awareness of unwind tables

* stage1 backend allows configuring the uwtables function attr
   via a flag rather than its own logic.
 * stage2 defaults to enabling uwtable attr when
   linking libunwind, or always on windows
 * stage2 makes link_eh_frame_hdr true automatically if uwtable
   attr is set to be on for zig functions
 * CLI: add -funwind-tables and -fno-unwind-tables to allow the user to
   override the defaults.
 * hook it up to `zig cc`

closes #9046
This commit is contained in:
Andrew Kelley
2021-06-10 11:25:33 -07:00
parent 6cc8845802
commit b6277a4b1c
10 changed files with 82 additions and 22 deletions

View File

@@ -211,7 +211,7 @@ static ZigLLVM_CallingConv get_llvm_cc(CodeGen *g, CallingConvention cc) {
}
static void add_uwtable_attr(CodeGen *g, LLVMValueRef fn_val) {
if (g->zig_target->os == OsWindows) {
if (g->unwind_tables) {
addLLVMFnAttr(fn_val, "uwtable");
}
}