https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85142

--- Comment #10 from Jim Wilson <wilson at gcc dot gnu.org> ---
The main problem turns out to be your deletion of MULTILIB_REUSE.  You get an
error if MULTILIB_REUSE refers to directories that aren't in MULTILIB_REQUIRED,
but deleting the whole thing is wrong, as this is required to handle the fact
that imafdc and gc are the same architecture.

Defining MULTILIB_REUSE makes MULTILIB_MATCHES unnecessary.  The RISC-V port is
using default options specified by configure, so MULTILIB_DEFAULTS appears to
be unnecessary.

Adding back to your patch

MULTILIB_REUSE = \
march.rv64imafdc/mabi.lp64d=march.rv64imafd/mabi.lp64d \
march.rv64imafdc/mabi.lp64d=march.rv64gc/mabi.lp64d \
march.rv64imafdc/mabi.lp64d=march.rv64g/mabi.lp64d

I get

gamma05:2256$ ./xgcc -B./ --print-multi-lib
.;
lib64/lp64d;@march=rv64imafdc@mabi=lp64d
gamma05:2257$ ./xgcc -B./ --print-multi-dir
lib64/lp64d
gamma05:2258$ ./xgcc -B./ --print-multi-os-directory
../lib64/lp64d
gamma05:2259$ 

which looks mostly OK.

We still have two multilibs according to print-multi-lib though.  The default
one will never match, because it is identical to the second one, and hence will
never be used.  We are wasting time building it and installing it.  It will
install into /usr/lib which we don't want.  To get rid of the extra multilib, I
need to add multilib defaults again.  With that change, I now get

gamma05:2331$ ./xgcc -B./ --print-multi-lib
.;
gamma05:2332$ ./xgcc -B./ --print-multi-dir
lib64/lp64d
gamma05:2333$ ./xgcc -B./ --print-multi-os-directory
../lib64/lp64d

which looks right.  Only one copy of the libraries are built, and they get
installed in the right place, in ../lib64/lp64d.

I'll attach my patch.

Reply via email to