On Sat, Nov 21, 2020 at 6:12 AM Jim Wilson <j...@sifive.com> wrote: > > On Fri, Nov 20, 2020 at 12:34 AM Kito Cheng <kito.ch...@sifive.com> wrote: > > > - Define MULTILIB_DEFAULTS can reduce the total number of multilib if > > the default arch and ABI are listed in the multilib config. > > > > It looks like a good idea, but it doesn't seem to work. A toolchain > configured without specifying arch/abi gives me > > rohan:2149$ riscv64-unknown-elf-gcc --print-multi-lib > .; > rv32i/ilp32;@march=rv32i@mabi=ilp32 > rv32im/ilp32;@march=rv32im@mabi=ilp32 > rv32iac/ilp32;@march=rv32iac@mabi=ilp32 > rv32imac/ilp32;@march=rv32imac@mabi=ilp32 > rv32imafc/ilp32f;@march=rv32imafc@mabi=ilp32f > rv64imac/lp64;@march=rv64imac@mabi=lp64 > rv64imafdc/lp64d;@march=rv64imafdc@mabi=lp64d > > The rv64imafdc/lp64d is actually built twice, as it is the default and is > built explicitly. But otherwise the list is correct. > > If I configure a toolchain with the patch using --with-arch=rv32i > --with-abi=ilp32 --enable-multilib then I get > > rohan:2151$ ./xgcc -B./ --print-multi-lib > .; > rv32imafc/ilp32f;@march=rv32imafc@mabi=ilp32f > rv64imac/lp64;@march=rv64imac@mabi=lp64 > rv64imafdc/lp64d;@march=rv64imafdc@mabi=lp64d > > and notice that 3 multilibs have mysteriously disappeared. We have four > multilibs with -mabi=ilp32. The rv32i/ilp32 multilib is gone as it is now > the default, but the other 3 should still be there. > > The gcc/multilib.h file in the gcc build dir looks correct. I think that > there is something wrong with the processing of the default args against > the multilib list. if you have just one default arg, and an entry matches > then obviously you don't build it. But if you have two default args, then > both must match before you choose to not build it, and I think the code has > never supported this case.
Hmmm, thanks for catching this, this is really weird, I verified with -print-multi-directory seems to work correctly but the output of --print-multi-lib does not work as expected, let me investigate what happened... [kitoc@hsinchu02 t-build]$ ./install/bin/riscv64-elf-gcc --print-multi-lib .; rv32imafc/ilp32f;@march=rv32imafc@mabi=ilp32f rv64imac/lp64;@march=rv64imac@mabi=lp64 rv64imafdc/lp64d;@march=rv64imafdc@mabi=lp64d [kitoc@hsinchu02 t-build]$ ./install/bin/riscv64-elf-gcc -print-multi-directory -march=rv32iac -mabi=ilp32 rv32iac/ilp32 [kitoc@hsinchu02 t-build]$ ./install/bin/riscv64-elf-gcc -print-multi-directory -march=rv32i -mabi=ilp32 rv32i/ilp32 [kitoc@hsinchu02 t-build]$ ./install/bin/riscv64-elf-gcc -print-multi-directory -march=rv32im -mabi=ilp32 rv32im/ilp32 > This works for the --with-multilib-list case because we currently only > support one arch/abi with this configure option, so there can be no > confusion with matching multiple default arguments. > > Jim