diff --git a/src/Compilation.zig b/src/Compilation.zig index 1297341926101f424249ffbb6a747ab29a4d3324..9ff2f3513446674fc20e2ee146de93b26a2b664a 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1883,7 +1883,8 @@ fn wantBuildLibUnwindFromSource(comp: *Compilation) bool { .Exe => true, }; return comp.bin_file.options.link_libc and is_exe_or_dyn_lib and - comp.bin_file.options.libc_installation == null; + comp.bin_file.options.libc_installation == null and + target_util.libcNeedsLibUnwind(comp.getTarget()); } fn updateBuiltinZigFile(comp: *Compilation, mod: *Module) !void { diff --git a/src/target.zig b/src/target.zig index 8ea880e8981f2e134c785822afe1db11c82a024b..0402ccbd513a469082a718f0ec9d10639e0abb3c 100644 --- a/src/target.zig +++ b/src/target.zig @@ -128,6 +128,20 @@ pub fn osRequiresLibC(target: std.Target) bool { }; } +pub fn libcNeedsLibUnwind(target: std.Target) bool { + return switch (target.os.tag) { + .windows, + .macosx, + .ios, + .watchos, + .tvos, + .freestanding, + => false, + + else => true, + }; +} + pub fn requiresPIE(target: std.Target) bool { return target.isAndroid(); }