aboutsummaryrefslogtreecommitdiffstats
path: root/linker/linker.c
diff options
context:
space:
mode:
Diffstat (limited to 'linker/linker.c')
-rw-r--r--linker/linker.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/linker/linker.c b/linker/linker.c
index bb31703bf..6a80ce7da 100644
--- a/linker/linker.c
+++ b/linker/linker.c
@@ -438,9 +438,16 @@ static unsigned elfhash(const char *_name)
while(*name) {
h = (h << 4) + *name++;
g = h & 0xf0000000;
- h ^= g;
+ /* The hash algorithm in the ELF ABI is as follows:
+ * if (g != 0)
+ * h ^=g >> 24;
+ * h &= ~g;
+ * But we can use the equivalent and faster implementation:
+ */
h ^= g >> 24;
}
+ /* Lift the operation out of the inner loop */
+ h &= 0x0fffffff;
return h;
}