When I build an image, I met this problem “relocation truncated to fit: R_RISCV_HI20”.
As far as I know, this is caused when the relocated symbols referenced by the functions are far away and beyond 0x7FFFFFFF.
But I check the link script, it seems to be close enough and map file also gives the evidence.
This is part of the map file:
.text.blink1 0x000000008000034a 0x38 …/app/libapp.a(main.c.obj)
.bss._kernel 0x0000000080004398 0x70 kernel/libkernel.a(sched.c.obj)
And link script is here, and please notice CONFIG_XIP is not defined.