Files
binutils-gdb/ld/emulparams/elf64lriscv.sh
Mark Goncharov 6589a725f0 RISC-V: Fix libpath_suffix selection for ldscript
When building a cross-compiler ld for RISC-V Linux systems, you can specify
target=riscv64*-linux* to create a linker that supports both 32-bit
(-march=rv32*) and 64-bit (-march=rv64*) architectures.  The specified -march
value populates the EMULATION_NAME variable, which determines the default
linker script selection.  For proper riscv64 target support, the build process
must prepare both elf32lriscv* and elf64lriscv* linker scripts.  These should
align with the standard RISC-V Linux sysroot directory structure.

Signed-off-by: Mark Goncharov <mark.goncharov@syntacore.com>
2025-07-08 18:35:19 +08:00

16 lines
454 B
Bash

# RV64 code using LP64D ABI.
# ABI not in emulation name to avoid breaking backward compatibility.
source_sh ${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
riscv*-linux*)
case "$EMULATION_NAME" in
*64*)
LIBPATH_SUFFIX="64/lp64d 64";;
esac
;;
esac