aboutsummaryrefslogtreecommitdiff
path: root/ld/emulparams
diff options
context:
space:
mode:
authorJim Wilson <jimw@sifive.com>2018-05-08 13:34:03 -0700
committerJim Wilson <jimw@sifive.com>2018-05-08 13:34:03 -0700
commit10d980882987d8cd9b2e34651faceff29176148b (patch)
tree8bf35a82aead8d16f6f5dee55c44721c5e266557 /ld/emulparams
parent8ee22052f690c007556b97eed59f49350ece5ca9 (diff)
downloadgdb-10d980882987d8cd9b2e34651faceff29176148b.zip
gdb-10d980882987d8cd9b2e34651faceff29176148b.tar.gz
gdb-10d980882987d8cd9b2e34651faceff29176148b.tar.bz2
RISC-V: New emulations to make path searches follow glibc ABI.
ld/ 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.
Diffstat (limited to 'ld/emulparams')
-rw-r--r--ld/emulparams/elf32lriscv.sh13
-rw-r--r--ld/emulparams/elf32lriscv_ilp32.sh14
-rw-r--r--ld/emulparams/elf32lriscv_ilp32f.sh14
-rw-r--r--ld/emulparams/elf64lriscv-defs.sh11
-rw-r--r--ld/emulparams/elf64lriscv.sh13
-rw-r--r--ld/emulparams/elf64lriscv_lp64.sh14
-rw-r--r--ld/emulparams/elf64lriscv_lp64f.sh14
7 files changed, 82 insertions, 11 deletions
diff --git a/ld/emulparams/elf32lriscv.sh b/ld/emulparams/elf32lriscv.sh
index aac08e7..e91f884 100644
--- a/ld/emulparams/elf32lriscv.sh
+++ b/ld/emulparams/elf32lriscv.sh
@@ -1,2 +1,15 @@
+# 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
diff --git a/ld/emulparams/elf32lriscv_ilp32.sh b/ld/emulparams/elf32lriscv_ilp32.sh
new file mode 100644
index 0000000..ec676bc
--- /dev/null
+++ b/ld/emulparams/elf32lriscv_ilp32.sh
@@ -0,0 +1,14 @@
+# 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
diff --git a/ld/emulparams/elf32lriscv_ilp32f.sh b/ld/emulparams/elf32lriscv_ilp32f.sh
new file mode 100644
index 0000000..63304f9
--- /dev/null
+++ b/ld/emulparams/elf32lriscv_ilp32f.sh
@@ -0,0 +1,14 @@
+# 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
diff --git a/ld/emulparams/elf64lriscv-defs.sh b/ld/emulparams/elf64lriscv-defs.sh
index 6308714..930f333 100644
--- a/ld/emulparams/elf64lriscv-defs.sh
+++ b/ld/emulparams/elf64lriscv-defs.sh
@@ -1,13 +1,2 @@
. ${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
diff --git a/ld/emulparams/elf64lriscv.sh b/ld/emulparams/elf64lriscv.sh
index 3a6a652..f0a10ab 100644
--- a/ld/emulparams/elf64lriscv.sh
+++ b/ld/emulparams/elf64lriscv.sh
@@ -1,2 +1,15 @@
+# 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
diff --git a/ld/emulparams/elf64lriscv_lp64.sh b/ld/emulparams/elf64lriscv_lp64.sh
new file mode 100644
index 0000000..80a8f82
--- /dev/null
+++ b/ld/emulparams/elf64lriscv_lp64.sh
@@ -0,0 +1,14 @@
+# 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
diff --git a/ld/emulparams/elf64lriscv_lp64f.sh b/ld/emulparams/elf64lriscv_lp64f.sh
new file mode 100644
index 0000000..8f86421
--- /dev/null
+++ b/ld/emulparams/elf64lriscv_lp64f.sh
@@ -0,0 +1,14 @@
+# 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