From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AED6E385734B; Fri, 18 Aug 2023 13:31:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AED6E385734B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692365502; bh=PjVXbh17+wvu7uBUeacHRMXdY8aSebllfuvW+Vp9hH0=; h=From:To:Subject:Date:From; b=IsyCi2GKXWCMg3TIGZ11BreUDcL74JwokukE6xEkuDoKvpF0+5ZVVmu5WDJ3bGYp7 dKZPN+ouMYyuk4ofpefYl19lOKLV0NGzHthHBSswqNr8swje34a0XSgihTlgUlS0F8 MwULQtzgPcjJ/ExN8zcQ9u+kSi90yxu82kW+Z6eg= From: "tommy_murphy at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111065] New: [RISCV] t-linux-multilib specifies incorrect multilib reuse patterns Date: Fri, 18 Aug 2023 13:31:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: og13 (devel/omp/gcc-13) X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tommy_murphy at hotmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111065 Bug ID: 111065 Summary: [RISCV] t-linux-multilib specifies incorrect multilib reuse patterns Product: gcc Version: og13 (devel/omp/gcc-13) Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: tommy_murphy at hotmail dot com Target Milestone: --- The file gcc/config/riscv/t-linux-multilib: * https://github.com/gcc-mirror/gcc/blob/master/gcc/config/riscv/t-linux-mult= ilib specifies the RISC-V multilibs to be built when --enable-multilib is passed= at configuration time: * https://github.com/riscv-collab/riscv-gnu-toolchain#installation-newliblinu= x-multilib It also specifies multilib reuse patterns. These control what (if any) mult= ilib is (re)used when an arch/abi is specified at compile time (using -march=3D.= .. -mabi=3D...) for which no specific multilib exists. For example: * rv64imafdc-lp64d-rv64imafd- This specifies that the multilib for rv64imafdc/lp64d be built at toolchain build time, and that it also be (re)used for the arch/abi rv64imafd/lp64d w= hen -march=3Drv64imafd -mabi=3Dlp64d is passed at compile time. In this case this reuse mapping will lead to problems if the target platform (hardware, simulator etc.) strictly supports rv64imafd/lp64d but libraries/startup code for rv64imafdc/lp64d are linked. This is because the latter will most likely use RISC-V compressed instructions (via the RISC-V optional C/Compressed extension) which the rv64imafd/lp64d target will not support and will trap on.=20 Multilib reuse mappings should always be from an arch/abi "superset" to a "subset" of extensions. For example: * reusing rv64imafd/lp64d for a rv64imafdc/lp64d target is OK - it just doe= sn't take advantage of the C (Compressed) extension * reusing rv64imafdc/lp64d for a rv64imafd/lp64d target is not OK - the libraries will most likely use C (Compressed) instructions which the latter target does not support and will trap on. According to this comment: * https://github.com/gcc-mirror/gcc/blob/35b5762a740d4506d7acac65d0f837564036= 2492/gcc/config/riscv/t-linux-multilib#L2C1-L3C1 This is the list of multilibs/reuse patterns specified: * rv32imac-ilp32-rv32ima,rv32imaf,rv32imafd,rv32imafc,rv32imafdc- * rv32imafdc-ilp32d-rv32imafd-=20 * rv64imac-lp64-rv64ima,rv64imaf,rv64imafd,rv64imafc,rv64imafdc- * rv64imafdc-lp64d-rv64imafd- all of which seem problematic/erroneous because they specify the reuse of libraries with compressed instructions for arch/abi's that do not support t= he C (Compressed) extension. However I am loath to submit a patch because I am not sure what the correct/authoritative list of multilibs and reuse patterns *should be* and = what disturbance may be caused by changing this file. Maybe one of the seasoned RISC-V GCC contributors might be able to comment? Thanks.=