From 3257afa1602d19428df378b77fe7c491243a03e2 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Sun, 3 May 2026 00:24:42 +0800 Subject: [PATCH] riscv64-link: add R_RISCV_RELATIVE case in relocate() arm64-link.c has R_AARCH64_RELATIVE handling. Without this case, incoming R_RISCV_RELATIVE relocations from object files fall through to the 'FIXME: handle reloc type' default path. P1.7 (NEED_BUILD_GOT guards) is not needed: NEED_RELOC_TYPE and NEED_BUILD_GOT are always defined in the build context (tcc.h:1608). --- riscv64-link.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/riscv64-link.c b/riscv64-link.c index edcf9b54..0d2ad2a4 100644 --- a/riscv64-link.c +++ b/riscv64-link.c @@ -393,6 +393,11 @@ ST_FUNC void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, case R_RISCV_COPY: /* XXX */ return; + case R_RISCV_RELATIVE: + /* R_RISCV_RELATIVE value is already applied in R_RISCV_32/64 + dynamic output paths, but we need this case for incoming + RELATIVE relocations from object files. */ + return; default: fprintf(stderr, "FIXME: handle reloc type %x at %x [%p] to %x\n",