[Toybox] [PATCH] readelf: support processor-specific flags.

Rob Landley rob at landley.net
Mon Dec 8 14:25:32 PST 2025


On 12/5/25 13:16, enh wrote:
> These are the arm/arm64/x86-64 ones special cased by binutils and llvm.

#defining EM_ARM when it's in both elf.h and linux/elf-em.h seems like 
it should either use the header or be in portability.h? We haven't 
#defined any EM_BLAH symbols here before that, missing chunk of 
policy/design decision. Posix noped out of elf.h and LSB died. I dunno 
if this command is supposed to build on bsd or macos? (MacOS is mach-o 
but all the other bsds were elf last I checked?)

The #define DO_FLAG() with the if/else stack really seems like it wants 
to be a loop over an array. Hmmm... The key and the bits are pretty much 
the same logic. Is lower case 'x' ever actually output? (We could put a 
space there and just not stick it in the key.) Is there a big downside 
to the key having "(y) purecode" and "(l) large" in the output on 
architectures that don't support them so we're not making the help text 
conditional?

I can take a stab at changing that but I'm not really a heavy user of 
this command...

> There's also a hexagon flag,

Someday, Taylor Simpson may get the comet board emulation upstream into 
qemu so there's a proper qemu-system-hexagon that can actually boot 
kernels. At which point I'll need to start building LLVM again because 
they abandoned gcc support when it went GPLv3 and were switching to 
Open64 until I introduced them to LLVM...

> two xcore flags (whatever xcore is),

XMOS Xcore... Wikipedia [citation needed] says Xmos is a 20 year old UK 
semiconductor company that did a "pivot to AI" earlier this year and are 
thus 100% dead (but may not know it yet). In any case they became yet 
another undifferentiated riscv vendor in 2022.

> and a
> bunch of mips flags, but none of those seem to actually produce any
> output, so this patch just ignores those esoterica.

At one point I had stuff detecting FDPIC binaries on sh, but it was just 
"if it's sh and has this bit set", dunno what "proper" macros for it 
would be...

Rob


More information about the Toybox mailing list