authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-09-23 11:15:27-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-09-23 11:15:27-07:00
logb183b612c938a8c9949fee02fa55038273595496
tree42572a7f3df5f0c2aec19f888fa8bd10f6fe439b
parentf4dde4d109ecd722ac82243417cac9f0e736de94

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


2 files changed, 16 insertions(+), 1 deletions(-)

src/Compilation.zig+2-1
......@@ -1883,7 +1883,8 @@ fn wantBuildLibUnwindFromSource(comp: *Compilation) bool {
18831883 .Exe => true,
18841884 };
18851885 return comp.bin_file.options.link_libc and is_exe_or_dyn_lib and
1886 comp.bin_file.options.libc_installation == null;
1886 comp.bin_file.options.libc_installation == null and
1887 target_util.libcNeedsLibUnwind(comp.getTarget());
18871888}
18881889
18891890fn updateBuiltinZigFile(comp: *Compilation, mod: *Module) !void {
src/target.zig+14
......@@ -128,6 +128,20 @@ pub fn osRequiresLibC(target: std.Target) bool {
128128 };
129129}
130130
131pub fn libcNeedsLibUnwind(target: std.Target) bool {
132 return switch (target.os.tag) {
133 .windows,
134 .macosx,
135 .ios,
136 .watchos,
137 .tvos,
138 .freestanding,
139 => false,
140
141 else => true,
142 };
143}
144
131145pub fn requiresPIE(target: std.Target) bool {
132146 return target.isAndroid();
133147}