+2018-05-08 Jim Wilson <jimw@sifive.com>
+
+ PR ld/22962
+ * Makefile.am (ALL_EMULATION_SOURCES): Add eelf32lriscv_ilp32f.c,
+ eelf32lriscv_ilp32.c, eelf64lriscv_lp64f.c, eelf64lriscv_lp64.c.
+ (eelf32lriscv_ilp32f.c, eelf32lriscv_ilp32.c): New build rules.
+ (eelf64lriscv_lp64f.c, eelf64lriscv_lp64.c): New build rules.
+ * Makefile.in: Regenerated.
+ * configure.tgt (riscv32*-*-linux*, riscv64*-*-linux*): New.
+ * ld/emulparams/elf32lriscv.sh: Set LIBPATH_SUFFIX.
+ * ld/emulparams/elf32lriscv_ilp32.sh: New.
+ * ld/emulparams/elf32lriscv_ilp32f.sh: New.
+ * ld/emulparams/elf64lriscv-defs.sh: Don't set LIBPATH_SUFFIX here.
+ * ld/emulparams/elf64lriscv.sh: Set LIBPATH_SUFFIX.
+ * ld/emulparams/elf64lriscv_lp64.sh: New.
+ * ld/emulparams/elf64lriscv_lp64f.sh: New.
+ * ld/genscripts.sh (append_to_lib_path): Change LIBPATH_SUFFIX test to
+ a for. Inside loop, change LIBPATH_SUFFIX uses to libpath_suffix.
+ (LIB_PATH): In LIB_PATH if, add loop for LIBPATH_SUFFIX, changes uses
+ inside loop to libpath_suffix.
+
2018-05-03 Jim Wilson <jimw@sifive.com>
* Makefile.am (earmelfb_linux_fdpiceabi.c): Fix typo in dependencies.
eelf32ppcvxworks.c \
eelf32ppcwindiss.c \
eelf32lriscv.c \
+ eelf32lriscv_ilp32f.c \
+ eelf32lriscv_ilp32.c \
eelf32rl78.c \
eelf32rx.c \
eelf32tilegx.c \
eelf64hppa.c \
eelf64lppc.c \
eelf64lriscv.c \
+ eelf64lriscv_lp64f.c \
+ eelf64lriscv_lp64.c \
eelf64ltsmip.c \
eelf64ltsmip_fbsd.c \
eelf64mmix.c \
$(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
${GEN_DEPENDS}
+eelf32lriscv_ilp32f.c: $(srcdir)/emulparams/elf32lriscv_ilp32f.sh \
+ $(srcdir)/emulparams/elf32lriscv-defs.sh $(ELF_DEPS) \
+ $(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
+ ${GEN_DEPENDS}
+
+eelf32lriscv_ilp32.c: $(srcdir)/emulparams/elf32lriscv_ilp32.sh \
+ $(srcdir)/emulparams/elf32lriscv-defs.sh $(ELF_DEPS) \
+ $(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
+ ${GEN_DEPENDS}
+
eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \
$(srcdir)/emulparams/elf32lmip.sh $(srcdir)/emulparams/elf32bmip.sh \
$(ELF_DEPS) $(srcdir)/emultempl/mipself.em $(srcdir)/scripttempl/elf.sc \
$(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
${GEN_DEPENDS}
+eelf64lriscv_lp64f.c: $(srcdir)/emulparams/elf64lriscv_lp64f.sh \
+ $(srcdir)/emulparams/elf64lriscv-defs.sh \
+ $(srcdir)/emulparams/elf32lriscv-defs.sh $(ELF_DEPS) \
+ $(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
+ ${GEN_DEPENDS}
+
+eelf64lriscv_lp64.c: $(srcdir)/emulparams/elf64lriscv_lp64.sh \
+ $(srcdir)/emulparams/elf64lriscv-defs.sh \
+ $(srcdir)/emulparams/elf32lriscv-defs.sh $(ELF_DEPS) \
+ $(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
+ ${GEN_DEPENDS}
+
eelf64ltsmip.c: $(srcdir)/emulparams/elf64ltsmip.sh \
$(srcdir)/emulparams/elf64btsmip.sh $(srcdir)/emulparams/elf64bmip-defs.sh \
$(srcdir)/emulparams/elf32bmipn32-defs.sh $(ELF_DEPS) \
eelf32ppcvxworks.c \
eelf32ppcwindiss.c \
eelf32lriscv.c \
+ eelf32lriscv_ilp32f.c \
+ eelf32lriscv_ilp32.c \
eelf32rl78.c \
eelf32rx.c \
eelf32tilegx.c \
eelf64hppa.c \
eelf64lppc.c \
eelf64lriscv.c \
+ eelf64lriscv_lp64f.c \
+ eelf64lriscv_lp64.c \
eelf64ltsmip.c \
eelf64ltsmip_fbsd.c \
eelf64mmix.c \
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lr5900.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lr5900n32.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lriscv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lriscv_ilp32.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lriscv_ilp32f.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lsmip.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmip.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmip_fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64hppa.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64f.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip_fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64mmix.Po@am__quote@
$(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
${GEN_DEPENDS}
+eelf32lriscv_ilp32f.c: $(srcdir)/emulparams/elf32lriscv_ilp32f.sh \
+ $(srcdir)/emulparams/elf32lriscv-defs.sh $(ELF_DEPS) \
+ $(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
+ ${GEN_DEPENDS}
+
+eelf32lriscv_ilp32.c: $(srcdir)/emulparams/elf32lriscv_ilp32.sh \
+ $(srcdir)/emulparams/elf32lriscv-defs.sh $(ELF_DEPS) \
+ $(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
+ ${GEN_DEPENDS}
+
eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \
$(srcdir)/emulparams/elf32lmip.sh $(srcdir)/emulparams/elf32bmip.sh \
$(ELF_DEPS) $(srcdir)/emultempl/mipself.em $(srcdir)/scripttempl/elf.sc \
$(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
${GEN_DEPENDS}
+eelf64lriscv_lp64f.c: $(srcdir)/emulparams/elf64lriscv_lp64f.sh \
+ $(srcdir)/emulparams/elf64lriscv-defs.sh \
+ $(srcdir)/emulparams/elf32lriscv-defs.sh $(ELF_DEPS) \
+ $(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
+ ${GEN_DEPENDS}
+
+eelf64lriscv_lp64.c: $(srcdir)/emulparams/elf64lriscv_lp64.sh \
+ $(srcdir)/emulparams/elf64lriscv-defs.sh \
+ $(srcdir)/emulparams/elf32lriscv-defs.sh $(ELF_DEPS) \
+ $(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
+ ${GEN_DEPENDS}
+
eelf64ltsmip.c: $(srcdir)/emulparams/elf64ltsmip.sh \
$(srcdir)/emulparams/elf64btsmip.sh $(srcdir)/emulparams/elf64bmip-defs.sh \
$(srcdir)/emulparams/elf32bmipn32-defs.sh $(ELF_DEPS) \
powerpc-*-windiss*) targ_emul=elf32ppcwindiss ;;
powerpc-*-lynxos*) targ_emul=ppclynx ;;
pru*-*-*) targ_emul=pruelf ;;
+riscv32*-*-linux*) targ_emul=elf32lriscv
+ targ_extra_emuls="elf32lriscv_ilp32f elf32lriscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64"
+ targ_extra_libpath=$targ_extra_emuls ;;
riscv32*-*-*) targ_emul=elf32lriscv
targ_extra_emuls="elf64lriscv"
targ_extra_libpath=$targ_extra_emuls ;;
+riscv64*-*-linux*) targ_emul=elf64lriscv
+ targ_extra_emuls="elf64lriscv_lp64f elf64lriscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32"
+ targ_extra_libpath=$targ_extra_emuls ;;
riscv64*-*-*) targ_emul=elf64lriscv
targ_extra_emuls="elf32lriscv"
targ_extra_libpath=$targ_extra_emuls ;;
+# RV32 code using ILP32D ABI.
+# ABI not in emulation name to avoid breaking backward compatibility.
. ${srcdir}/emulparams/elf32lriscv-defs.sh
OUTPUT_FORMAT="elf32-littleriscv"
+
+# On Linux, first look for 32 bit ILP32D target libraries in /lib/ilp32d as per
+# the glibc ABI.
+case "$target" in
+ riscv32*-linux*)
+ case "$EMULATION_NAME" in
+ *32*)
+ LIBPATH_SUFFIX="/ilp32d" ;;
+ esac
+ ;;
+esac
--- /dev/null
+# RV32 code using ILP32 ABI.
+. ${srcdir}/emulparams/elf32lriscv-defs.sh
+OUTPUT_FORMAT="elf32-littleriscv"
+
+# On Linux, first look for 32 bit ILP32 target libraries in /lib/ilp32 as per
+# the glibc ABI.
+case "$target" in
+ riscv32*-linux*)
+ case "$EMULATION_NAME" in
+ *32*)
+ LIBPATH_SUFFIX="/ilp32" ;;
+ esac
+ ;;
+esac
--- /dev/null
+# RV32 code using ILP32F ABI.
+. ${srcdir}/emulparams/elf32lriscv-defs.sh
+OUTPUT_FORMAT="elf32-littleriscv"
+
+# On Linux, first look for 32 bit ILP32F target libraries in /lib/ilp32f as per
+# the glibc ABI.
+case "$target" in
+ riscv32*-linux*)
+ case "$EMULATION_NAME" in
+ *32*)
+ LIBPATH_SUFFIX="/ilp32f" ;;
+ esac
+ ;;
+esac
. ${srcdir}/emulparams/elf32lriscv-defs.sh
ELFSIZE=64
-
-# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first
-# on Linux.
-case "$target" in
- riscv64*-linux*)
- case "$EMULATION_NAME" in
- *64*)
- LIBPATH_SUFFIX=64 ;;
- esac
- ;;
-esac
+# RV64 code using LP64D ABI.
+# ABI not in emulation name to avoid breaking backward compatibility.
. ${srcdir}/emulparams/elf64lriscv-defs.sh
OUTPUT_FORMAT="elf64-littleriscv"
+
+# On Linux, first look for 64 bit LP64D target libraries in /lib64/lp64d as per
+# the glibc ABI, and then /lib64 for backward compatility.
+case "$target" in
+ riscv64*-linux*)
+ case "$EMULATION_NAME" in
+ *64*)
+ LIBPATH_SUFFIX="64/lp64d 64";;
+ esac
+ ;;
+esac
--- /dev/null
+# RV64 code using LP64 ABI.
+. ${srcdir}/emulparams/elf64lriscv-defs.sh
+OUTPUT_FORMAT="elf64-littleriscv"
+
+# On Linux, first look for 64 bit LP64 target libraries in /lib64/lp64 as per
+# the glibc ABI, and then /lib64 for backward compatility.
+case "$target" in
+ riscv64*-linux*)
+ case "$EMULATION_NAME" in
+ *64*)
+ LIBPATH_SUFFIX="64/lp64 64";;
+ esac
+ ;;
+esac
--- /dev/null
+# RV64 code using LP64F ABI.
+. ${srcdir}/emulparams/elf64lriscv-defs.sh
+OUTPUT_FORMAT="elf64-littleriscv"
+
+# On Linux, first look for 64 bit LP64F target libraries in /lib64/lp64f as per
+# the glibc ABI, and then /lib64 for backward compatility.
+case "$target" in
+ riscv64*-linux*)
+ case "$EMULATION_NAME" in
+ *64*)
+ LIBPATH_SUFFIX="64/lp64f 64";;
+ esac
+ ;;
+esac
lib="=${lib}"
fi
skip_lib=no
- if test -n "${LIBPATH_SUFFIX}"; then
+ for libpath_suffix in ${LIBPATH_SUFFIX}; do
case "${lib}" in
- *${LIBPATH_SUFFIX})
+ *${libpath_suffix})
case :${lib_path1}: in
*:${lib}:*) ;;
::) lib_path1=${lib} ;;
fi
if test "${skip_lib}" = "no"; then
case :${lib_path1}: in
- *:${lib}${LIBPATH_SUFFIX}:*) ;;
- ::) lib_path1=${lib}${LIBPATH_SUFFIX} ;;
- *) lib_path1=${lib_path1}:${lib}${LIBPATH_SUFFIX} ;;
+ *:${lib}${libpath_suffix}:*) ;;
+ ::) lib_path1=${lib}${libpath_suffix} ;;
+ *) lib_path1=${lib_path1}:${lib}${libpath_suffix} ;;
esac
fi ;;
esac
- fi
+ done
if test "${skip_lib}" = "no"; then
case :${lib_path1}:${lib_path2}: in
*:${lib}:*) ;;
# because 64bit libraries may be in both places, depending on
# cross-development setup method (e.g.: /usr/s390x-linux/lib64
# vs. /usr/s390-linux/lib64)
- case "${NATIVE}:${LIBPATH_SUFFIX}:${TOOL_LIB}" in
- :* | *::* | *:*:*${LIBPATH_SUFFIX}) ;;
- *) libs="${exec_prefix}/${target_alias}/lib${LIBPATH_SUFFIX}" ;;
- esac
+ for libpath_suffix in ${LIBPATH_SUFFIX}; do
+ case "${NATIVE}:${libpath_suffix}:${TOOL_LIB}" in
+ :* | *::* | *:*:*${libpath_suffix}) ;;
+ *) libs="${exec_prefix}/${target_alias}/lib${libpath_suffix}" ;;
+ esac
+ done
libs="${exec_prefix}/${TOOL_LIB}/lib ${libs}"
fi
append_to_lib_path ${libs}