Prepare the kernel linker to handle PC-relative ifunc relocations.
The boot-time ifunc resolver assumes that it only needs to apply IRELATIVE relocations to PLT entries. With an upcoming optimization, this assumption no longer holds, so add the support required to handle PC-relative relocations targeting GNU_IFUNC symbols. - Provide a custom symbol lookup routine that can be used in early boot. The default lookup routine uses kobj, which is not functional at that point. - Apply all existing relocations during boot rather than filtering IRELATIVE relocations. - Ensure that we continue to apply ifunc relocations in a second pass when loading a kernel module. Reviewed by: kib MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D16749
This commit is contained in:
parent
657d21589e
commit
36716fe2e6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=338211
@ -175,13 +175,17 @@ elf64_dump_thread(struct thread *td, void *dst, size_t *off)
|
|||||||
*off = len;
|
*off = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ERI_LOCAL 0x0001
|
bool
|
||||||
#define ERI_ONLYIFUNC 0x0002
|
elf_is_ifunc_reloc(Elf_Size r_info)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (ELF_R_TYPE(r_info) == R_X86_64_IRELATIVE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Process one elf relocation with addend. */
|
/* Process one elf relocation with addend. */
|
||||||
static int
|
static int
|
||||||
elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
||||||
int type, elf_lookup_fn lookup, int flags)
|
int type, elf_lookup_fn lookup)
|
||||||
{
|
{
|
||||||
Elf64_Addr *where, val;
|
Elf64_Addr *where, val;
|
||||||
Elf32_Addr *where32, val32;
|
Elf32_Addr *where32, val32;
|
||||||
@ -221,9 +225,6 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
|||||||
panic("unknown reloc type %d\n", type);
|
panic("unknown reloc type %d\n", type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((flags & ERI_ONLYIFUNC) == 0) ^ (rtype != R_X86_64_IRELATIVE))
|
|
||||||
return (0);
|
|
||||||
|
|
||||||
switch (rtype) {
|
switch (rtype) {
|
||||||
case R_X86_64_NONE: /* none */
|
case R_X86_64_NONE: /* none */
|
||||||
break;
|
break;
|
||||||
@ -299,21 +300,12 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
elf_reloc_ifunc(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
|
||||||
int type, elf_lookup_fn lookup)
|
|
||||||
{
|
|
||||||
|
|
||||||
return (elf_reloc_internal(lf, relocbase, data, type, lookup,
|
|
||||||
ERI_ONLYIFUNC));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type,
|
elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type,
|
||||||
elf_lookup_fn lookup)
|
elf_lookup_fn lookup)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (elf_reloc_internal(lf, relocbase, data, type, lookup, 0));
|
return (elf_reloc_internal(lf, relocbase, data, type, lookup));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -321,8 +313,7 @@ elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
|||||||
int type, elf_lookup_fn lookup)
|
int type, elf_lookup_fn lookup)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (elf_reloc_internal(lf, relocbase, data, type, lookup,
|
return (elf_reloc_internal(lf, relocbase, data, type, lookup));
|
||||||
ERI_LOCAL));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -149,6 +149,13 @@ elf32_dump_thread(struct thread *td, void *dst, size_t *off)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
elf_is_ifunc_reloc(Elf_Size r_info __unused)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It is possible for the compiler to emit relocations for unaligned data.
|
* It is possible for the compiler to emit relocations for unaligned data.
|
||||||
* We handle this situation with these inlines.
|
* We handle this situation with these inlines.
|
||||||
|
@ -129,6 +129,13 @@ elf64_dump_thread(struct thread *td __unused, void *dst __unused,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
elf_is_ifunc_reloc(Elf_Size r_info __unused)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
||||||
int type, int local, elf_lookup_fn lookup)
|
int type, int local, elf_lookup_fn lookup)
|
||||||
|
@ -159,8 +159,14 @@ elf32_dump_thread(struct thread *td, void *dst, size_t *off)
|
|||||||
*off = len;
|
*off = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
elf_is_ifunc_reloc(Elf_Size r_info)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (ELF_R_TYPE(r_info) == R_386_IRELATIVE);
|
||||||
|
}
|
||||||
|
|
||||||
#define ERI_LOCAL 0x0001
|
#define ERI_LOCAL 0x0001
|
||||||
#define ERI_ONLYIFUNC 0x0002
|
|
||||||
|
|
||||||
/* Process one elf relocation with addend. */
|
/* Process one elf relocation with addend. */
|
||||||
static int
|
static int
|
||||||
@ -194,9 +200,6 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
|||||||
panic("unknown reloc type %d\n", type);
|
panic("unknown reloc type %d\n", type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((flags & ERI_ONLYIFUNC) == 0) ^ (rtype != R_386_IRELATIVE))
|
|
||||||
return (0);
|
|
||||||
|
|
||||||
if ((flags & ERI_LOCAL) != 0) {
|
if ((flags & ERI_LOCAL) != 0) {
|
||||||
if (rtype == R_386_RELATIVE) { /* A + B */
|
if (rtype == R_386_RELATIVE) { /* A + B */
|
||||||
addr = elf_relocaddr(lf, relocbase + addend);
|
addr = elf_relocaddr(lf, relocbase + addend);
|
||||||
@ -263,15 +266,6 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
elf_reloc_ifunc(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
|
||||||
int type, elf_lookup_fn lookup)
|
|
||||||
{
|
|
||||||
|
|
||||||
return (elf_reloc_internal(lf, relocbase, data, type, lookup,
|
|
||||||
ERI_ONLYIFUNC));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type,
|
elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type,
|
||||||
elf_lookup_fn lookup)
|
elf_lookup_fn lookup)
|
||||||
|
@ -188,11 +188,13 @@ static struct linker_class link_elf_class = {
|
|||||||
link_elf_methods, sizeof(struct elf_file)
|
link_elf_methods, sizeof(struct elf_file)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef int (*elf_reloc_fn)(linker_file_t lf, Elf_Addr relocbase,
|
||||||
|
const void *data, int type, elf_lookup_fn lookup);
|
||||||
|
|
||||||
static int parse_dynamic(elf_file_t);
|
static int parse_dynamic(elf_file_t);
|
||||||
static int relocate_file(elf_file_t);
|
static int relocate_file(elf_file_t);
|
||||||
static int relocate_file1(elf_file_t ef, int (*elf_reloc_func)(
|
static int relocate_file1(elf_file_t ef, elf_lookup_fn lookup,
|
||||||
linker_file_t lf, Elf_Addr relocbase, const void *data,
|
elf_reloc_fn reloc, bool ifuncs);
|
||||||
int type, elf_lookup_fn lookup));
|
|
||||||
static int link_elf_preload_parse_symbols(elf_file_t);
|
static int link_elf_preload_parse_symbols(elf_file_t);
|
||||||
|
|
||||||
static struct elf_set_head set_pcpu_list;
|
static struct elf_set_head set_pcpu_list;
|
||||||
@ -1185,81 +1187,48 @@ symbol_name(elf_file_t ef, Elf_Size r_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
relocate_file1(elf_file_t ef, int (*elf_reloc_func)(linker_file_t lf,
|
symbol_type(elf_file_t ef, Elf_Size r_info)
|
||||||
Elf_Addr relocbase, const void *data, int type, elf_lookup_fn lookup))
|
{
|
||||||
|
const Elf_Sym *ref;
|
||||||
|
|
||||||
|
if (ELF_R_SYM(r_info)) {
|
||||||
|
ref = ef->symtab + ELF_R_SYM(r_info);
|
||||||
|
return (ELF_ST_TYPE(ref->st_info));
|
||||||
|
}
|
||||||
|
return (STT_NOTYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
relocate_file1(elf_file_t ef, elf_lookup_fn lookup, elf_reloc_fn reloc,
|
||||||
|
bool ifuncs)
|
||||||
{
|
{
|
||||||
const Elf_Rel *rellim;
|
|
||||||
const Elf_Rel *rel;
|
const Elf_Rel *rel;
|
||||||
const Elf_Rela *relalim;
|
|
||||||
const Elf_Rela *rela;
|
const Elf_Rela *rela;
|
||||||
const char *symname;
|
const char *symname;
|
||||||
|
|
||||||
/* Perform relocations without addend if there are any: */
|
#define APPLY_RELOCS(iter, tbl, tblsize, type) do { \
|
||||||
rel = ef->rel;
|
for ((iter) = (tbl); (iter) != NULL && \
|
||||||
if (rel != NULL) {
|
(iter) < (tbl) + (tblsize) / sizeof(*(iter)); (iter)++) { \
|
||||||
rellim = (const Elf_Rel *)
|
if ((symbol_type(ef, (iter)->r_info) == \
|
||||||
((const char *)ef->rel + ef->relsize);
|
STT_GNU_IFUNC || \
|
||||||
while (rel < rellim) {
|
elf_is_ifunc_reloc((iter)->r_info)) != ifuncs) \
|
||||||
if (elf_reloc_func(&ef->lf, (Elf_Addr)ef->address, rel,
|
continue; \
|
||||||
ELF_RELOC_REL, elf_lookup)) {
|
if (reloc(&ef->lf, (Elf_Addr)ef->address, \
|
||||||
symname = symbol_name(ef, rel->r_info);
|
(iter), (type), lookup)) { \
|
||||||
printf("link_elf: symbol %s undefined\n", symname);
|
symname = symbol_name(ef, (iter)->r_info); \
|
||||||
return (ENOENT);
|
printf("link_elf: symbol %s undefined\n", \
|
||||||
}
|
symname); \
|
||||||
rel++;
|
return (ENOENT); \
|
||||||
}
|
} \
|
||||||
}
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/* Perform relocations with addend if there are any: */
|
APPLY_RELOCS(rel, ef->rel, ef->relsize, ELF_RELOC_REL);
|
||||||
rela = ef->rela;
|
APPLY_RELOCS(rela, ef->rela, ef->relasize, ELF_RELOC_RELA);
|
||||||
if (rela != NULL) {
|
APPLY_RELOCS(rel, ef->pltrel, ef->pltrelsize, ELF_RELOC_REL);
|
||||||
relalim = (const Elf_Rela *)
|
APPLY_RELOCS(rela, ef->pltrela, ef->pltrelasize, ELF_RELOC_RELA);
|
||||||
((const char *)ef->rela + ef->relasize);
|
|
||||||
while (rela < relalim) {
|
|
||||||
if (elf_reloc_func(&ef->lf, (Elf_Addr)ef->address, rela,
|
|
||||||
ELF_RELOC_RELA, elf_lookup)) {
|
|
||||||
symname = symbol_name(ef, rela->r_info);
|
|
||||||
printf("link_elf: symbol %s undefined\n",
|
|
||||||
symname);
|
|
||||||
return (ENOENT);
|
|
||||||
}
|
|
||||||
rela++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Perform PLT relocations without addend if there are any: */
|
#undef APPLY_RELOCS
|
||||||
rel = ef->pltrel;
|
|
||||||
if (rel != NULL) {
|
|
||||||
rellim = (const Elf_Rel *)
|
|
||||||
((const char *)ef->pltrel + ef->pltrelsize);
|
|
||||||
while (rel < rellim) {
|
|
||||||
if (elf_reloc_func(&ef->lf, (Elf_Addr)ef->address, rel,
|
|
||||||
ELF_RELOC_REL, elf_lookup)) {
|
|
||||||
symname = symbol_name(ef, rel->r_info);
|
|
||||||
printf("link_elf: symbol %s undefined\n",
|
|
||||||
symname);
|
|
||||||
return (ENOENT);
|
|
||||||
}
|
|
||||||
rel++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Perform relocations with addend if there are any: */
|
|
||||||
rela = ef->pltrela;
|
|
||||||
if (rela != NULL) {
|
|
||||||
relalim = (const Elf_Rela *)
|
|
||||||
((const char *)ef->pltrela + ef->pltrelasize);
|
|
||||||
while (rela < relalim) {
|
|
||||||
if (elf_reloc_func(&ef->lf, (Elf_Addr)ef->address, rela,
|
|
||||||
ELF_RELOC_RELA, elf_lookup)) {
|
|
||||||
symname = symbol_name(ef, rela->r_info);
|
|
||||||
printf("link_elf: symbol %s undefined\n",
|
|
||||||
symname);
|
|
||||||
return (ENOENT);
|
|
||||||
}
|
|
||||||
rela++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -1267,14 +1236,12 @@ relocate_file1(elf_file_t ef, int (*elf_reloc_func)(linker_file_t lf,
|
|||||||
static int
|
static int
|
||||||
relocate_file(elf_file_t ef)
|
relocate_file(elf_file_t ef)
|
||||||
{
|
{
|
||||||
int e;
|
int error;
|
||||||
|
|
||||||
e = relocate_file1(ef, elf_reloc);
|
error = relocate_file1(ef, elf_lookup, elf_reloc, false);
|
||||||
#if defined(__i386__) || defined(__amd64__)
|
if (error == 0)
|
||||||
if (e == 0)
|
error = relocate_file1(ef, elf_lookup, elf_reloc, true);
|
||||||
e = relocate_file1(ef, elf_reloc_ifunc);
|
return (error);
|
||||||
#endif
|
|
||||||
return (e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1298,7 +1265,7 @@ elf_hash(const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
link_elf_lookup_symbol(linker_file_t lf, const char* name, c_linker_sym_t* sym)
|
link_elf_lookup_symbol(linker_file_t lf, const char *name, c_linker_sym_t *sym)
|
||||||
{
|
{
|
||||||
elf_file_t ef = (elf_file_t) lf;
|
elf_file_t ef = (elf_file_t) lf;
|
||||||
unsigned long symnum;
|
unsigned long symnum;
|
||||||
@ -1687,6 +1654,29 @@ link_elf_strtab_get(linker_file_t lf, caddr_t *strtab)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__i386__) || defined(__amd64__)
|
#if defined(__i386__) || defined(__amd64__)
|
||||||
|
/*
|
||||||
|
* Use this lookup routine when performing relocations early during boot.
|
||||||
|
* The generic lookup routine depends on kobj, which is not initialized
|
||||||
|
* at that point.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
elf_lookup_ifunc(linker_file_t lf, Elf_Size symidx, int deps __unused,
|
||||||
|
Elf_Addr *res)
|
||||||
|
{
|
||||||
|
elf_file_t ef;
|
||||||
|
const Elf_Sym *symp;
|
||||||
|
caddr_t val;
|
||||||
|
|
||||||
|
ef = (elf_file_t)lf;
|
||||||
|
symp = ef->symtab + symidx;
|
||||||
|
if (ELF_ST_TYPE(symp->st_info) == STT_GNU_IFUNC) {
|
||||||
|
val = (caddr_t)ef->address + symp->st_value;
|
||||||
|
*res = ((Elf_Addr (*)(void))val)();
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
return (ENOENT);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
link_elf_ireloc(caddr_t kmdp)
|
link_elf_ireloc(caddr_t kmdp)
|
||||||
{
|
{
|
||||||
@ -1695,7 +1685,7 @@ link_elf_ireloc(caddr_t kmdp)
|
|||||||
volatile char *c;
|
volatile char *c;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
ef = &eff;
|
ef = &eff;
|
||||||
|
|
||||||
/* Do not use bzero/memset before ireloc is done. */
|
/* Do not use bzero/memset before ireloc is done. */
|
||||||
for (c = (char *)ef, i = 0; i < sizeof(*ef); i++)
|
for (c = (char *)ef, i = 0; i < sizeof(*ef); i++)
|
||||||
@ -1706,6 +1696,6 @@ link_elf_ireloc(caddr_t kmdp)
|
|||||||
parse_dynamic(ef);
|
parse_dynamic(ef);
|
||||||
ef->address = 0;
|
ef->address = 0;
|
||||||
link_elf_preload_parse_symbols(ef);
|
link_elf_preload_parse_symbols(ef);
|
||||||
relocate_file1(ef, elf_reloc_ifunc);
|
relocate_file1(ef, elf_lookup_ifunc, elf_reloc, true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1521,15 +1521,10 @@ link_elf_reloc_local(linker_file_t lf, bool ifuncs)
|
|||||||
/* Only do local relocs */
|
/* Only do local relocs */
|
||||||
if (ELF_ST_BIND(sym->st_info) != STB_LOCAL)
|
if (ELF_ST_BIND(sym->st_info) != STB_LOCAL)
|
||||||
continue;
|
continue;
|
||||||
if ((ELF_ST_TYPE(sym->st_info) == STT_GNU_IFUNC) ==
|
if ((ELF_ST_TYPE(sym->st_info) == STT_GNU_IFUNC ||
|
||||||
ifuncs)
|
elf_is_ifunc_reloc(rel->r_info)) == ifuncs)
|
||||||
elf_reloc_local(lf, base, rel, ELF_RELOC_REL,
|
elf_reloc_local(lf, base, rel, ELF_RELOC_REL,
|
||||||
elf_obj_lookup);
|
elf_obj_lookup);
|
||||||
#if defined(__i386__) || defined(__amd64__)
|
|
||||||
else if (ifuncs)
|
|
||||||
elf_reloc_ifunc(lf, base, rel, ELF_RELOC_REL,
|
|
||||||
elf_obj_lookup);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1554,15 +1549,10 @@ link_elf_reloc_local(linker_file_t lf, bool ifuncs)
|
|||||||
/* Only do local relocs */
|
/* Only do local relocs */
|
||||||
if (ELF_ST_BIND(sym->st_info) != STB_LOCAL)
|
if (ELF_ST_BIND(sym->st_info) != STB_LOCAL)
|
||||||
continue;
|
continue;
|
||||||
if ((ELF_ST_TYPE(sym->st_info) == STT_GNU_IFUNC) ==
|
if ((ELF_ST_TYPE(sym->st_info) == STT_GNU_IFUNC ||
|
||||||
ifuncs)
|
elf_is_ifunc_reloc(rela->r_info)) == ifuncs)
|
||||||
elf_reloc_local(lf, base, rela, ELF_RELOC_RELA,
|
elf_reloc_local(lf, base, rela, ELF_RELOC_RELA,
|
||||||
elf_obj_lookup);
|
elf_obj_lookup);
|
||||||
#if defined(__i386__) || defined(__amd64__)
|
|
||||||
else if (ifuncs)
|
|
||||||
elf_reloc_ifunc(lf, base, rela, ELF_RELOC_RELA,
|
|
||||||
elf_obj_lookup);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -295,6 +295,13 @@ mips_tmp_reloc_free(struct mips_tmp_reloc *r)
|
|||||||
free(r, M_TEMP);
|
free(r, M_TEMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
elf_is_ifunc_reloc(Elf_Size r_info __unused)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
/* Process one elf relocation with addend. */
|
/* Process one elf relocation with addend. */
|
||||||
static int
|
static int
|
||||||
elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
||||||
|
@ -214,6 +214,13 @@ elf32_dump_thread(struct thread *td, void *dst, size_t *off)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __powerpc64__
|
#ifndef __powerpc64__
|
||||||
|
bool
|
||||||
|
elf_is_ifunc_reloc(Elf_Size r_info __unused)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
/* Process one elf relocation with addend. */
|
/* Process one elf relocation with addend. */
|
||||||
static int
|
static int
|
||||||
elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
||||||
|
@ -276,6 +276,12 @@ elf64_dump_thread(struct thread *td, void *dst, size_t *off)
|
|||||||
*off = len;
|
*off = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
elf_is_ifunc_reloc(Elf_Size r_info __unused)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
/* Process one elf relocation with addend. */
|
/* Process one elf relocation with addend. */
|
||||||
static int
|
static int
|
||||||
|
@ -259,6 +259,13 @@ reloctype_to_str(int type)
|
|||||||
return "*unknown*";
|
return "*unknown*";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
elf_is_ifunc_reloc(Elf_Size r_info __unused)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Currently kernel loadable module for RISCV is compiled with -fPIC option.
|
* Currently kernel loadable module for RISCV is compiled with -fPIC option.
|
||||||
* (see also additional CFLAGS definition for RISCV in sys/conf/kmod.mk)
|
* (see also additional CFLAGS definition for RISCV in sys/conf/kmod.mk)
|
||||||
|
@ -312,6 +312,13 @@ static const long reloc_target_bitmask[] = {
|
|||||||
};
|
};
|
||||||
#define RELOC_VALUE_BITMASK(t) (reloc_target_bitmask[t])
|
#define RELOC_VALUE_BITMASK(t) (reloc_target_bitmask[t])
|
||||||
|
|
||||||
|
bool
|
||||||
|
elf_is_ifunc_reloc(Elf_Size r_info __unused)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
||||||
int type, elf_lookup_fn lookup __unused)
|
int type, elf_lookup_fn lookup __unused)
|
||||||
|
@ -272,10 +272,9 @@ extern int kld_debug;
|
|||||||
typedef int elf_lookup_fn(linker_file_t, Elf_Size, int, Elf_Addr *);
|
typedef int elf_lookup_fn(linker_file_t, Elf_Size, int, Elf_Addr *);
|
||||||
|
|
||||||
/* Support functions */
|
/* Support functions */
|
||||||
|
bool elf_is_ifunc_reloc(Elf_Size r_info);
|
||||||
int elf_reloc(linker_file_t _lf, Elf_Addr base, const void *_rel,
|
int elf_reloc(linker_file_t _lf, Elf_Addr base, const void *_rel,
|
||||||
int _type, elf_lookup_fn _lu);
|
int _type, elf_lookup_fn _lu);
|
||||||
int elf_reloc_ifunc(linker_file_t _lf, Elf_Addr base, const void *_rel,
|
|
||||||
int _type, elf_lookup_fn _lu);
|
|
||||||
int elf_reloc_local(linker_file_t _lf, Elf_Addr base, const void *_rel,
|
int elf_reloc_local(linker_file_t _lf, Elf_Addr base, const void *_rel,
|
||||||
int _type, elf_lookup_fn _lu);
|
int _type, elf_lookup_fn _lu);
|
||||||
Elf_Addr elf_relocaddr(linker_file_t _lf, Elf_Addr addr);
|
Elf_Addr elf_relocaddr(linker_file_t _lf, Elf_Addr addr);
|
||||||
|
Loading…
Reference in New Issue
Block a user