Re: rust for mipsel / mips32
Havard Eidnes <[email protected]>
| Newsgroups | gmane.os.netbsd.ports.mips.devel |
|---|---|
| Message-ID | <[email protected]> |
>> I've finally managed to get rust working on mipsel. The downside >> is that you need a cpu supporting the mips32 instruction set > > Any specific instruction that is required? I must admit that I do not know. I tried "mips1" and that failed, and most of the other 32-bit rust targets for other systems indicate "mips32" or "mips32r2", so I just went with the path of least resistance for now. > It's possible to trap and emulate missing instructions. Probably, yes. And then the code in mips/cpu_exec.c needs to be updated, because at present the flags field in the elf header of the rust executables say Flags: 0x50001007, noreorder, pic, cpic, o32, mips32 and a kernel running on either a mips-I or mips-III CPU will currently refuse to execute this, due to the entry for EF_MIPS_ARCH_32 in the switch statement inmips_netbsd_elf32_probe. >> Earlier failed attempts: >> * cpu = "mips1", would have been more "portable" to older CPUs, >> but llvm failed to generate code for this cpu in at least one >> instance. The "mips1" target in llvm is marked "highly experimental", >> so this is perhaps not surprising. > mips1 requires load delay slot so... > Not a wise choice. Right. I'm learning as I go. >> * cpu = "mips3", an earlier mistake. Produces "of course" 64-bit >> instructions, so gives "illegal instruction" on e.g. cobalt and >> 32-bit-only CPUs. Despite this also being marked "highly experimental" >> in llvm, this build completed. > > -march=mips3 -mabi=32? Hmm, possibly. I'll look into whether / how that can be expressed in the rust target specification. Regards, - Håvard