From patchwork Tue Jun 25 00:09:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 33382 Received: (qmail 21880 invoked by alias); 25 Jun 2019 00:11:55 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 21803 invoked by uid 89); 25 Jun 2019 00:11:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: esa6.hgst.iphmx.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1561421514; x=1592957514; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YGqWhWI5xQiV4T35tMoRv2UQIvO38vYLL9RXX9CavSE=; b=CkcGXFElQgPAhHV5TahtmLJQjViYpuqW91PEPpKd6iW1XyiLbtf9jjXs QJ1Gmol7WiJh50Wok8zq9gw/v8ClwT8czBPKM6omQLsWqR/255/xuxwHM 1aewvX964ZcqpLG9+uQPH2T+MuVvZQth2OesW65Z5sRN8DUFtD8dLODI1 d2dmNBdTIxz/jfR6Z4rmEzOEtzIYFyICL7IcQkpfK2fESJNeFj3+/ga4N oludVQEdfdDMKfCG86710DQWLKHYFs1dkzwk8ANU9c5LwRSjgPrex5lEK VAZuqxtlO86z7O90y14FgsIozYHpjnRyv3FKFYXP5Q+8v9S8S22urnyNx w==; IronPort-SDR: cyA20KXNDuyt63cLkckl7j5ION9CbWr2oLA7zKtMhVs+T3fp+y8ba2jFVlaPG1ofyNQF0gvSV/ fKhupchJ7YsPpkDLm/81vIrxYYD+oLdYIIa594QeKhe/a974E7SE4jZtRsOzUrNux3447t2RgS bj4cak8E+3gMsdA5c0M3YVfTo7nIxlT7qAj1blm4W22edru9TmJT/cCIcdjkWkgSOJv3+angai MrNc8IDS9ISn5H3Gzalmjlts6MGiJQIcJ6b2ITu2e9scIT/n8lVMyleRNq61HZRtsQOGXYwu9q uMtlDNKe8rMkpaPIdgpR9cE5 IronPort-SDR: OccCV4bG+muJgMP5K+5lpXq5BbqKL6GXYHkWAmZoLGL0UGDKTy6nz060OlOsXUzbD8dyVtHuN6 BmOFKPdqL9AIa64KAoKwiGpRLmycJi1trZcctkjp6wKumi8Ajo29hg8CGuXv1H6ONx0otmBRyW OCDuaRIoXrUSNEKB4Y9iL0GaXvaIdg3qcwet11K8G7x2v/c8jjB73LrV5wLioJJd1yWKl+exT/ D0lkV8rirW2KsVGTwS7UQHJFg6bivh4XniFTXQmbF1aNhGvlJM5dxW6Btj/ZdqDtg492SOhIDa 6q4= From: Alistair Francis To: libc-alpha@sourceware.org Cc: arnd@arndb.de, adhemerval.zanella@linaro.org, fweimer@redhat.com, palmer@sifive.com, macro@wdc.com, zongbox@gmail.com, zong@andestech.com, alistair.francis@wdc.com, alistair23@gmail.com Subject: [RFC v2 13/20] RISC-V: Add path of library directories for the 32-bit Date: Mon, 24 Jun 2019 17:09:23 -0700 Message-Id: <3b677e30c9c3638bfe3d4fc16a76ca5d2a71f7d9.1561421043.git.alistair.francis@wdc.com> In-Reply-To: References: MIME-Version: 1.0 From: Zong Li 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 * 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 --- 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 2a752ae444..73d07ab159 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,9 @@ 2018-06-20 Zong Li * 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 Florian Weimer 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); \