I'm looking at the RISC-V elfutils support to help the Debian folks. I see four testcases failing, same as Kurt Roeckx reported about 6 weeks ago. I'm testing on a Fedora Core 29 system.
I found a trivial bug in backends/riscv_corenote.c. It has ".offset = 1" but this is a byte offset not a register offset, so it needs to be ".offset = 8" instead. I also added in the missing PC support. These two fixes then require a fix for tests/run-readelf-mixed-corenote.sh because the eu-readelf output is now more correct than before. There is also a missing backends/riscv_retval.c file. I have an initial implementation for this, but I haven't implemented the support for structures with one or two float fields yet, as this gets a little complicated. With these patches, I now see two failures. One is a glibc bug that Andreas Schwab already fixed, where _start fails to terminate the unwind chain. I just don't have this patch on my system. The other failure is the same glibc bug in __thread_start, which apparently isn't fixed yet, and needs the same fix Andreas already added to _start. So with the appropriate glibc fixes, the elfutils testsuite should run without error on a riscv64/lp64d system using the patches I have. There is a problem here though. The riscv support was written to try to handle both 32-bit and 64-bit targets with a single elfutils backend. But I have 6 ABIs I need to (theoretically) handle in riscv_retval.c. The return_value_location function doesn't take any ebl or elf pointer, so I can't handle it there. I can handle it in riscv_init.c by checking ebl and elf pointers there, and calling an appropriate function, but I'm not sure if that is OK. Currently, none of the *_init.c files are using the elf pointer argument. I noticed another problem which is that riscv_corenote.c is only correct for riscv64, because it assumes that registers are 64-bits. But I see that sparc has a solution for that, so I will have to take a closer look at that and see if I can make it work for riscv. I unfortunately can't test the 32-bit riscv support. We don't have working upstream support for 32-bit linux yet. I can only test the 64-bit LP64D riscv support. I haven't contributed to elfutils before. So I'm looking for advice on how to proceed. I can send out my work in progress patches if that is useful. I probably should try to chop them up a bit first. I think I have 3 parts at the moment. One part should be OK, and one part needs more work to be complete (but maybe incomplete is OK?), and one part I haven't written yet. Jim