From 603f3daee7edd4c85661a090108ba15ea56f9cc2 Mon Sep 17 00:00:00 2001 From: njoly Date: Wed, 16 Mar 2011 11:44:01 +0000 Subject: [PATCH] Convert hashtab to Elf_Symindx type, and use it directly to get symbol count. Remove now unused GETVECWORDn macro. This is needed to make it work on alpha which use non-standard 64bit values for the symbol hash table section, unlike all other archs. --- lib/librumpuser/rumpuser_dl.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/lib/librumpuser/rumpuser_dl.c b/lib/librumpuser/rumpuser_dl.c index 1eca5a3b0122..900bf29669c1 100644 --- a/lib/librumpuser/rumpuser_dl.c +++ b/lib/librumpuser/rumpuser_dl.c @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_dl.c,v 1.5 2010/12/30 15:47:30 pooka Exp $ */ +/* $NetBSD: rumpuser_dl.c,v 1.6 2011/03/16 11:44:01 njoly Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -31,7 +31,7 @@ */ #include -__RCSID("$NetBSD: rumpuser_dl.c,v 1.5 2010/12/30 15:47:30 pooka Exp $"); +__RCSID("$NetBSD: rumpuser_dl.c,v 1.6 2011/03/16 11:44:01 njoly Exp $"); #include #include @@ -123,17 +123,6 @@ do { \ } \ } while (/*CONSTCOND*/0) -#define GETVECWORDn(base, n, result) \ -do { \ - if (eident == ELFCLASS32) { \ - Elf32_Word *vec = base; \ - result = vec[n]; \ - } else { \ - Elf64_Word *vec = base; \ - result = vec[n]; \ - } \ -} while (/*CONSTCOND*/0) - #define SYM_GETSIZE() ((eident==ELFCLASS32)?sizeof(Elf32_Sym):sizeof(Elf64_Sym)) static int @@ -177,7 +166,7 @@ getsymbols(struct link_map *map) for (i = 0; ed_tag != DT_NULL;) { uintptr_t edptr; size_t edval; - void *hashtab; + Elf_Symindx *hashtab; switch (ed_tag) { case DT_SYMTAB: @@ -194,8 +183,8 @@ getsymbols(struct link_map *map) break; case DT_HASH: DYNn_GETMEMBER(ed_base, i, d_un.d_ptr, edptr); - hashtab = map->l_addr + edptr; - GETVECWORDn(hashtab, 1, cursymcount); + hashtab = (Elf_Symindx *)(map->l_addr + edptr); + cursymcount = hashtab[1]; break; case DT_SYMENT: DYNn_GETMEMBER(ed_base, i, d_un.d_val, edval);