From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10334 Path: news.gmane.org!not-for-mail From: Bobby Bingham Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH 2/3] allow different size hash table entries Date: Mon, 25 Jul 2016 22:52:59 -0500 Message-ID: <20160726035300.10255-2-koorogi@koorogi.info> References: <20160726035300.10255-1-koorogi@koorogi.info> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1469505218 22341 80.91.229.3 (26 Jul 2016 03:53:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Jul 2016 03:53:38 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-10348-gllmg-musl=m.gmane.org@lists.openwall.com Tue Jul 26 05:53:38 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1bRtR2-0003vm-MR for gllmg-musl@m.gmane.org; Tue, 26 Jul 2016 05:53:36 +0200 Original-Received: (qmail 9424 invoked by uid 550); 26 Jul 2016 03:53:30 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 9338 invoked from network); 26 Jul 2016 03:53:19 -0000 X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160726035300.10255-1-koorogi@koorogi.info> Xref: news.gmane.org gmane.linux.lib.musl.general:10334 Archived-At: 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