public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* RISC-V 64bit and 32bit binaries on the same system
@ 2020-09-07 13:32 Andreas K. Hüttel
  2020-09-07 16:56 ` Joseph Myers
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas K. Hüttel @ 2020-09-07 13:32 UTC (permalink / raw)
  To: libc-alpha

[-- 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 --]

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

end of thread, other threads:[~2020-09-09 19:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07 13:32 RISC-V 64bit and 32bit binaries on the same system Andreas K. Hüttel
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

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).