aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Goncharov <mark.goncharov@syntacore.com>2025-07-01 08:57:51 +0300
committerNelson Chu <nelson@rivosinc.com>2025-07-08 18:35:19 +0800
commit6589a725f0e4109e033976e15d1c3d61d96438df (patch)
tree674a2f59cd3c981aaefded2e173af9ce5cba55ff
parent1edefea39ff27ed2d4aed4e45ed416f3fbaf6098 (diff)
downloadbinutils-6589a725f0e4109e033976e15d1c3d61d96438df.zip
binutils-6589a725f0e4109e033976e15d1c3d61d96438df.tar.gz
binutils-6589a725f0e4109e033976e15d1c3d61d96438df.tar.bz2
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>
-rw-r--r--ld/emulparams/elf32lriscv.sh2
-rw-r--r--ld/emulparams/elf32lriscv_ilp32.sh2
-rw-r--r--ld/emulparams/elf32lriscv_ilp32f.sh2
-rw-r--r--ld/emulparams/elf64lriscv.sh2
-rw-r--r--ld/emulparams/elf64lriscv_lp64.sh2
-rw-r--r--ld/emulparams/elf64lriscv_lp64f.sh2
6 files changed, 6 insertions, 6 deletions
diff --git a/ld/emulparams/elf32lriscv.sh b/ld/emulparams/elf32lriscv.sh
index da0d7cf..4246013 100644
--- a/ld/emulparams/elf32lriscv.sh
+++ b/ld/emulparams/elf32lriscv.sh
@@ -6,7 +6,7 @@ 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*)
+ riscv*-linux*)
case "$EMULATION_NAME" in
*32*)
LIBPATH_SUFFIX="32/ilp32d 32" ;;
diff --git a/ld/emulparams/elf32lriscv_ilp32.sh b/ld/emulparams/elf32lriscv_ilp32.sh
index 4935937..c773985 100644
--- a/ld/emulparams/elf32lriscv_ilp32.sh
+++ b/ld/emulparams/elf32lriscv_ilp32.sh
@@ -5,7 +5,7 @@ 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*)
+ riscv*-linux*)
case "$EMULATION_NAME" in
*32*)
LIBPATH_SUFFIX="32/ilp32 32" ;;
diff --git a/ld/emulparams/elf32lriscv_ilp32f.sh b/ld/emulparams/elf32lriscv_ilp32f.sh
index c684bf8..a2f0c2a 100644
--- a/ld/emulparams/elf32lriscv_ilp32f.sh
+++ b/ld/emulparams/elf32lriscv_ilp32f.sh
@@ -5,7 +5,7 @@ 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*)
+ riscv*-linux*)
case "$EMULATION_NAME" in
*32*)
LIBPATH_SUFFIX="32/ilp32f 32" ;;
diff --git a/ld/emulparams/elf64lriscv.sh b/ld/emulparams/elf64lriscv.sh
index e07a064..7958052 100644
--- a/ld/emulparams/elf64lriscv.sh
+++ b/ld/emulparams/elf64lriscv.sh
@@ -6,7 +6,7 @@ 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*)
+ riscv*-linux*)
case "$EMULATION_NAME" in
*64*)
LIBPATH_SUFFIX="64/lp64d 64";;
diff --git a/ld/emulparams/elf64lriscv_lp64.sh b/ld/emulparams/elf64lriscv_lp64.sh
index b1bb252..7c7feca 100644
--- a/ld/emulparams/elf64lriscv_lp64.sh
+++ b/ld/emulparams/elf64lriscv_lp64.sh
@@ -5,7 +5,7 @@ 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*)
+ riscv*-linux*)
case "$EMULATION_NAME" in
*64*)
LIBPATH_SUFFIX="64/lp64 64";;
diff --git a/ld/emulparams/elf64lriscv_lp64f.sh b/ld/emulparams/elf64lriscv_lp64f.sh
index 005f191..e036c2f 100644
--- a/ld/emulparams/elf64lriscv_lp64f.sh
+++ b/ld/emulparams/elf64lriscv_lp64f.sh
@@ -5,7 +5,7 @@ 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*)
+ riscv*-linux*)
case "$EMULATION_NAME" in
*64*)
LIBPATH_SUFFIX="64/lp64f 64";;