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).
This commit is contained in:
Meng Zhuo
2026-05-03 00:24:42 +08:00
parent 419b527657
commit 3257afa160

View File

@@ -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",