This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC v5 14/21] 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: Thu, 29 Aug 2019 09:50:38 -0700
- Subject: [RFC v5 14/21] RISC-V: Add path of library directories for RV32
- Ironport-sdr: rJY6bsnIqRNQyhmDpJSw7Dyg1sIJmm+gi3m+zuGyyOC9ajc9KggFDfSuLK6ZAHR+30t6jdgeuD eXBpzWBe78pjCid/qCkuNb5AlZqdWnWaBkykoWjA4JPF6B92gKy0CfdrxFzcfJ/MdWShvwCgg4 EScY7qlnilZSz9I8NomcFDuZOUZMY5oC/LyoEhPvnJRTXq84YWNFxIkNBBejSWcRkugk3bwT5s g81TjePsqyZ0J6fC2y8oE0d+x10acPtm+WyZBY3D/OM4sI4H1yVm2U5/PMhGaumjMY2TE+nZy5 7kg=
- Ironport-sdr: AazZ1CvnkMf3M9Dr/GozfXwCLlKiLMyMNUT6mFMXasUXtk6TNdckDI5/ly01d2vjbE5wGSU8Hf 8rBXpC1+6pM6olX7mp5OzhO5mQsFoFx6axjEtV8nM7fZekfg3Jgp4oBVyjmr6Oa8M14+WceLIL PTmDA+gVwn732JgH5NDiwwzeOEw+57pQjOIsLPm99zMgtZ6RQXjOBqBOfwOzcr862L0k0IDwd0 Qk29JwYOtAT721EE4HOd22MJD/M4lR6V97KZ1tbxAn6k5Gh8beQ3dX9bfCAhMt1G8kCKlY9NlR I06S2XRw/XIsD+bqrir3ZTP9
- Ironport-sdr: hAWy4Sn1NUo1R7buAqNCzhLY+Q1WH8PfoFXD+JHi62tH67Fc3cFoU0wUgv93rpqdaS+RB50VYR ZIuEo4gu+x+EOkBs1MN7hapj3IQXsmVtSKMQSfCLoWCuVEgQyBimabuMoyAVWfbFJ1+2ScHC1l w+ngB7m77EuSwI3oFFtQV4/93QDediYY1RtHzs0djJ+rsSSor3WWCZx+bo37r0Ey/eKhEwvYgE x7MbKrLRc/B8cXPhjBacEaPZJFyndcVAUMkvSYGEus6FYMkT40p0B2WbKN/FoQbbfrx2Fxpl1v KAA=
- References: <cover.1567097252.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. 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>
---
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 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