stage2: don't build libunwind on OS's that don't need it

master
Andrew Kelley 2020-09-23 11:15:27 -07:00
parent f4dde4d109
commit b183b612c9
2 changed files with 16 additions and 1 deletions

View File

@ -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 {

View File

@ -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();
}