Skip to content

Commit d3363b7

Browse files
squeek502alexrp
authored andcommitted
Replace unreachable with error return for non-standard Windows targets
This new error mirrors the error returned from the Elf struct (error.UnsupportedElfArchitecture): https://github.com/ziglang/zig/blob/0adcfd60f4fcfd01c74a6477cbcef187ce06f533/src/link/Lld.zig#L112 Before: ``` $ zig build-exe -target riscv64-windows-gnu main.zig thread 543087 panic: reached unreachable code ``` After: ``` $ zig build-exe -target riscv64-windows-gnu main.zig error: unable to create compilation: UnsupportedCoffArchitecture ``` Closes ziglang#24287
1 parent 6322dbd commit d3363b7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/link/Lld.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ const Coff = struct {
3737
.Exe => switch (target.cpu.arch) {
3838
.aarch64, .x86_64 => 0x140000000,
3939
.thumb, .x86 => 0x400000,
40-
else => unreachable,
40+
else => return error.UnsupportedCoffArchitecture,
4141
},
4242
.Lib => switch (target.cpu.arch) {
4343
.aarch64, .x86_64 => 0x180000000,
4444
.thumb, .x86 => 0x10000000,
45-
else => unreachable,
45+
else => return error.UnsupportedCoffArchitecture,
4646
},
4747
.Obj => 0,
4848
},

0 commit comments

Comments
 (0)