Kito Cheng <kito.ch...@gmail.com> 于2024年9月5日周四 16:36写道: > > LGTM, thanks for catching this, but commit log seems not right? > should it be -print-multi-directory or -print-multi-os-directory > rather than --print-multilib-os-dir?
Yes. It is a typo. I used `--print-multilib-os-dir`, and yes, as you said, `-print-multi-directory` has same problem. > (I guess should be -print-multi-directory per your output) > > Anyway, you can go ahead and push that after the fix:) > > > On Thu, Sep 5, 2024 at 3:30 PM YunQiang Su <s...@gcc.gnu.org> wrote: > > > > From: YunQiang Su <yunqi...@isrc.iscas.ac.cn> > > > > When use --print-multilib-os-dir, gcc outputs different value > > with full -march option and the base one only. > > > > $ ./gcc/xgcc --print-multilib-os-dir -mabi=lp64d -march=rv64gc > > lib64/lp64d > > > > $ ./gcc/xgcc --print-multilib-os-dir -mabi=lp64d -march=rv64gc_zba > > . > > > > The reason is that in multilib.h, the fallback value of multilib > > is listed as the 1st one in `multilib_raw[]`. > > > > gcc > > * common/config/riscv/riscv-common.cc(riscv_select_multilib_by_abi): > > look up reversely as the fallback path is listed as the 1st one. > > --- > > gcc/common/config/riscv/riscv-common.cc | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/gcc/common/config/riscv/riscv-common.cc > > b/gcc/common/config/riscv/riscv-common.cc > > index 62c6e1dab1f..2c1ce7fc7cb 100644 > > --- a/gcc/common/config/riscv/riscv-common.cc > > +++ b/gcc/common/config/riscv/riscv-common.cc > > @@ -2079,7 +2079,7 @@ riscv_select_multilib_by_abi ( > > const std::string &riscv_current_abi_str, > > const std::vector<riscv_multi_lib_info_t> &multilib_infos) > > { > > - for (size_t i = 0; i < multilib_infos.size (); ++i) > > + for (ssize_t i = multilib_infos.size (); i >= 0; --i) > > if (riscv_current_abi_str == multilib_infos[i].abi_str) > > return xstrdup (multilib_infos[i].path.c_str ()); > > > > -- > > 2.39.3 (Apple Git-146) > >