This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC v3 15/23] RISC-V: Add path of library directories for the 32-bit
- 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: Tue, 16 Jul 2019 17:09:20 -0700
- Subject: [RFC v3 15/23] RISC-V: Add path of library directories for the 32-bit
- Ironport-sdr: m0+uiIVsE1dUgUhTTVdLMhGuBllmoT0J2zUSXpIs4YlE1gRWCCE1Nb+3vnKa2EebIWaXnfs8oZ R0m8dJLsxu6lkrPgpRq/WPn7QLuhROsFmO4B9drDeFDiUpmDkuGcGRQmlpcN32j2b4IrSDe89o 1dawZmftnJokTZtcmVkIdMsL5UBuml37QW6Us2B2cBmO4xYIsgJ9a/wNyH5nFynq4Ml3x0Rxck YoceTBBAKPcS2WVnhoIDSN8Cn1/JdsJt4F1vKawHKi0AiWTMgBNlzrYwIoHSRu1IpNLFvJIpw+ EzE=
- Ironport-sdr: wIWlLsAGgtDIKjMo9i8GN5Xgb73ik325pOnUJpPst9rCfperbOqvdMC8ZqxXmCqLal/5EWeXbw 1EWI2CRamfO5ndqHKH6kaz4u3cq3/Y/kGnZW2K1EjOlY0IPONT4p92rk6MOTdm+7DEbmaol4In qO/vvAVrJWaYGHhE1Jw+2p7H6ZbVh0PpcqqVPcPy9M8KUVzTT8PTzzZUucQSmtNCJA2mokf3nM 191Ol+MvmhPsJZq1eAsGSiJ5gu2EDAOCCTLJbXWl4U/jSveAIz1VrJoK54KN3zEGj39tgHrUBk IEhbpz2NN7Dd8CJKpCQ0vOHR
- Ironport-sdr: Aw/sqYvTEGf3LRNLwiI8HGrmY6P9k9xkB7wJHyccSGLPCRkChHVc8w4lR9EM1Dse53cv+Z1Qqc wm3+xTWCB+hyKTdGMo9a8hs6jiF/ACLDOnt7yzD3qf6aYQm5wmDvp1OjnO1ZEdt6UKwOEM413h 7gP3dL90YHFGdDmI4hc+QJPFwRdQ/xeHyPDW/KAPgpB4Nm45lyJcUYbMfYmlITwsIOC4rqCI68 v4qw0I9DSK+P0IPOJ3XlC9hbnDyPB2eYRBfcrMKUN10EMYO58bp8IY7PSIjjNPRFLlKZj5Rops nTg=
- References: <cover.1563321715.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 | 3 +++
sysdeps/unix/sysv/linux/riscv/dl-cache.h | 17 +++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 940db8b92e..4155ead682 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1040,6 +1040,9 @@
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/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 2a15e28e3b..5943060536 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