From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2101) id 115553938C18; Sun, 26 Apr 2020 02:25:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 115553938C18 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alistair Francis To: glibc-cvs@sourceware.org Subject: [glibc/alistair/rv32.next] RISC-V: Add path of library directories for the 32-bit X-Act-Checkin: glibc X-Git-Author: Zong Li X-Git-Refname: refs/heads/alistair/rv32.next X-Git-Oldrev: 83909c183785ba509bbfa3537ee4f0226c7e06bb X-Git-Newrev: 08f88cc98ee77a7c7ad94107bc20bfaf3817a646 Message-Id: <20200426022538.115553938C18@sourceware.org> Date: Sun, 26 Apr 2020 02:25:38 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 02:25:38 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=08f88cc98ee77a7c7ad94107bc20bfaf3817a646 commit 08f88cc98ee77a7c7ad94107bc20bfaf3817a646 Author: Zong Li Date: Fri Nov 30 17:15:44 2018 +0800 RISC-V: Add path of library directories for the 32-bit 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. Diff: --- 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); \