public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bmeng.cn at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug driver/110478] New: RISC-V multilib gcc zicsr in the -march causing incorrect libgcc to be used
Date: Thu, 29 Jun 2023 08:02:49 +0000	[thread overview]
Message-ID: <bug-110478-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 110478
           Summary: RISC-V multilib gcc zicsr in the -march causing
                    incorrect libgcc to be used
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bmeng.cn at gmail dot com
  Target Milestone: ---

Using the prebuilt toolchain from kernel.org to test this.

$ cd /tmp
$ wget
https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-riscv64-linux.tar.xz
$ tar xf x86_64-gcc-13.1.0-nolibc-riscv64-linux.tar.xz
$ cd /tmp/gcc-13.1.0-nolibc/riscv64-linux/bin
$ ./riscv64-linux-gcc -march=rv64gc -mabi=lp64 -print-libgcc-file-name
/tmp/gcc-13.1.0-nolibc/riscv64-linux/bin/../lib/gcc/riscv64-linux/13.1.0/lib64/lp64/libgcc.a
$ ./riscv64-linux-gcc -march=rv32gc -mabi=ilp32 -print-libgcc-file-name
/tmp/gcc-13.1.0-nolibc/riscv64-linux/bin/../lib/gcc/riscv64-linux/13.1.0/lib32/ilp32/libgcc.a

$ ./riscv64-linux-gcc -march=rv64gc_zicsr -mabi=lp64 -print-libgcc-file-name
/tmp/gcc-13.1.0-nolibc/riscv64-linux/bin/../lib/gcc/riscv64-linux/13.1.0/libgcc.a
$ ./riscv64-linux-gcc -march=rv32gc_zicsr -mabi=ilp32 -print-libgcc-file-name
/tmp/gcc-13.1.0-nolibc/riscv64-linux/bin/../lib/gcc/riscv64-linux/13.1.0/libgcc.a

As you can see from above, without "zicsr" in the "-march", the libgcc path
correctly reflects its multilib configuration, i.e.: 64-bit will link the
libgcc.a in the lib64 sub-directory.

But with "zicsr" in the "-march", the libgcc path is always the non-multilib
version.

The toolchain was configured by:

$ ./riscv64-linux-gcc -###
Using built-in specs.
COLLECT_GCC=./riscv64-linux-gcc
COLLECT_LTO_WRAPPER=/tmp/gcc-13.1.0-nolibc/riscv64-linux/bin/../libexec/gcc/riscv64-linux/13.1.0/lto-wrapper
Target: riscv64-linux
Configured with: /home/arnd/git/gcc/configure --host=x86_64-linux-gnu
--build=aarch64-linux --target=riscv64-linux --enable-targets=all
--prefix=/home/arnd/cross/x86_64/gcc-13.1.0-nolibc/riscv64-linux
--enable-languages=c --without-headers --disable-bootstrap --disable-nls
--disable-threads --disable-shared --disable-libmudflap --disable-libssp
--disable-libgomp --disable-decimal-float --disable-libquadmath
--disable-libatomic --disable-libcc1 --disable-libmpx --enable-checking=release
--with-static-standard-libraries
Thread model: single
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.0 (GCC) 


It seems this multilib bug was introduced when zicsr was introduced to RISC-V
GCC.

             reply	other threads:[~2023-06-29  8:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29  8:02 bmeng.cn at gmail dot com [this message]
2023-06-29  8:07 ` [Bug target/110478] " pinskia at gcc dot gnu.org
2023-06-29  8:25 ` bmeng.cn at gmail dot com
2023-06-29  8:29 ` kito at gcc dot gnu.org
2023-06-29 16:26 ` bmeng.cn at gmail dot com
2023-06-29 22:54 ` palmer at gcc dot gnu.org
2023-06-30 13:44 ` bmeng.cn at gmail dot com
2023-07-31  7:22 ` bmeng.cn at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-110478-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).