[clang] [llvm] [Driver][RISC-V] Support YAML multilib config with selectRISCVMultilib fallback (PR #184973)
Sam Elliott via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 6 12:08:52 PST 2026
lenary wrote:
Yeah, in our cpullvm, we have the following in `Mappings:`
```
- Match: -march=rv32i2p1_.*m2p0_.*a2p1_.*c2p0_.*zmmul1p0_.*zaamo1p0_.*zalrsc1p0_.*zca1p0_.*zba1p0_.*zbb1p0.*
Flags:
- -march=rv32i2p1_m2p0_a2p1_c2p0_zmmul1p0_zaamo1p0_zalrsc1p0_zca1p0_zba1p0_zbb1p0
```
How we do this is we take the args we intended to make the multilib with, we do `--print-enabled-extensions` and pull out the canonical architecture string, and then we replace the `_` with `_.*`. We do this in a script so we don't have to hand-write it. This is done in https://github.com/qualcomm/cpullvm-toolchain/blob/qualcomm-software/qualcomm-software/cmake/get_canonical_riscv_march.cmake
We then have something like this in the `Variants:`
```
- Dir: riscv32-unknown-elf/riscv32imac_zba_zbb_ilp32
Flags:
- --target=riscv32-unknown-unknown-elf
- -march=rv32i2p1_m2p0_a2p1_c2p0_zmmul1p0_zaamo1p0_zalrsc1p0_zca1p0_zba1p0_zbb1p0
- -mabi=ilp32
Group: stdlibs
```
Where `stdlibs` is an exclusive group.
This gets you subset matching immediately. I don't think the Atomics stuff is fundamentally anything beyond subset matching, but maybe it is? We don't do anything special for Atomics.
We've actually hit problems with the "default multilibs" expansion done in C++, so I'm very unwilling to expand it. We ended up having to add "dummy" multilib.ymls into each library path so if users want to pass `--sysroot` pointing at a specific multilib, they can. https://github.com/qualcomm/cpullvm-toolchain/pull/236
https://github.com/llvm/llvm-project/pull/184973
More information about the cfe-commits
mailing list