authorgravatar for yangxudong@ymatrix.cnYANG Xudong <yangxudong@ymatrix.cn> 2024-07-12 15:47:32+08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-07-12 00:47:32-07:00
log3bf0d2e5168c1722656a5eaa56e4bf16272df6d5
treea51cd3caceba38aea7cec4d5fd6c486871afab82
parent2b99b0428500ef880bc52e9f814f970e5fa29a7d
signaturebadge-check Signed by PGP key B5690EEEBB952194

std: Add loongarch support for coff. (#20583)

* std: Add loongarch support for coff. See: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types * Update toCoffMachine.

2 files changed, 10 insertions(+), 2 deletions(-)

lib/std/Target.zig+2-2
......@@ -1276,8 +1276,8 @@ pub const Cpu = struct {
12761276 .spirv => .Unknown,
12771277 .spirv32 => .Unknown,
12781278 .spirv64 => .Unknown,
1279 .loongarch32 => .Unknown,
1280 .loongarch64 => .Unknown,
1279 .loongarch32 => .LOONGARCH32,
1280 .loongarch64 => .LOONGARCH64,
12811281 };
12821282 }
12831283
lib/std/coff.zig+8
......@@ -1002,6 +1002,10 @@ pub const MachineType = enum(u16) {
10021002 I386 = 0x14c,
10031003 /// Intel Itanium processor family
10041004 IA64 = 0x200,
1005 /// LoongArch32
1006 LOONGARCH32 = 0x6232,
1007 /// LoongArch64
1008 LOONGARCH64 = 0x6264,
10051009 /// Mitsubishi M32R little endian
10061010 M32R = 0x9041,
10071011 /// MIPS16
......@@ -1047,6 +1051,8 @@ pub const MachineType = enum(u16) {
10471051 .aarch64 => .ARM64,
10481052 .riscv64 => .RISCV64,
10491053 .x86_64 => .X64,
1054 .loongarch32 => .LOONGARCH32,
1055 .loongarch64 => .LOONGARCH64,
10501056 // there's cases we don't (yet) handle
10511057 else => unreachable,
10521058 };
......@@ -1062,6 +1068,8 @@ pub const MachineType = enum(u16) {
10621068 .ARM64 => .aarch64,
10631069 .RISCV64 => .riscv64,
10641070 .X64 => .x86_64,
1071 .LOONGARCH32 => .loongarch32,
1072 .LOONGARCH64 => .loongarch64,
10651073 // there's cases we don't (yet) handle
10661074 else => null,
10671075 };