Page MenuHomeFreeBSD

D39517.id120216.diff
No OneTemporary

D39517.id120216.diff

Index: libexec/rtld-elf/rtld.h
===================================================================
--- libexec/rtld-elf/rtld.h
+++ libexec/rtld-elf/rtld.h
@@ -379,7 +379,7 @@
*/
uintptr_t rtld_round_page(uintptr_t);
uintptr_t rtld_trunc_page(uintptr_t);
-unsigned long elf_hash(const char *);
+Elf32_Word elf_hash(const char *);
const Elf_Sym *find_symdef(unsigned long, const Obj_Entry *,
const Obj_Entry **, int, SymCache *, struct Struct_RtldLockState *);
void lockdflt_init(void);
Index: libexec/rtld-elf/rtld.c
===================================================================
--- libexec/rtld-elf/rtld.c
+++ libexec/rtld-elf/rtld.c
@@ -1796,23 +1796,20 @@
}
/*
- * Hash function for symbol table lookup. Don't even think about changing
- * this. It is specified by the System V ABI.
+ * SysV hash function for symbol table lookup. It is a slightly optimized
+ * version of the hash specified by the System V ABI.
*/
-unsigned long
+Elf32_Word
elf_hash(const char *name)
{
const unsigned char *p = (const unsigned char *) name;
- unsigned long h = 0;
- unsigned long g;
+ Elf32_Word h = 0;
while (*p != '\0') {
h = (h << 4) + *p++;
- if ((g = h & 0xf0000000) != 0)
- h ^= g >> 24;
- h &= ~g;
+ h ^= (h >> 24) & 0xf0;
}
- return (h);
+ return (h & 0x0fffffff);
}
/*
Index: sys/kern/link_elf.c
===================================================================
--- sys/kern/link_elf.c
+++ sys/kern/link_elf.c
@@ -1470,23 +1470,20 @@
}
/*
- * Hash function for symbol table lookup. Don't even think about changing
- * this. It is specified by the System V ABI.
+ * SysV hash function for symbol table lookup. It is specified by the
+ * System V ABI.
*/
-static unsigned long
+static Elf32_Word
elf_hash(const char *name)
{
const unsigned char *p = (const unsigned char *) name;
- unsigned long h = 0;
- unsigned long g;
+ Elf32_Word h = 0;
while (*p != '\0') {
h = (h << 4) + *p++;
- if ((g = h & 0xf0000000) != 0)
- h ^= g >> 24;
- h &= ~g;
+ h ^= (h >> 24) & 0xf0;
}
- return (h);
+ return (h & 0x0fffffff);
}
static int
@@ -1497,7 +1494,7 @@
unsigned long symnum;
const Elf_Sym* symp;
const char *strp;
- unsigned long hash;
+ Elf32_Word hash;
/* If we don't have a hash, bail. */
if (ef->buckets == NULL || ef->nbuckets == 0) {

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 21, 4:10 PM (15 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30081529
Default Alt Text
D39517.id120216.diff (2 KB)

Event Timeline