This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC v6 12/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, joseph at codesourcery dot com, palmerdabbelt at google 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: Sun, 12 Jan 2020 02:34:03 -0800
- Subject: [RFC v6 12/23] RISC-V: Add path of library directories for the 32-bit
- Ironport-sdr: 9VFGB5t5y/jmm4sTJ+69drI39fWqHpy4Q1H905NpEpgOQu6OC1yZSAIbWPL+a2eUosMpuN9iAJ NcdYT34pf6V0tVHsIS5npH3BgGKnRmN0uZk1iTNNfUOJ0sq3gFvUhxGyb0Lg4SDDdtWipG5fI7 BwWx9oLmsdHyLZ5FJgu+YuYUuF6P0rZG0ZEwzXfBGJ2pQqbGsicLSZ9C9Z8tzeVFzG5EpXnLyG FLhPdkWroN/Ycc3U5DUOhCe0gGtCofbXfdVRcEQU+CopDzdA7cKBF4J5B/zr1srqa8/oOCR9Z0 txE=
- Ironport-sdr: 4xweMXOxKsLxg48bXSk5feW92ZT33Cf+X/TU5zsdScBuo9l4HVEbfGV3tFD6TVTpbsjqh7OXbC Mg4dtpkPGv93Dv+C1j/bURAOYrKfcJHfwG8RIHSQ1Ks/qWyGhgIJefjCE/Ruhz8tzLSSyZLrzF oo71hxoQipk4Mj0L3Xdso4Hui/VXyi5ub3hn4a7801GaLjoOzhMIR5OxjrT5KsMcRswv4P6w0q ZNJnkosmPgfqBUnU1Gz/pHEIx1Ati+zwq5zhNXY25SJdzOs/IYVq+CwkUXHlZc0x7DN6wjWhOh djvWdsfiKrcJh3PsyW6nk+bZ
- Ironport-sdr: DpYEesnoClRh2Utku21F0re55PC430uT2iojcKzdoYSZ5HaCu3PFztx7UwCqGiPzenN2Ge8g8S 6AQEDPLvVq4PobTtFBInJZoTw+yetv0OLJtYD66Yg69DXqxsk7VU+/1qH2LBN9/b1nfQDHzyz8 ufAt71YFF+1ef8G6VeNo54tj+1uFGzzPq9MjJcYtPpFbrn4ZZ4ro5dphD3sh0q0ljX9TXP6wW0 8WLKalRdcQZn2uqtYpBjG81IvDpEKAssPixl6LVGgY21cH4U/ffH2qWFSKYzDTsgNoyK6rLuF7 QWA=
- References: <cover.1578824547.git.alistair.francis@wdc.com>
- Wdcironportexception: Internal
From: Zong Li <zongbox@gmail.com>
For the recommand of 64 bit version, we add the libraries path of 32 bit
in this patch.
The status of RV32 binaries under RV64 kernels is that the ISA
optionally supports having different XLEN for user and supervisor modes,
but AFAIK there's no silicon that implements this feature, and the Linux
kernel doesn't support it yet.
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.
---
sysdeps/unix/sysv/linux/riscv/dl-cache.h | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/riscv/dl-cache.h b/sysdeps/unix/sysv/linux/riscv/dl-cache.h
index c297dfe84f..60fc172edb 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.24.1