When linking a position independent executable, the linker may reserve
a dynamic relocation slot for a reference to an absolute symbol and only
later determine that no runtime relocation is needed. The slot is not
removed, but turned into an R_RISCV_NONE entry, which must be ignored.

Assisted-by: Claude:fable-5
Signed-off-by: Ahmad Fatoum <[email protected]>
---
 arch/riscv/lib/reloc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/riscv/lib/reloc.c b/arch/riscv/lib/reloc.c
index 71d59d4ab62e..99dde7bfffe2 100644
--- a/arch/riscv/lib/reloc.c
+++ b/arch/riscv/lib/reloc.c
@@ -45,6 +45,8 @@ static void relocate_image(unsigned long offset,
                fixup = (unsigned long *)(rela->r_offset + offset);
 
                switch (RISC_R_TYPE(rela->r_info)) {
+               case R_RISCV_NONE:
+                       break;
                case R_RISCV_RELATIVE:
                        *fixup = rela->r_addend + offset;
                        break;
-- 
2.47.3


Reply via email to