"fringe platforms which can't even run a Rust compiler"
"fringe platforms which can't even run a Rust compiler"
Posted Feb 13, 2021 23:13 UTC (Sat) by Cyberax (✭ supporter ✭, #52523)In reply to: "fringe platforms which can't even run a Rust compiler" by sthibaul
Parent article: Python cryptography, Rust, and Gentoo
Yup. Get your platform's headers, copy the definitions and then massage them until they are valid Rust.
If you want something minimalistic, you can even skip most of them (I'd estimate that around 500 lines are truly needed).
> For somebody that doesn't even know Rust from the start?
Add one more day for cargo-culting from an existing file. If you ever had to debug autohell, you're qualified enough to do it.
> I'm not saying to automate string replacements, but simply do like all other languages implementations I have seen do: interpret the C headers in C, i.e. bindgen.
That is possible, but you'd spend quite a bit of time debugging the generated code for your custom platform anyway. And given that these files are pretty much static once they are written, they don't need a lot of maintenance.
In reality, bringing up a non-Unix platform is such a huge undertaking that you'd likely be better off by writing the libc in _Rust_.
