diff options
| author | Jonathan Marler <johnnymarler@gmail.com> | 2021-08-13 12:52:36 -0600 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2021-08-21 20:40:07 +0300 |
| commit | f28868e8fd4028cad29bd2de8c0aa1c1713c69dd (patch) | |
| tree | 75a4e5013fa1e43749dc3b81ab1abbc743f68528 /src/mingw.zig | |
| parent | 27e321628587fd82b431dbbed1e6ba99e6df24a6 (diff) | |
| download | zig-f28868e8fd4028cad29bd2de8c0aa1c1713c69dd.tar.gz zig-f28868e8fd4028cad29bd2de8c0aa1c1713c69dd.zip | |
mingw.zig: fix logic to add crt sources
The current version of code uses isARM to check if we are compiling to any arm target then checks the target bit width to either add the 32-bit sources or 64-bit source. However, isARM only returns true for 32-bit targets, and isAARCH64 is for the 64-bit targets.
I also replaced the unreachable with a @panic when we receive an unsupported arch because this code is reachable and should turn into an error.
Diffstat (limited to 'src/mingw.zig')
| -rw-r--r-- | src/mingw.zig | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/mingw.zig b/src/mingw.zig index 42d1ac47db..529025c517 100644 --- a/src/mingw.zig +++ b/src/mingw.zig @@ -187,27 +187,25 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void { }; } } else if (target.cpu.arch.isARM()) { - if (target.cpu.arch.ptrBitWidth() == 32) { - for (mingwex_arm32_src) |dep| { - (try c_source_files.addOne()).* = .{ - .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ - "libc", "mingw", dep, - }), - .extra_flags = extra_flags, - }; - } - } else { - for (mingwex_arm64_src) |dep| { - (try c_source_files.addOne()).* = .{ - .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ - "libc", "mingw", dep, - }), - .extra_flags = extra_flags, - }; - } + for (mingwex_arm32_src) |dep| { + (try c_source_files.addOne()).* = .{ + .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ + "libc", "mingw", dep, + }), + .extra_flags = extra_flags, + }; + } + } else if (target.cpu.arch.isAARCH64()) { + for (mingwex_arm64_src) |dep| { + (try c_source_files.addOne()).* = .{ + .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ + "libc", "mingw", dep, + }), + .extra_flags = extra_flags, + }; } } else { - unreachable; + @panic("unsupported arch"); } return comp.build_crt_file("mingwex", .Lib, c_source_files.items); }, |
