Gentoo Archives: gentoo-dev

From: Palmer Dabbelt <palmer@×××××××.com>
To: dilfridge@g.o
Cc: gentoo-dev@l.g.o, riscv@g.o
Subject: [gentoo-dev] Re: How to structure our RISC-V support
Date: Thu, 06 May 2021 20:16:46
Message-Id: mhng-8918b345-1b54-4d48-9485-abc027224908@palmerdabbelt-glaptop
In Reply to: [gentoo-dev] How to structure our RISC-V support by "Andreas K. Huettel"
1 On Thu, 06 May 2021 13:01:23 PDT (-0700), dilfridge@g.o wrote:
2 > Howdy.
3 >
4 > I'm sending this not only to the team members on the alias, but also
5 > to the whole dev list for discussion.
6 >
7 > So far I've been trying to support in Gentoo the full risc-v multilib
8 > directory structure and the ABI sets supported by glibc. According to
9 > specs this means for riscv64
10 >
11 > -mabi=rv64gc -march=lp64d
12 > libdir = lib64/lp64d
13 > ("hardfloat")
14 >
15 > -mabi=rv64imac -march=lp64
16 > libdir = lib64/lp64
17 > ("softfloat")
18 >
19 > and theoretically similar for riscv32 (which just landed in glibc and
20 > is still broken in qemu-user).
21 >
22 > However, this leads to several levels of pain (and I definitely dont
23 > have time to deal with it myself):
24 >
25 > a) In many places the two-level libdir (e.g., /usr/lib64/lp64d) leads
26 > to difficulties in build systems. Right now Qt5 and CMake are still
27 > somewhat broken (in *Gentoo*).
28 >
29 > b) Rust only supports rv64gc/lp64d. (Which is arguably what you should
30 > have for decent Linux support.)
31 >
32 > I'm pretty sure these are not the only things, but they are somewhat
33 > symptomatic.
34 >
35 > So, I would like to bring two proposals up for discussion.
36 >
37 > 1) We stop caring about anything except rv64gc/lp64d.
38 > People can still bootstrap other stuff with crossdev etc, but the
39 > Gentoo tree and the riscv keyword reflect that things work with above
40 > -mabi and -march settings.
41
42 IMO dropping multilib is fine from a "working on real hardware"
43 perspective, as that's all anyone is going to have for the forseeable
44 future -- at least for the sort of hardware you'd want to run a
45 desktop/server style Linux distro on (something like buildroot might be
46 interested in other ISA/ABI combos).
47
48 That said, it seems like a lot of the distros are punting on multilib
49 because of this path issue. If that's really the worry then I wouldn't
50 be opposed to just fixing it in GCC/glibc. Ideally we'd be able to just
51 add paths so we don't break the ABI, but if the ABI we came up with
52 really hasn't been used by anyone then I wouldn't be opposed to breaking
53 it if it means we can actually get multilib up and running -- we'd have
54 to talk with a lot of people for that, though.
55
56 In the long run I think we will want multilib to work, as we're likely
57 to end up with some ISA extensions that are useful enough to want to
58 build general code for but not so useful that everyone has them -- B and
59 V, for example. We're a long way away from having good code gen for V
60 (at least for arbitrary code, some special libraries might show up
61 sooner), but B is a bit closer and might be amenable to having a system
62 built with it. That may be a bit less interesting for Gentoo, where
63 we're building things locally (and there shouldn't be any -bin packages
64 on RISC-V yet, we're not getting ports of proprietary stuff yet), but if
65 we can be a forcing function to put together a multlib ABI that actually
66 works then that's a win for everyone.
67
68 > 2) We drop the multilib paths and use "normal" lib64, with additional
69 > "safety symlinks" (/usr)/lib64/lp64d -> .
70 > This is what SuSE and (I think) Fedora already does. The symlink
71 > should be there since "lib64" is NOT an official fallback coded into
72 > gcc/glibc/binutils; the only fallback present is "lib" ...
73
74 IMO we can just fix that one upstream. If all the distros are going to
75 do it anyway then it'd be better to just fix it, there's not a lot of
76 sense in forcing everyone to patch these things. IIUC that one would be
77 an ABI-compatible addition, but again we'd need to talk about it in
78 GCC/glibc land (and with some other distro folks).
79
80 Sorry this is such a mess!