Played like 12 hours of Helldivers this week, game freaking rules
But tonight it is ELF time
Man there's like 12 of these for every field ;_;

Since ELF files entire structure is platform independent* and has to be read in the bitness and endianness defined by the file contents (in the 16-byte identifier at the beginning, which is just a flat array of u8 and not endianed or bit-ed), I decided to define the structs in kind of a weird way that has ended up being pretty nice:

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
/// An offset in an ELF file. Represented as 32 bits for class 32 and 64 bits for class 64.
pub struct ElfOffset<const EC: u8, const ED: u8>(pub u64);

In the processing code, it's all represented as the largest common size in host endianness, then they just implement FromReader and ToWriter which handles the writing-to and reading-from the actual size and endianness. This has the small penalty of being very not zerocopy but I feel like if you need that for ELF processing you're doing something pretty wacky.

So far (I'm keeping score) it turns out MIPS is by far the worst offender flags-wise, which is surprising (I expected it to be ARM given the sheer number of vendors and chips)