config.sub: Systematize parsing of machine code formats

Instead of treating them as OSes, we treat them as their own category.
This is modeled on what LLVM does with its `ObjectFormatType` enum [1],
advancing my long-running project of trying to nudge GNU config and LLVM
towards each other, taking the best ideas of both.

Currently, my emphasis is just on code cleanup. There are just a few
tests for newly supported changes that fall out of this. But down the
road, this also opens the door to parsing configs with more than 4
components, like [2].

[1]: https://llvm.org/doxygen/classllvm_1_1Triple.html#a83e907e55fa50e093caa96a0aff96201

[2]: a18266473b/llvm/unittests/TargetParser/TripleTest.cpp (L1873C50-L1873C77)
added in
28b82bc39e

* config.sub: Save machine code format name separately from the OS name.
* doc/config.sub.1: Regenerate.
* testsuite/config-sub.data (arm-unknown-none-aout,
arm-unknown-none-pe): New entries.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
This commit is contained in:
John Ericson
2023-08-07 14:20:40 -04:00
committed by Dmitry V. Levin
parent d4e37b5868
commit 39c49ea712
3 changed files with 94 additions and 45 deletions

View File

@ -91,9 +91,11 @@ arm-sysgo-pikeos arm-sysgo-eabi
arm-tirtos arm-unknown-tirtos
arm-uclinux-uclibcgnueabi arm-unknown-uclinux-uclibcgnueabi
arm-unknown-netbsdelf7.0 arm-unknown-netbsdelf7.0
arm-unknown-none-aout arm-unknown-none-aout
arm-unknown-none-coff arm-unknown-none-coff
arm-unknown-none-eabi arm-unknown-none-eabi
arm-unknown-none-elf arm-unknown-none-elf
arm-unknown-none-pe arm-unknown-none-pe
arm-unknown-riscos arm-unknown-riscos
arm-zephyr arm-unknown-zephyr
arm64-apple-darwin20.0.0 aarch64-apple-darwin20.0.0