Commit f84458a
committed
Add powerpc64 and mips32 architecture support
Add startup code for powerpc64le (ELFv2 ABI) and mipsel (O32 ABI) targets,
enabling no_std programs to run on these architectures.
PowerPC64 (powerpc64.rs):
- _start sets up r2 (TOC pointer) using r12 before calling entry
- trap() uses the `trap` instruction
- Full thread support scaffolding (clone, thread pointer, TLS)
- Relocation support for PIC binaries
MIPS32 (mips32.rs):
- __start entry point (MIPS convention, not _start)
- 8-byte stack alignment with 16-byte O32 save area
- trap() uses the `break` instruction
- Thread support using rdhwr for thread pointer
- Syscall convention: $v0=syscall#, $a0-$a3=args, $a3=error flag
Both architectures:
- Implement origin-start feature for program startup
- Support optimize_for_size feature
- Follow existing origin patterns from other architectures
Tested with QEMU user-mode emulation (qemu-ppc64le-static, qemu-mipsel-static).
Note: QEMU ppc64le has a bug with argv setup for non-glibc binaries, but
the startup code itself is correct and works on real hardware.1 parent 10258f1 commit f84458a
3 files changed
Lines changed: 780 additions & 0 deletions
0 commit comments