Tiny ELF binaries on ARM
Looks like breadbox didn't want to go down this rabbithole. So we'll have to do it instead.
-
e_machine
seems to be the only checked header field (e_entry
alignment checks are normal, because if it wouldn't be aligned, the code would segfault on entry.) -
phdr
parsing etc. is done architecture-independent, so the same tricks should be usable here as well.- However, on x86, we were using the way page mapping works to only have to specify a few flags, this probably can't be ported over.
- Each ARM opcode is 4 bytes long, and needs to be aligned. This kinda sucks for all the overlapping tricks. Also, arbitrary constants can't be loaded into registers easily.
- Do we want to depend on Thumb-mode?
- Apparently the kernel doesn't look at the immediate field of
swi
instructions if it's configured as EABI-only. - Dynamic linking stuff
A few questions on the target platform
- How many ARM Linux machines have...
- Thumb support? (
thumb
in/proc/cpuinfo
) - Halfword load/store support? (
ldrh
/strh
,half
in/proc/cpuinfo
) - A fast multiplier? (
fastmult
in/proc/cpuinfo
)
- Thumb support? (
- How many kernels are OABI, EABI with OABI support, or EABI-only?