From patchwork Sun Jan 12 10:34:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 37320 Received: (qmail 12619 invoked by alias); 12 Jan 2020 10:40:33 -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 12398 invoked by uid 89); 12 Jan 2020 10:40:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 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=supervisor, silicon 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=1578825630; x=1610361630; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MGWk5K6IJcJp+Lh7w4VDNExwzzlYXDwxLB4Wh9ukQUU=; b=CC28VWXPuV7ea0OIUgXDiPY/ZKHHcW75QpFIK5Cw0i1poTjo3b1YiWuP gXwblYdooNOJ7JLZ96CN/UfIvd1muSFwLH9XBg6LzFj0rjCVrqqXNFQcG HTn0G4L/EV0Z6t9g3l6g2tbx7ug9FpZLHQSOtpaT37M4m4fCiK+7Z820m 0D5gej/RfMkgjz4vqaed3ZWNqbWQR07ravrcaHVwRHimLCzbURMPZUISl kra0IE+MdO4kHljPqqJ+r1WfExwdLantWQN86dVSm9/8Gqy/tDe8MhaMv gDIgEqNCGXJMPMjyvwqdzCeGItu02sMe2YlbH08yicSgVvd8Kt4eev4wS w==; 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= WDCIronportException: Internal From: Alistair Francis To: libc-alpha@sourceware.org Cc: arnd@arndb.de, adhemerval.zanella@linaro.org, fweimer@redhat.com, joseph@codesourcery.com, palmerdabbelt@google.com, macro@wdc.com, zongbox@gmail.com, alistair.francis@wdc.com, alistair23@gmail.com Subject: [RFC v6 12/23] RISC-V: Add path of library directories for the 32-bit Date: Sun, 12 Jan 2020 02:34:03 -0800 Message-Id: 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. 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); \