Re: Introduction + interest in a riscv64 port of GNU Mach/Hurd
Sergey Bugaev <[email protected]>
| Newsgroups | gmane.os.hurd.bugs |
|---|---|
| Message-ID | <CAN9u=HeD9Vt3rgHip4sdd2dFJ1LLs4NoWU43WQrSovb=bpf7KA@mail.gmail.com> |
On Tue, Aug 25, 2026 at 4:47 PM Hakan Candar <[email protected]> wrote: > That's funny, I actually never used 'la' myself. Does GCC/Clang > even use that at all? I thought everyone does auipc+addi, as that's what > the compilers output in general. When I'm writing hand-written assembly, > I try to match how the compiler does these, as using the assembler > directives can generate relocations that do not work on non-PIC code. > Explicitly writing the auipc+addi sequence also is clearer imo and > clearly distinguishes whether something is a GOT or a direct load. GCC appears to emit 'lla' and 'la' (but not 'lga', which as I read is a more recent addition to binutils). > The current toolchains that target GNU/Hurd (Clang and GCC) use > whatever ABI GNU/Linux uses, so that'd be the gp-as-reserved-register > case, I think? If we were to change that, we need to send patches > to GCC and LLVM, changing the default Mach ABI. Well, we generally try to stick close to the ABI that Linux uses (calling convention-wise), because why wouldn't we. But it's not automatic, the *-gnu target has to be defined in GCC & binutils, even if it's defined similarly to the *-linux-gnu and the BSD targets. See gcc:gcc/config/aarch64/aarch64-gnu.h for example. So we need to submit our target upstream either way. (And there's no default Mach ABI, but there are targets for GNU/Hurd systems on various architectures.) In case of gp relaxation, I believe LLVM already defaults to not doing it, but binutils (bfd) defaults the other way around (riscv_elf_params.relax_gp = 1), we could maybe switch that around for riscv-gnu, but still pass --relax-gp when building gnumach. But really, this should be a decision that somebody actually familiar with RISC-V (and toolchains and ABIs) makes, I'm just floating the idea. > I think we should > keep the current behaviour as it'd be consistent with the GNU/Linux ABI, > but that is just my opinion. > > Hakan Sergey