From patchwork Thu Apr 2 16:29:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38713 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by sourceware.org (Postfix) with ESMTPS id E3DD5388B803 for ; Thu, 2 Apr 2020 16:37:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E3DD5388B803 IronPort-SDR: 6IaA41idLyXUxUeJnI09DGscXh+7OH/DP+dVd2S5GYQj/D34S5WDQ59q8TkK/ytrAS2Mqfv4Vd 9psnd2MVosDlv1qHa6o5lsDap5qUl3dvNn7p3eKQkJ58a9gmcJ1UC3fqf+hsFQCJNIMH4c0p7b S8yZ4061PGMBLAoXQWvnpg9e4LbJWYPwKHlmog6EPH8hRgBMiL285Ba0Y4eGeJirf0EHnIFYUR NIwsNgUqRoMw5s4X7r7C15DNVvk6RkL6NyshnPveIbyZ11H+NLu+ptHc0UXVmeYVvgj1oTS/j3 RGU= X-IronPort-AV: E=Sophos;i="5.72,336,1580745600"; d="scan'208";a="134426331" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Apr 2020 00:37:26 +0800 IronPort-SDR: m0F02wZ2PvH84zzQfd7fA7vhwLdrceBmCijUs4C4aSaqfcE19kVMsUO+M7VdFL+Y6OJoSt0n95 cemmZPjR+mJW6fZYNlTR+tIL6bs6S2VVO7+v6o5Jrb8mDg+pZgSLYxZPoGCoZEMO/0BR2nsZ2E cia02U8KBS9IvgsUf2dFn75F435cKBqlk9V6HIY/H0hGgD3jkqnTKRxO3KOhXb1K438Ot5PpKG WXsBM1FhrnN2mUwxOg3EBvz8iIL3f1sW5q2Pzffy+OO7H4Nuev/JV+u+/5aLBqyojIkaoqBvF9 HH6SPBhp2uILzkTvllg2j8zE Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 09:28:18 -0700 IronPort-SDR: sLbzi1klEZjLkxr/Am5h+RCddpaSbDqaF+tNfX/dzjx6z2u1eodt49eYDme77Yw/DrUfg6Vxkl dRKjp5/nl8h6+3/PgXF5BveA92bXMK1b/RAvIwGe22z7Pru1PJQsMWIiTXdXupLea7CwtZpGpU G+s4WkZtZVvJjrYfpsWYdD5VSt1cC4Tua5b8yjZeGc/9IzSaZYgvZG0LzWiPysCN1rUpoHZQhI N0vJMmtjw14FLno8tUKoIwZBbIXnvhUEv2eyIqsyEOwEH1oR7g04HGmE6sPI3C8N6/N02ZQW44 aM4= WDCIronportException: Internal Received: from phd004806.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.43]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Apr 2020 09:37:26 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Zong Li Subject: [PATCH 06/18] RISC-V: Add path of library directories for the 32-bit Date: Thu, 2 Apr 2020 09:29:36 -0700 Message-Id: <20200402162939.358617-7-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200402162939.358617-1-alistair.francis@wdc.com> References: <20200402162939.358617-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-26.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2020 16:37:34 -0000 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); \