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 {...@@ -1883,7 +1883,8 @@ fn wantBuildLibUnwindFromSource(comp: *Compilation) bool {
1883 .Exe => true,1883 .Exe => true,
1884 };1884 };
1885 return comp.bin_file.options.link_libc and is_exe_or_dyn_lib and1885 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());
1887}1888}
18881889
1889fn updateBuiltinZigFile(comp: *Compilation, mod: *Module) !void {1890fn updateBuiltinZigFile(comp: *Compilation, mod: *Module) !void {
src/target.zig+14
...@@ -128,6 +128,20 @@ pub fn osRequiresLibC(target: std.Target) bool {...@@ -128,6 +128,20 @@ pub fn osRequiresLibC(target: std.Target) bool {
128 };128 };
129}129}
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
131pub fn requiresPIE(target: std.Target) bool {145pub fn requiresPIE(target: std.Target) bool {
132 return target.isAndroid();146 return target.isAndroid();
133}147}