diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2024-11-13 06:04:04 +0100 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2024-12-11 00:10:15 +0100 |
| commit | 8af82621d75f9f0d96ebf734f5ea862d06a5f1fa (patch) | |
| tree | e004815ccdc1ae57557d69a2e42270edd81ca469 /lib/std/Build/Module.zig | |
| parent | 0b67463b9285158d818d6cd196c5f2ba9961a05e (diff) | |
| download | zig-8af82621d75f9f0d96ebf734f5ea862d06a5f1fa.tar.gz zig-8af82621d75f9f0d96ebf734f5ea862d06a5f1fa.zip | |
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.
Diffstat (limited to 'lib/std/Build/Module.zig')
| -rw-r--r-- | lib/std/Build/Module.zig | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/std/Build/Module.zig b/lib/std/Build/Module.zig index 347695a4c0..0e421280f0 100644 --- a/lib/std/Build/Module.zig +++ b/lib/std/Build/Module.zig @@ -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"), |
