-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Line 1149 in fa95c89
| pub fn toElfMachine(arch: Arch) std.elf.EM { |
Line 1203 in fa95c89
| pub fn toCoffMachine(arch: Arch) std.coff.MachineType { |
Line 1044 in fa95c89
| pub fn fromTargetCpuArch(arch: std.Target.Cpu.Arch) MachineType { |
These 3 functions are all problematic for the simple reason that an std.Target.Cpu.Arch value is not enough information to do the correct mapping. At the very least, an std.Target.Abi value is also needed. All current call sites in the repo have a full std.Target available, so this should be relatively easy to fix.
Line 1061 in fa95c89
| pub fn toTargetCpuArch(machine_type: MachineType) ?std.Target.Cpu.Arch { |
Line 1637 in fa95c89
| pub fn toTargetCpuArch(em: EM) ?std.Target.Cpu.Arch { |
These suffer from a similar problem: To do a sensible mapping, they also need to return an ABI value. However, while it's possible to go from an Arch + Abi to an ELF or COFF machine type, the reverse is not true; these functions can't possibly decide between glibc and musl Abi values, for example. This is another good argument in favor of #20690 (splitting libc and ABI), but we should probably come up with some sort of interim solution - perhaps an ArchAbi enum that identifies the ABI divorced from libc.