I've submitted a binutils patch that adds some new linker emulations to fix
a linker problem with library paths. The rv64/lp64d linker looks in /lib64
when glibc says it should look in /lib64/lp64d. To make the binutils patch
work, I had to add 4 new emulations because we have 6 ABIs. This patch
modifies the compiler to use the new linker emulations in the linux port. This
was done in a backwards compatible way, so the linker still looks in the
original dir after the ABI specific dir, and I didn't change the emulation
names for the default lp64d and ilp32d ABIs.
This was tested with riscv{32,64}-{elf,linux} builds and tests. There were
no regressions.
This will go in after the binutils patch goes in.
Jim
gcc/
* config/riscv/linux.h (MUSL_ABI_SUFFIX): Delete unnecessary backslash.
(LD_EMUL_SUFFIX): New.
---
gcc/config/riscv/linux.h | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index aa8a28d5d31..85561846dad 100644
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
"%{mabi=ilp32d:}" \
"%{mabi=lp64:-sf}" \
"%{mabi=lp64f:-sp}" \
- "%{mabi=lp64d:}" \
+ "%{mabi=lp64d:}"
#undef MUSL_DYNAMIC_LINKER
#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX
".so.1"
@@ -49,8 +49,16 @@ along with GCC; see the file COPYING3. If not see
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
+#define LD_EMUL_SUFFIX \
+ "%{mabi=lp64d:}" \
+ "%{mabi=lp64f:_lp64f}" \
+ "%{mabi=lp64:_lp64}" \
+ "%{mabi=ilp32d:}" \
+ "%{mabi=ilp32f:_ilp32f}" \
+ "%{mabi=ilp32:_ilp32}"
+
#define LINK_SPEC "\
--melf" XLEN_SPEC "lriscv \
+-melf" XLEN_SPEC "lriscv" LD_EMUL_SUFFIX " \
%{mno-relax:--no-relax} \
%{shared} \
%{!shared: \
--
2.14.1