This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb/riscv: Split ISA and ABI features
On Mon, Dec 17, 2018 at 10:30 AM John Baldwin <jhb@freebsd.org> wrote:
> I think in theory you could do this just fine? It would be akin to running
> an i386 binary on x86_64. I thought the XLEN field in one of the status
> registers was allowed to be writable so that you could switch modes at
> least for U? That said, I'm not sure if that will actually get used. I'm
> not sure if Linux is planning on supporting RV32. FreeBSD will likely only
> ever support RV64. I think having riscv_abi_xlen is fine in its current
> form.
riscv32-linux will be supported because there are people that want
this for embedded sytems. The desktop/server distros will probably
never support riscv32-linux. The riscv32-linux support is not
complete upstream yet though. There is a pending glibc patch that
won't go until after the next glibc release, because they are waiting
for 64-bit time_t support (or something like that), to avoid a future
ABI change.
While you can in theory run 32-bit code on a riscv64-linux, there is
currently no linux kernel support for this, and no plans to add it. A
n32/x32 style ABI would be simpler to implement, but there are no
current plans for this either.
> Note that I think the current patch will always report the floating point
> registers as the target width? I think for other architectures in GDB we
> store the target registers as "raw" registers, but would present the
> abi registers as "cooked". I think this is how we treat an i386 binary on
> x86_64 for example where 'info registers' shows 32-bit registers instead of
> 64-bit. MIPS does some similar things to handle 32-bit MIPS binaries on
> 64-bit targets. Perhaps this is less important for FP registers, but I'm
> curious if GDB will DTRT if you have a 'float' variable that DWARF indicates
> is stored in $f0 if $f0 is actually a 64-bit double register?
When gdb knows that it is a float, it prints a float, so this works
OK. The problem occurs when you use a command like "info registers
float" and gdb doesn't know if it is a float or a double value. This
is why I added support to treat 64-bit FP registers as a union of
float and double, so that gdb would print both. I also added support
to nan-box float values for inferior calls. I haven't seen any
serious FP register related issues when I run the gdb testsuite
natively on my Fedora Core system. I haven't tested Andrew's latest
patch yet, but if I see issues I will report them.
Jim