From: "Andreas K. Hüttel" <dilfridge@gentoo.org>
To: libc-alpha@sourceware.org
Subject: RISC-V 64bit and 32bit binaries on the same system
Date: Mon, 07 Sep 2020 16:32:39 +0300 [thread overview]
Message-ID: <7023981.W097sEU6C4@farino> (raw)
[-- Attachment #1: Type: text/plain, Size: 2846 bytes --]
Hi all,
as you probably know, the gcc multilib settings for riscv build and install 4
ABI (rv64/lp64d, rv64/lp64, rv32/ilp32d, rv32/ilp32). Now that rv32 support is
in glibc, I gave this a try (*) in qemu-user.
gcc and glibc build and install fine. However, there's a fundamental problem
with this configuration. ld.so does not filter by ELFCLASS (as it does, e.g.,
for x64-64 vs i686), and the order of directories in the dynamic linker config
determines e.g. which libstdc++ a binary sees first. [#]
Which means, either rv32 or rv64 binaries will terminate with a "wrong
ELFCLASS" fatal error.
Now, what to do?
* Introduce a special cache flag as for x86-64 FLAG_X8664_LIB64?
* Make ld.so ignore wrong-ELFCLASS binaries instead of producing an error?
(Same result handled at different point...)
* Propose to change the gcc multilib profiles so we don't pretend that this
works?
Cheers,
Andreas
(*) I know that there is no real hardware that can run both rv64 and rv32 at
the moment. However, it would be useful for me to bootstrap different single-
ABI environments.
[#]
(riscv-main chroot) farino /lib # ldconfig -p|grep c++
libstdc++.so.6 (libc6,double-float) => /usr/lib/gcc/riscv64-unknown-
linux-gnu/10.2.0/lib64/lp64d/libstdc++.so.6
libstdc++.so.6 (libc6,double-float) => /usr/lib/gcc/riscv64-unknown-
linux-gnu/10.2.0/lib32/ilp32d/libstdc++.so.6
libstdc++.so.6 (libc6,soft-float) => /usr/lib/gcc/riscv64-unknown-
linux-gnu/10.2.0/lib64/lp64/libstdc++.so.6
libstdc++.so.6 (libc6,soft-float) => /usr/lib/gcc/riscv64-unknown-
linux-gnu/10.2.0/lib32/ilp32/libstdc++.so.6
libstdc++.so (libc6,double-float) => /usr/lib/gcc/riscv64-unknown-
linux-gnu/10.2.0/lib64/lp64d/libstdc++.so
libstdc++.so (libc6,double-float) => /usr/lib/gcc/riscv64-unknown-
linux-gnu/10.2.0/lib32/ilp32d/libstdc++.so
libstdc++.so (libc6,soft-float) => /usr/lib/gcc/riscv64-unknown-linux-
gnu/10.2.0/lib64/lp64/libstdc++.so
libstdc++.so (libc6,soft-float) => /usr/lib/gcc/riscv64-unknown-linux-
gnu/10.2.0/lib32/ilp32/libstdc++.so
versus
farino ~ # ldconfig -p |grep c++
libstdc++.so.6 (libc6,x86-64) => /usr/lib/gcc/x86_64-pc-linux-gnu/
9.3.0/libstdc++.so.6
libstdc++.so.6 (libc6) => /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/32/
libstdc++.so.6
libstdc++.so (libc6,x86-64) => /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/
libstdc++.so
libstdc++.so (libc6) => /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/32/
libstdc++.so
libnetcdf_c++.so.4 (libc6,x86-64) => /usr/lib64/libnetcdf_c++.so.4
libnetcdf_c++.so (libc6,x86-64) => /usr/lib64/libnetcdf_c++.so
--
Andreas K. Hüttel
dilfridge@gentoo.org
Gentoo Linux developer
(council, qa, toolchain, base-system, perl, libreoffice)
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 963 bytes --]
next reply other threads:[~2020-09-07 13:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-07 13:32 Andreas K. Hüttel [this message]
2020-09-07 16:56 ` Joseph Myers
2020-09-07 17:05 ` Andreas K. Hüttel
2020-09-09 4:22 ` Palmer Dabbelt
2020-09-09 19:49 ` Andreas K. Hüttel
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=7023981.W097sEU6C4@farino \
--to=dilfridge@gentoo.org \
--cc=libc-alpha@sourceware.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).