mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Bobby Bingham <koorogi@koorogi.info>
To: musl@lists.openwall.com
Subject: [PATCH 2/3] allow different size hash table entries
Date: Mon, 25 Jul 2016 22:52:59 -0500	[thread overview]
Message-ID: <20160726035300.10255-2-koorogi@koorogi.info> (raw)
In-Reply-To: <20160726035300.10255-1-koorogi@koorogi.info>

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



  reply	other threads:[~2016-07-26  3:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-26  3:52 [PATCH 1/3] treat null vdso base same as missing Bobby Bingham
2016-07-26  3:52 ` Bobby Bingham [this message]
2016-07-27 16:49   ` [PATCH 2/3] allow different size hash table entries Alexander Monakov
2016-07-26  3:53 ` [PATCH 3/3] add s390x port Bobby Bingham
2016-10-21 20:27   ` Rich Felker
2016-10-22  0:15     ` Bobby Bingham
2016-10-22  2:59       ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160726035300.10255-2-koorogi@koorogi.info \
    --to=koorogi@koorogi.info \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).