authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-01-18 19:32:07-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-01-20 20:59:52-08:00
log2391c460b1c137e44c8e0c092a2401b2676e2629
treef409585abb12765983a137ff5703cdf1c592cf82
parent77af309cb6e731a1f30967acc9e1204955c7d242

fix build failure when llvm not available


4 files changed, 15 insertions(+), 5 deletions(-)

src/glibc.zig+6-2
...@@ -178,7 +178,9 @@ pub const CrtFile = enum {...@@ -178,7 +178,9 @@ pub const CrtFile = enum {
178 libc_nonshared_a,178 libc_nonshared_a,
179};179};
180180
181pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) !void {181/// TODO replace anyerror with explicit error set, recording user-friendly errors with
182/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
183pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) anyerror!void {
182 if (!build_options.have_llvm) {184 if (!build_options.have_llvm) {
183 return error.ZigCompilerNotBuiltWithLLVMExtensions;185 return error.ZigCompilerNotBuiltWithLLVMExtensions;
184 }186 }
...@@ -735,7 +737,9 @@ fn wordDirective(target: std.Target) []const u8 {...@@ -735,7 +737,9 @@ fn wordDirective(target: std.Target) []const u8 {
735 return if (target.ptrBitWidth() == 64) ".quad" else ".long";737 return if (target.ptrBitWidth() == 64) ".quad" else ".long";
736}738}
737739
738pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !void {740/// TODO replace anyerror with explicit error set, recording user-friendly errors with
741/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
742pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anyerror!void {
739 const tracy = trace(@src());743 const tracy = trace(@src());
740 defer tracy.end();744 defer tracy.end();
741745
src/mingw.zig+3-1
...@@ -17,7 +17,9 @@ pub const CrtFile = enum {...@@ -17,7 +17,9 @@ pub const CrtFile = enum {
17 mingw32_lib,17 mingw32_lib,
18};18};
1919
20pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) !void {20/// TODO replace anyerror with explicit error set, recording user-friendly errors with
21/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
22pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) anyerror!void {
21 if (!build_options.have_llvm) {23 if (!build_options.have_llvm) {
22 return error.ZigCompilerNotBuiltWithLLVMExtensions;24 return error.ZigCompilerNotBuiltWithLLVMExtensions;
23 }25 }
src/musl.zig+3-1
...@@ -18,7 +18,9 @@ pub const CrtFile = enum {...@@ -18,7 +18,9 @@ pub const CrtFile = enum {
18 libc_so,18 libc_so,
19};19};
2020
21pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Progress.Node) !void {21/// TODO replace anyerror with explicit error set, recording user-friendly errors with
22/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
23pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Progress.Node) anyerror!void {
22 if (!build_options.have_llvm) {24 if (!build_options.have_llvm) {
23 return error.ZigCompilerNotBuiltWithLLVMExtensions;25 return error.ZigCompilerNotBuiltWithLLVMExtensions;
24 }26 }
src/wasi_libc.zig+3-1
...@@ -57,7 +57,9 @@ pub fn execModelCrtFileFullName(wasi_exec_model: std.builtin.WasiExecModel) []co...@@ -57,7 +57,9 @@ pub fn execModelCrtFileFullName(wasi_exec_model: std.builtin.WasiExecModel) []co
57 };57 };
58}58}
5959
60pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) !void {60/// TODO replace anyerror with explicit error set, recording user-friendly errors with
61/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
62pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) anyerror!void {
61 if (!build_options.have_llvm) {63 if (!build_options.have_llvm) {
62 return error.ZigCompilerNotBuiltWithLLVMExtensions;64 return error.ZigCompilerNotBuiltWithLLVMExtensions;
63 }65 }