[gcc r17-3263] Re: [PATCH] RISC-V: Don't emit a separate multilib for the default march/mabi
Jeff Law via Gcc-cvs <[email protected]>
| Newsgroups | gmane.comp.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://gcc.gnu.org/g:6294f1d9e7536e5ffcde09d1528c918d63abfef5 commit r17-3263-g6294f1d9e7536e5ffcde09d1528c918d63abfef5 Author: Jim Lin <[email protected]> Date: Thu Aug 13 11:46:58 2026 -0600 Re: [PATCH] RISC-V: Don't emit a separate multilib for the default march/mabi Skip a multilib only when it is exactly equivalent to the default: it shares the default march and mabi and carries no other distinguishing option (such as mcmodel). A multilib that matches the default march/mabi but differs in another option is kept. This fixes a broken Ada build. When configured with --with-multilib-list=lp64d, the lp64d multilib is the default but was still emitted as a separate multilib, so MULTISUBDIR became /lib64/lp64d instead of empty. gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_multi_lib_info_t::parse): Skip a multilib that is exactly equivalent to the default march/mabi. Signed-off-by: Jim Lin <[email protected]> Diff: --- gcc/common/config/riscv/riscv-common.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index 6bbbacab8df4..83e22e0e2989 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -1922,11 +1922,21 @@ riscv_multi_lib_info_t::parse ( else { std::vector<std::string>::const_iterator itr; + bool only_arch_abi = true; for (itr = conds.begin (); itr != conds.end (); ++itr) if (prefixed_with (*itr, "march=")) multi_lib_info->arch_str = itr->c_str () + strlen ("march="); else if (prefixed_with (*itr, "mabi=")) multi_lib_info->abi_str = itr->c_str () + strlen ("mabi="); + else + only_arch_abi = false; + + /* Skip a multi-lib that is exactly equivalent to the default: same + march and mabi with no other distinguishing option. */ + if (only_arch_abi + && multi_lib_info->arch_str == default_arch_str + && multi_lib_info->abi_str == default_abi_str) + return false; } multi_lib_info->subset_list =