Hack to align RISC-V LIBRARY_PATH with existing architectures
musl does not support sharing an include directory between archs
[…], and thus is not compatible with GCC-style multilib. It is
recommended that distributions build GCC with multilib disabled,
and use library directories named lib, not lib64 or lib32.
For this reason, we patch existing GCC configuration files (gcc/config) to pin MULTILIB_OSDIRNAMES to lib, there is also a corresponding GCC upstream bug about this issue [2]. Avoiding the use of lib64 and lib32 directories is a bit more difficult on the RISC-V architecture. This is due to the fact that the default RISC-V configuration does not only use the lib64 and lib32 directories but also subdirectories within these directories for different RISC-V ABIs (e.g. lp64d, lp64, …) [3].
This patch aligns the RISC-V configuration with other architectures by pinning MULTILIB_OSDIRNAMES to lib for rv64gc (our default RISC-V -march). Furthermore, this patch removes the ABI-specific startfile prefix spec. Since both of these impact the default LIBRARY_PATH [4] this patch thereby aligns the default RISC-V LIBRARY_PATH with that from other Alpine architectures and thereby fixes #13369 [5].
Incidentally, this also fixes gccgo on riscv64, as without this patch gccgo is otherwise not able to find the *.gox files for the Go standard library.