As I just announced on the DeforaOS website, the libc now works on my Openmoko phone, running Linux/ARM. There were a couple subtleties in the process, which are probably worth mentioning here.
There are different ABIs
ABI stands for "Application Binary Interface". It is the convention used between applications and the Operating System's kernel to perform low-level actions. Reading a file, sending data through a network, asking for the hour are common examples of such actions. There isn't really an established convention for this on the i386, where system developers know it often varies from a system to another.
On the ARM platform however, and just like on the other RISC platforms I know, I was expecting one ABI to be specified and to be implemented. So I copied my working code from the OpenBSD/ARM port of my libc, and it didn't work. Thankfully there is an excellent article on the matter on the Debian wiki.
Quick tips and tricks
As always, this is to the best of my knowledge, and from the top of my head:
- an ARM CPU has two interesting numbers: the family and architecture version, as seen here (eg ARM7 is ARMv3, ARM9 can be ARMv4 or ARMv5...)
- it can boot in either little or big endian
- it may support at least two instruction sets (16 and 32 bits)
If you find reading about data alignment constraints interesting, and if it is amusing to you that it can matter down to the numbers of the registers to use, read the Debian article cited above immediately.
The syscall numbers are not shared with i386
Unlike my experience with the BSD systems so far, the syscall numbers do not match regardless of the architecture on Linux. Thankfully, strace helped me to notice it really quick. The code executed simply made no sense :)
I said I'd never blog

