Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 25 Jul 2016 22:52:59 -0500
From: Bobby Bingham <koorogi@...rogi.info>
To: musl@...ts.openwall.com
Subject: [PATCH 2/3] allow different size hash table entries

The sysv hash table for dynamic symbol lookups is supposed to always have
32 bit entries, but some architectures (alpha, s390x) botched the abi and
use 64 bit entries.  Despite this, the hash function is the same, and still
only produces 32 bit hash values.
---
 ldso/dynlink.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index 5a9e2ba..63f0e0a 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -21,6 +21,10 @@
 #include "libc.h"
 #include "dynlink.h"
 
+#ifndef hashentry_t
+#define hashentry_t uint32_t
+#endif
+
 static void error(const char *, ...);
 
 #define MAXP2(a,b) (-(-(a)&-(b)))
@@ -54,7 +58,7 @@ struct dso {
 	size_t phentsize;
 	int refcnt;
 	Sym *syms;
-	uint32_t *hashtab;
+	hashentry_t *hashtab;
 	uint32_t *ghashtab;
 	int16_t *versym;
 	char *strings;
@@ -206,7 +210,7 @@ static Sym *sysv_lookup(const char *s, uint32_t h, struct dso *dso)
 {
 	size_t i;
 	Sym *syms = dso->syms;
-	uint32_t *hashtab = dso->hashtab;
+	hashentry_t *hashtab = dso->hashtab;
 	char *strings = dso->strings;
 	for (i=hashtab[2+h%hashtab[0]]; i; i=hashtab[2+hashtab[0]+i]) {
 		if ((!dso->versym || dso->versym[i] >= 0)
-- 
2.9.0

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.