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.

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

Reply via email to