Expand targets acceptable to rustc

With my "de facto maintainer of autoconf" hat on, and without expressing any particular opinion on the specific case that sparked this thread:

  • The VENDOR component of a GNU "canonical system name" is vestigial. It exists because there was a brief period in the late 1980s/early 1990s where there were a bunch of Unix workstation vendors all putting out kit based on the Motorola 68xxx CPU, with operating systems identifying themselves as "Unix System V", but providing different C-level programming environments. So m68k-foonly-sysv and m68k-barley-sysv could have been meaningfully different. Nobody does this anymore, because the marketing value of giving your company's operating system its own name became obvious almost immediately.

    If you look at how GCC's configure.ac, for instance, processes canonical system names, you will see that most of the time it looks only at $(host|target)_cpu or at $(host|target)_os, and the rest of the time it uses shell glob patterns that ignore the vendor field.

    I would recommend documenting that #[cfg(target_vendor = ...)] is supported for completeness and (as far as the Rust Project knows) is not useful for distinguishing between any two currently supported systems.

  • It is reasonable for Rust not to bother supporting all of the names understood by config.sub. However, if Rust accepts system names A and B as valid, and config.sub maps A to B, then the entire Rust ecosystem MUST also map A to B, except for the very rare circumstances where it is desirable to preserve A exactly as input by the user (e.g. configuring GCC with --target=riscv-linux will cause it to look for an assembler named riscv-linux-as rather than riscv-unknown-linux-gnu-as).

    If you don't do this it will break all kinds of "downstream" processes that expect they can run any system name through config.sub and treat the result as the canonical representative of an equivalence class. If I understand OP's original request correctly (which I'm not sure I do), it is a report of exactly this type of breakage.

  • Just to avoid confusion, it would be nice if the Rust toolchain used the terms "build", "host", and "target" the same way Autoconf does: the "build" system is the system that the program is being compiled on, the "host" system is the system that the program will run on, and the "target" system is the system that the program will generate code for. A program that is not some type of compiler has no use for the "target system" knob.

4 Likes