Use elf_relocaddr() to find the address for R_RISCV_RELATIVE

relocation.

elf_relocaddr() has a hook to handle VIMAGE data addresses.

This fixes VIMAGE support for RISC-V when built as a module.

Approved by:	re (gjb)
Sponsored by:	DARPA, AFRL
This commit is contained in:
Ruslan Bukin 2018-09-12 08:12:34 +00:00
parent 86c5937532
commit 752a8ea48e

View File

@ -330,11 +330,9 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
break;
case R_RISCV_RELATIVE:
val = relocbase + addend;
before64 = *where;
if (*where != val)
*where = val;
*where = elf_relocaddr(lf, relocbase + addend);
if (debug_kld)
printf("%p %c %-24s %016lx -> %016lx\n",