public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/111065] New: [RISCV] t-linux-multilib specifies incorrect multilib reuse patterns
@ 2023-08-18 13:31 tommy_murphy at hotmail dot com
  2023-08-18 14:41 ` [Bug target/111065] " kito at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: tommy_murphy at hotmail dot com @ 2023-08-18 13:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111065

            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-multilib

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-newliblinux-multilib

It also specifies multilib reuse patterns. These control what (if any) multilib
is (re)used when an arch/abi is specified at compile time (using -march=...
-mabi=...) 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 when
-march=rv64imafd -mabi=lp64d 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. 

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 doesn'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/35b5762a740d4506d7acac65d0f8375640362492/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- 
* 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 the 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-12-31 17:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-18 13:31 [Bug target/111065] New: [RISCV] t-linux-multilib specifies incorrect multilib reuse patterns tommy_murphy at hotmail dot com
2023-08-18 14:41 ` [Bug target/111065] " kito at gcc dot gnu.org
2023-08-18 16:04 ` tommy_murphy at hotmail dot com
2023-08-18 16:11 ` palmer at gcc dot gnu.org
2023-08-18 16:27 ` kito at gcc dot gnu.org
2023-08-18 21:09 ` tommy_murphy at hotmail dot com
2023-08-19 16:32 ` tommy_murphy at hotmail dot com
2023-12-31 17:43 ` tommy_murphy at hotmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).