diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2024-08-19 13:25:08 +0200 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2024-08-23 19:56:24 +0200 |
| commit | a69f55a7cc3980f4d4dfcce6cb9d21a597975c7f (patch) | |
| tree | a3ec23392b88a7d9e9a2fa9cb99f21d5c2cc6b9f /lib/std/elf.zig | |
| parent | 3fb6e46f6e4231b9569193a15a4357a2ae11fb0f (diff) | |
| download | zig-a69f55a7cc3980f4d4dfcce6cb9d21a597975c7f.tar.gz zig-a69f55a7cc3980f4d4dfcce6cb9d21a597975c7f.zip | |
std.{coff,elf}: Remove the {MachineType,EM}.toTargetCpuArch() functions.
These are fundamentally incapable of producing accurate information for reasons
I've laid out in #20771. Since our only use of these functions is to check that
object files have the correct machine type, and since #21020 made
`std.Target.to{Coff,Elf}Machine()` more accurate, just switch these checks over
to that and compare the machine type tags instead.
Closes #20771.
Diffstat (limited to 'lib/std/elf.zig')
| -rw-r--r-- | lib/std/elf.zig | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/lib/std/elf.zig b/lib/std/elf.zig index af3f1813e2..aefaca4bef 100644 --- a/lib/std/elf.zig +++ b/lib/std/elf.zig @@ -1646,44 +1646,6 @@ pub const EM = enum(u16) { FRV = 0x5441, _, - - pub fn toTargetCpuArch(em: EM) ?std.Target.Cpu.Arch { - return switch (em) { - .AVR => .avr, - .MSP430 => .msp430, - .ARC => .arc, - .ARM => .arm, - .HEXAGON => .hexagon, - .@"68K" => .m68k, - .MIPS => .mips, - .MIPS_RS3_LE => .mipsel, - .PPC => .powerpc, - .SPARC => .sparc, - .@"386" => .x86, - .XCORE => .xcore, - .CSR_KALIMBA => .kalimba, - .LANAI => .lanai, - .AARCH64 => .aarch64, - .PPC64 => .powerpc64, - .RISCV => .riscv64, - .X86_64 => .x86_64, - .BPF => .bpfel, - .SPARCV9 => .sparc64, - .S390 => .s390x, - .SPU_2 => .spu_2, - // FIXME: - // No support for .loongarch32 yet so it is safe to assume we are on .loongarch64. - // - // However, when e_machine is .LOONGARCH, we should check - // ei_class's value to decide the CPU architecture. - // - ELFCLASS32 => .loongarch32 - // - ELFCLASS64 => .loongarch64 - .LOONGARCH => .loongarch64, - // there's many cases we don't (yet) handle, or will never have a - // zig target cpu arch equivalent (such as null). - else => null, - }; - } }; pub const GRP_COMDAT = 1; |
