Description
All FreeBSD targets are currently hard-coded to use the FreeBSD 11 syscall ABI. For most targets this is "fine", since the default kernel configs include COMPAT_FREEBSD11. However, the current RISC-V FreeBSD port post-dates FreeBSD 11 (see https://www.freebsd.org/cgi/man.cgi?query=arch), so the syscalls that were removed in FreeBSD 12 never existed for RISC-V, and so the kernel does not, and should not (as one of the primary RISC-V developers I will veto any such change), enable COMPAT_FREEBSD11. Any attempt to use them will deliver a fatal-by-default SIGSYS to the process, and given FreeBSD 11->12 was the ino64 transition, this affects basically anything you could actually want to do.
As well as multiple places hard-coding the FreeBSD ABI version, this information is not communicated to other crates. Notably FreeBSD 12 added the ext field to struct kevent, which breaks mio's kqueue.rs, as I discovered when I hacked up rustc and libc to hard-code FreeBSD 12 for RISC-V (and thus ended up with https://reviews.freebsd.org/P525 to make it work). Ideally this information would be communicated to build.rs somehow, if not available as default cfg predicates.
This was all totally glossed over when the changes were upstreamed, despite my cries within FreeBSD to engage with you all upstream and sort this mess out. I still don't have time to do that engaging myself, but at least this makes you aware of the actual problem. Maybe you have ideas for a decent way to communicate the FreeBSD version to crates so we can at least just hard-code RISC-V as minimum FreeBSD 12 in rustc and have that propagate everywhere; it's not ideal, but at least then it'd be centralised.
For what it's worth, https://reviews.freebsd.org/P522, https://reviews.freebsd.org/P523, https://reviews.freebsd.org/P524 and https://reviews.freebsd.org/P525 is the complete set of patches I hacked up to get a working rustc+cargo capable of compiling a hello world natively on a stock RISC-V GENERIC kernel, that then got picked up by others and had the FreeBSD 12 ABI parts dropped from.