Kernel linkers: some style

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D32878
This commit is contained in:
Konstantin Belousov 2021-11-07 11:03:45 +02:00
parent 5bb3134a8c
commit a7e4eb1422
2 changed files with 21 additions and 25 deletions

View File

@ -1596,12 +1596,12 @@ static int
link_elf_search_symbol(linker_file_t lf, caddr_t value, link_elf_search_symbol(linker_file_t lf, caddr_t value,
c_linker_sym_t *sym, long *diffp) c_linker_sym_t *sym, long *diffp)
{ {
elf_file_t ef = (elf_file_t) lf; elf_file_t ef = (elf_file_t)lf;
u_long off = (uintptr_t) (void *) value; u_long off = (uintptr_t) (void *)value;
u_long diff = off; u_long diff = off;
u_long st_value; u_long st_value;
const Elf_Sym* es; const Elf_Sym *es;
const Elf_Sym* best = NULL; const Elf_Sym *best = NULL;
int i; int i;
for (i = 0, es = ef->ddbsymtab; i < ef->ddbsymcnt; i++, es++) { for (i = 0, es = ef->ddbsymtab; i < ef->ddbsymcnt; i++, es++) {
@ -1711,7 +1711,7 @@ link_elf_each_function_nameval(linker_file_t file,
{ {
linker_symval_t symval; linker_symval_t symval;
elf_file_t ef = (elf_file_t)file; elf_file_t ef = (elf_file_t)file;
const Elf_Sym* symp; const Elf_Sym *symp;
int i, error; int i, error;
/* Exhaustive search */ /* Exhaustive search */

View File

@ -1421,7 +1421,7 @@ link_elf_lookup_symbol(linker_file_t lf, const char *name, c_linker_sym_t *sym)
return 0; return 0;
} }
} }
return ENOENT; return (ENOENT);
} }
static int static int
@ -1442,17 +1442,17 @@ link_elf_symbol_values(linker_file_t lf, c_linker_sym_t sym,
val = ((caddr_t (*)(void))val)(); val = ((caddr_t (*)(void))val)();
symval->value = val; symval->value = val;
symval->size = es->st_size; symval->size = es->st_size;
return 0; return (0);
} }
return ENOENT; return (ENOENT);
} }
static int static int
link_elf_search_symbol(linker_file_t lf, caddr_t value, link_elf_search_symbol(linker_file_t lf, caddr_t value,
c_linker_sym_t *sym, long *diffp) c_linker_sym_t *sym, long *diffp)
{ {
elf_file_t ef = (elf_file_t) lf; elf_file_t ef = (elf_file_t)lf;
u_long off = (uintptr_t) (void *) value; u_long off = (uintptr_t)(void *)value;
u_long diff = off; u_long diff = off;
u_long st_value; u_long st_value;
const Elf_Sym *es; const Elf_Sym *es;
@ -1480,7 +1480,7 @@ link_elf_search_symbol(linker_file_t lf, caddr_t value,
*diffp = diff; *diffp = diff;
*sym = (c_linker_sym_t) best; *sym = (c_linker_sym_t) best;
return 0; return (0);
} }
/* /*
@ -1779,25 +1779,21 @@ link_elf_reloc_local(linker_file_t lf, bool ifuncs)
static long static long
link_elf_symtab_get(linker_file_t lf, const Elf_Sym **symtab) link_elf_symtab_get(linker_file_t lf, const Elf_Sym **symtab)
{ {
elf_file_t ef = (elf_file_t)lf; elf_file_t ef = (elf_file_t)lf;
*symtab = ef->ddbsymtab;
if (*symtab == NULL)
return (0);
return (ef->ddbsymcnt); *symtab = ef->ddbsymtab;
if (*symtab == NULL)
return (0);
return (ef->ddbsymcnt);
} }
static long static long
link_elf_strtab_get(linker_file_t lf, caddr_t *strtab) link_elf_strtab_get(linker_file_t lf, caddr_t *strtab)
{ {
elf_file_t ef = (elf_file_t)lf; elf_file_t ef = (elf_file_t)lf;
*strtab = ef->ddbstrtab; *strtab = ef->ddbstrtab;
if (*strtab == NULL)
if (*strtab == NULL) return (0);
return (0); return (ef->ddbstrcnt);
return (ef->ddbstrcnt);
} }