compiler: Improve the handling of unwind table levels.
The goal here is to support both levels of unwind tables (sync and async) in zig cc and zig build. Previously, the LLVM backend always used async tables while zig cc was partially influenced by whatever was Clang's default.
This commit is contained in:
@@ -22,7 +22,7 @@ frameworks: std.StringArrayHashMapUnmanaged(LinkFrameworkOptions),
|
||||
link_objects: std.ArrayListUnmanaged(LinkObject),
|
||||
|
||||
strip: ?bool,
|
||||
unwind_tables: ?bool,
|
||||
unwind_tables: ?std.builtin.UnwindTables,
|
||||
single_threaded: ?bool,
|
||||
stack_protector: ?bool,
|
||||
stack_check: ?bool,
|
||||
@@ -218,7 +218,7 @@ pub const CreateOptions = struct {
|
||||
link_libcpp: ?bool = null,
|
||||
single_threaded: ?bool = null,
|
||||
strip: ?bool = null,
|
||||
unwind_tables: ?bool = null,
|
||||
unwind_tables: ?std.builtin.UnwindTables = null,
|
||||
dwarf_format: ?std.dwarf.Format = null,
|
||||
code_model: std.builtin.CodeModel = .default,
|
||||
stack_protector: ?bool = null,
|
||||
@@ -675,7 +675,6 @@ pub fn appendZigProcessFlags(
|
||||
const b = m.owner;
|
||||
|
||||
try addFlag(zig_args, m.strip, "-fstrip", "-fno-strip");
|
||||
try addFlag(zig_args, m.unwind_tables, "-funwind-tables", "-fno-unwind-tables");
|
||||
try addFlag(zig_args, m.single_threaded, "-fsingle-threaded", "-fno-single-threaded");
|
||||
try addFlag(zig_args, m.stack_check, "-fstack-check", "-fno-stack-check");
|
||||
try addFlag(zig_args, m.stack_protector, "-fstack-protector", "-fno-stack-protector");
|
||||
@@ -695,6 +694,14 @@ pub fn appendZigProcessFlags(
|
||||
});
|
||||
}
|
||||
|
||||
if (m.unwind_tables) |unwind_tables| {
|
||||
try zig_args.append(switch (unwind_tables) {
|
||||
.none => "-fno-unwind-tables",
|
||||
.sync => "-funwind-tables",
|
||||
.@"async" => "-fasync-unwind-tables",
|
||||
});
|
||||
}
|
||||
|
||||
try zig_args.ensureUnusedCapacity(1);
|
||||
if (m.optimize) |optimize| switch (optimize) {
|
||||
.Debug => zig_args.appendAssumeCapacity("-ODebug"),
|
||||
|
||||
Reference in New Issue
Block a user