Index: head/sys/amd64/amd64/elf_machdep.c =================================================================== --- head/sys/amd64/amd64/elf_machdep.c +++ head/sys/amd64/amd64/elf_machdep.c @@ -267,7 +267,6 @@ */ printf("kldload: unexpected R_COPY relocation\n"); return (-1); - break; case R_X86_64_GLOB_DAT: /* S */ case R_X86_64_JMP_SLOT: /* XXX need addend + offset */ @@ -279,7 +278,7 @@ break; case R_X86_64_RELATIVE: /* B + A */ - addr = relocbase + addend; + addr = elf_relocaddr(lf, relocbase + addend); val = addr; if (*where != val) *where = val; Index: head/sys/kern/link_elf.c =================================================================== --- head/sys/kern/link_elf.c +++ head/sys/kern/link_elf.c @@ -1162,6 +1162,9 @@ { elf_file_t ef; + KASSERT(lf->ops->cls == (kobj_class_t)&link_elf_class, + ("elf_relocaddr: unexpected linker file %p", lf)); + ef = (elf_file_t)lf; if (x >= ef->pcpu_start && x < ef->pcpu_stop) return ((x - ef->pcpu_start) + ef->pcpu_base);