]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
RISC-V: Fix libpath_suffix selection for ldscript
authorMark Goncharov <mark.goncharov@syntacore.com>
Tue, 1 Jul 2025 05:57:51 +0000 (08:57 +0300)
committerNelson Chu <nelson@rivosinc.com>
Tue, 8 Jul 2025 10:35:19 +0000 (18:35 +0800)
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>
ld/emulparams/elf32lriscv.sh
ld/emulparams/elf32lriscv_ilp32.sh
ld/emulparams/elf32lriscv_ilp32f.sh
ld/emulparams/elf64lriscv.sh
ld/emulparams/elf64lriscv_lp64.sh
ld/emulparams/elf64lriscv_lp64f.sh

index da0d7cf54f48c2f177fb6381e42d1da119a901cf..42460131e6ec188b784281bc47c0401a2ca6d942 100644 (file)
@@ -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" ;;
index 4935937ef6a9e1b5b973837a21b99bd3af094198..c773985f09331df4ee48491243fcc44a9f9fa04f 100644 (file)
@@ -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" ;;
index c684bf85ee52f3f8f95ab72a89a5855030b40c23..a2f0c2a6c38b8ae1e229ba8f60cfab03f2298ee3 100644 (file)
@@ -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" ;;
index e07a0648735d1174d50c0166822bc14125dd1955..7958052d3b7ee97822ab4c838292e071abc4035a 100644 (file)
@@ -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";;
index b1bb252c1eeb6d0a4d15a51f591dd4d1248f4655..7c7feca2e3eed563c4e3f38e89b6144aa783bef0 100644 (file)
@@ -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";;
index 005f191c5bf49aa072a363511e937cfda78be9d6..e036c2f0f2c74d478baec0bfda789ab1489a9c87 100644 (file)
@@ -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";;