Changeset View
Changeset View
Standalone View
Standalone View
libexec/rtld-elf/rtld.c
Show First 20 Lines • Show All 1,790 Lines • ▼ Show 20 Lines | if (dlp->objs[i] == obj) | |||||||||
* never happen, but we'll handle it properly just in case it does. | * never happen, but we'll handle it properly just in case it does. | |||||||||
*/ | */ | |||||||||
if (dlp->num_used < dlp->num_alloc) | if (dlp->num_used < dlp->num_alloc) | |||||||||
dlp->objs[dlp->num_used++] = obj; | dlp->objs[dlp->num_used++] = obj; | |||||||||
return (false); | return (false); | |||||||||
} | } | |||||||||
/* | /* | |||||||||
* Hash function for symbol table lookup. Don't even think about changing | * SysV hash function for symbol table lookup. It is a slightly optimized | |||||||||
* this. It is specified by the System V ABI. | * version of the hash specified by the System V ABI. | |||||||||
*/ | */ | |||||||||
unsigned long | Elf32_Word | |||||||||
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; | |||||||||
kibUnsubmitted Not Done Inline Actions
kib: | ||||||||||
emasteAuthorUnsubmitted Done Inline Actionswill include with the reindent commit emaste: will include with the reindent commit | ||||||||||
unsigned long h = 0; | Elf32_Word h = 0; | |||||||||
unsigned long g; | ||||||||||
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 & 0x0fffffff); | |||||||||
} | } | |||||||||
/* | /* | |||||||||
* The GNU hash function is the Daniel J. Bernstein hash clipped to 32 bits | * The GNU hash function is the Daniel J. Bernstein hash clipped to 32 bits | |||||||||
* unsigned in case it's implemented with a wider type. | * unsigned in case it's implemented with a wider type. | |||||||||
*/ | */ | |||||||||
static uint32_t | static uint32_t | |||||||||
gnu_hash(const char *s) | gnu_hash(const char *s) | |||||||||
▲ Show 20 Lines • Show All 4,493 Lines • Show Last 20 Lines |