Skip to content

Commit 3bf0d2e

Browse files
authored
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.
1 parent 2b99b04 commit 3bf0d2e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/std/Target.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
};

0 commit comments

Comments
 (0)