Replace unreachable with error return for non-standard Windows targets

This new error mirrors the error returned from the Elf struct (error.UnsupportedElfArchitecture):

0adcfd60f4/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 #24287
This commit is contained in:
Ryan Liptak 2025-06-28 18:30:39 -07:00 committed by Alex Rønne Petersen
parent 6322dbd5bf
commit d3363b7a61

View File

@ -37,12 +37,12 @@ const Coff = struct {
.Exe => switch (target.cpu.arch) {
.aarch64, .x86_64 => 0x140000000,
.thumb, .x86 => 0x400000,
else => unreachable,
else => return error.UnsupportedCoffArchitecture,
},
.Lib => switch (target.cpu.arch) {
.aarch64, .x86_64 => 0x180000000,
.thumb, .x86 => 0x10000000,
else => unreachable,
else => return error.UnsupportedCoffArchitecture,
},
.Obj => 0,
},