Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/link_elf.c
Show First 20 Lines • Show All 1,464 Lines • ▼ Show 20 Lines | relocate_file(elf_file_t ef) | |||||||||
error = relocate_file1(ef, elf_lookup, elf_reloc, false); | error = relocate_file1(ef, elf_lookup, elf_reloc, false); | |||||||||
if (error == 0) | if (error == 0) | |||||||||
error = relocate_file1(ef, elf_lookup, elf_reloc, true); | error = relocate_file1(ef, elf_lookup, elf_reloc, true); | |||||||||
return (error); | return (error); | |||||||||
} | } | |||||||||
/* | /* | |||||||||
* Hash function for symbol table lookup. Don't even think about changing | * SysV hash function for symbol table lookup. | |||||||||
* this. It is specified by the System V ABI. | ||||||||||
kib: The last sentence from the comment is worth keeping as well, IMO. | ||||||||||
*/ | */ | |||||||||
static unsigned long | static unsigned long | |||||||||
elf_hash(const char *name) | elf_hash(const char *name) | |||||||||
{ | { | |||||||||
const unsigned char *p = (const unsigned char *) name; | const unsigned char *p = (const unsigned char *) name; | |||||||||
Not Done Inline Actions
kib: | ||||||||||
unsigned long h = 0; | unsigned long h = 0; | |||||||||
unsigned long g; | unsigned long g; | |||||||||
kibUnsubmitted Not Done Inline Actionsg is unused now? kib: g is unused now? | ||||||||||
Not Done Inline ActionsI mean, the h var type should be changed as well. kib: I mean, the h var type should be changed as well. | ||||||||||
Not Done Inline Actions
kib: | ||||||||||
while (*p != '\0') { | while (*p != '\0') { | |||||||||
h = (h << 4) + *p++; | h = (h << 4) + *p++; | |||||||||
if ((g = h & 0xf0000000) != 0) | h ^= (h >> 24) & 0xf0; | |||||||||
h ^= g >> 24; | ||||||||||
h &= ~g; | ||||||||||
} | } | |||||||||
return (h); | return (h & 0xfffffff); | |||||||||
} | } | |||||||||
static int | static int | |||||||||
link_elf_lookup_symbol1(linker_file_t lf, const char *name, c_linker_sym_t *sym, | link_elf_lookup_symbol1(linker_file_t lf, const char *name, c_linker_sym_t *sym, | |||||||||
bool see_local) | bool see_local) | |||||||||
{ | { | |||||||||
elf_file_t ef = (elf_file_t) lf; | elf_file_t ef = (elf_file_t) lf; | |||||||||
unsigned long symnum; | unsigned long symnum; | |||||||||
▲ Show 20 Lines • Show All 490 Lines • Show Last 20 Lines |
The last sentence from the comment is worth keeping as well, IMO.