Index: sys/amd64/amd64/elf_machdep.c =================================================================== --- sys/amd64/amd64/elf_machdep.c +++ sys/amd64/amd64/elf_machdep.c @@ -309,11 +309,11 @@ case R_X86_64_NONE: /* none */ break; - case R_X86_64_64: /* S + A */ + case R_X86_64_64: /* S + A */ error = lookup(lf, symidx, 1, &addr); val = addr + addend; if (error != 0) - return -1; + return (-1); if (*where != val) *where = val; break; @@ -325,7 +325,7 @@ where32 = (Elf32_Addr *)where; val32 = (Elf32_Addr)(addr + addend - (Elf_Addr)where); if (error != 0) - return -1; + return (-1); if (*where32 != val32) *where32 = val32; break; @@ -335,7 +335,7 @@ val32 = (Elf32_Addr)(addr + addend); where32 = (Elf32_Addr *)where; if (error != 0) - return -1; + return (-1); if (*where32 != val32) *where32 = val32; break; @@ -345,14 +345,15 @@ * There shouldn't be copy relocations in kernel * objects. */ - printf("kldload: unexpected R_COPY relocation\n"); + printf("kldload: unexpected R_COPY relocation, " + "symbol index %ld\n", symidx); return (-1); case R_X86_64_GLOB_DAT: /* S */ case R_X86_64_JMP_SLOT: /* XXX need addend + offset */ error = lookup(lf, symidx, 1, &addr); if (error != 0) - return -1; + return (-1); if (*where != addr) *where = addr; break; @@ -372,8 +373,8 @@ break; default: - printf("kldload: unexpected relocation type %ld\n", - rtype); + printf("kldload: unexpected relocation type %ld, " + "symbol index %ld\n", rtype, symidx); return (-1); } return (0); Index: sys/kern/link_elf_obj.c =================================================================== --- sys/kern/link_elf_obj.c +++ sys/kern/link_elf_obj.c @@ -1676,9 +1676,11 @@ if (ELF_ST_BIND(sym->st_info) != STB_LOCAL) continue; if ((ELF_ST_TYPE(sym->st_info) == STT_GNU_IFUNC || - elf_is_ifunc_reloc(rel->r_info)) == ifuncs) - elf_reloc_local(lf, base, rel, ELF_RELOC_REL, - elf_obj_lookup); + elf_is_ifunc_reloc(rel->r_info)) != ifuncs) + continue; + if (elf_reloc_local(lf, base, rel, ELF_RELOC_REL, + elf_obj_lookup) != 0) + return (ENOENT); } } @@ -1704,9 +1706,11 @@ if (ELF_ST_BIND(sym->st_info) != STB_LOCAL) continue; if ((ELF_ST_TYPE(sym->st_info) == STT_GNU_IFUNC || - elf_is_ifunc_reloc(rela->r_info)) == ifuncs) - elf_reloc_local(lf, base, rela, ELF_RELOC_RELA, - elf_obj_lookup); + elf_is_ifunc_reloc(rela->r_info)) != ifuncs) + continue; + if (elf_reloc_local(lf, base, rela, ELF_RELOC_RELA, + elf_obj_lookup) != 0) + return (ENOENT); } } return (0);