This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC v4 15/24] RISC-V: Add path of library directories for RV32
- From: Alistair Francis <alistair dot francis at wdc dot com>
- To: libc-alpha at sourceware dot org
- Cc: arnd at arndb dot de, adhemerval dot zanella at linaro dot org, fweimer at redhat dot com, palmer at sifive dot com, macro at wdc dot com, zongbox at gmail dot com, alistair dot francis at wdc dot com, alistair23 at gmail dot com
- Date: Fri, 9 Aug 2019 18:00:27 -0700
- Subject: [RFC v4 15/24] RISC-V: Add path of library directories for RV32
- Ironport-sdr: ANivcRtE+YyFLKg29KPvmThU8V/cBZ8I1ZMneQ03RJn+hPdNnueg+EKewi9MG/nkKUolYlluZN +07LbVinVzYZySZvPL+zCe2Zkwh5W54B43ywsPhncCoctBueEdUI6Q42cikiCNKNTEMuQJE9/3 a6OJZ5KuMOT7Bs6UlWIpZf09d14y3lvau8rRiEgde9P9t0v2Fw2gNFTQ2x7brbfHYah/fLs+Jx X3nx3symRTOxS5yKpLjY+i/Z7goP7TK4rmiZS0Cg9iBWWvje842JRqtz4yKz+/MTS6GWVQn9SX bnw=
- Ironport-sdr: 5zkzVUU/kKifY6At/SA1BvqNYQzflzroSRySZVi1DluDkzq3af0+mnBabj8fH0FhmvTQpF2fOh dy4QV0rXe3ljJJYzoXxY0RXuUxqc4R97IizYmEHgRimHJhj9pb3spcWAPWGPBho74D8KdxslXT bEa6StWzWapNMJKu5WQMDB/JmKMy6SxEDsieQYxb+txfGqO08kIOp3aZ6/P1F9Fpz25t+cgQRp KSy6Q5iuNKOzmw/iWLts5NzWO6pwjGrHCTue7i20Lx/7DaV6Bcoex0cCV9G2IOJtZpn/S6tdCm a1KbZK1aJOaW3xDIBDaIEGIy
- Ironport-sdr: VfwNA26JRu0QiUz2vufHG+bhIldGlZCL+ewfHh5n4zIB/kf+DPb3htyFNW+DJQWCGjAh2lg+BU pQ26oyMayColL19uBf8hn/tyZI6pMpBOuZuglpuKDyWPAEr8eFhQpI6+DhoHDxc0gEBaX6hfg7 BWLj+QdvZ1rBO+I2zeDDdb5cOcDQHqymoQAgPL3J7iO85efGU60ojxszSux+Yt2iC3heJCLYjy nHTnROwHgCCjWuPTLA5/GvxrIx/DAwUuj70CPe+ZZwiVVDn94DKRU4W196rViUB5BW1IXFA5SO AZ8=
- References: <cover.1565398513.git.alistair.francis@wdc.com>
From: Zong Li <zongbox@gmail.com>
For the recommand of 64 bit version, we add the libraries path of 32 bit
in this patch. This includes a fix to avoid an out of bound array check
when building with GCC 8.2.
2018-11-29 Zong Li <zong@andestech.com>
* sysdeps/unix/sysv/linux/riscv/dl-cache.h (add_system_dir): Add
libraries path for rv32.
[ Changes by AF:
- Fix bound array check when building with GCC 8.2
]
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
ChangeLog | 2 ++
sysdeps/unix/sysv/linux/riscv/dl-cache.h | 17 +++++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c3ddcfaf9d7..cc9526ee7ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1436,6 +1436,8 @@
2018-06-20 Zong Li <zong@andestech.com>
* sysdeps/unix/sysv/linux/riscv/ldconfig.h (LD_SO_ABI): Support rv32.
+ * sysdeps/unix/sysv/linux/riscv/dl-cache.h (add_system_dir): Add
+ libraries path for rv32.
2019-06-20 Dmitry V. Levin <ldv@altlinux.org>
Florian Weimer <fweimer@redhat.com>
diff --git a/sysdeps/unix/sysv/linux/riscv/dl-cache.h b/sysdeps/unix/sysv/linux/riscv/dl-cache.h
index 2a15e28e3bd..5943060536d 100644
--- a/sysdeps/unix/sysv/linux/riscv/dl-cache.h
+++ b/sysdeps/unix/sysv/linux/riscv/dl-cache.h
@@ -34,6 +34,8 @@
RISC-V, libraries can be found in paths ending in:
- /lib64/lp64d
- /lib64/lp64
+ - /lib32/ilp32d
+ - /lib32/ilp32
- /lib (only ld.so)
so this will add all of those paths.
@@ -49,9 +51,16 @@
do \
{ \
size_t len = strlen (dir); \
- char path[len + 9]; \
+ char path[len + 10]; \
memcpy (path, dir, len + 1); \
- if (len >= 12 && ! memcmp(path + len - 12, "/lib64/lp64d", 12)) \
+ if (len >= 13 && ! memcmp(path + len - 13, "/lib32/ilp32d", 13)) \
+ { \
+ len -= 9; \
+ path[len] = '\0'; \
+ } \
+ if (len >= 12 \
+ && (! memcmp(path + len - 12, "/lib32/ilp32", 12) \
+ || ! memcmp(path + len - 12, "/lib64/lp64d", 12))) \
{ \
len -= 8; \
path[len] = '\0'; \
@@ -64,6 +73,10 @@
add_dir (path); \
if (len >= 4 && ! memcmp(path + len - 4, "/lib", 4)) \
{ \
+ memcpy (path + len, "32/ilp32d", 10); \
+ add_dir (path); \
+ memcpy (path + len, "32/ilp32", 9); \
+ add_dir (path); \
memcpy (path + len, "64/lp64d", 9); \
add_dir (path); \
memcpy (path + len, "64/lp64", 8); \
--
2.22.0