cpukit/libdl: Fix the RISC-V relocations

The RISC-V backend had four defects, each of which alone prevented a
module from loading.

R_RISCV_RELAX, the four thread local storage types and the two
ULEB128 types had no case and failed the load.  The addend of the
relocation was never applied.  Relocations against a section symbol
were skipped, which left the C++ unwind tables unrelocated.

R_RISCV_PCREL_LO12_I and R_RISCV_PCREL_LO12_S used the symbol of
their own record.  The psABI defines this symbol as a label on the
AUIPC instruction and the value as the low twelve bits of the value
computed by the paired R_RISCV_PCREL_HI20.  Take the value from the
paired relocation and defer it if that one is not yet applied.

Close #5707.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
Sebastian Huber authored and Joel Sherrill committed 2026-08-20 17:59:08 -05:00
1 parent 70d9de174e
commit e19acd2a68
1 file changed
+310 -113
File diff suppressed because it is too large. Load diff