Tue Apr 18 22:42:52 2023 UTC ()
Oops wrong mask.


(christos)
diff -r1.74 -r1.75 src/libexec/ld.elf_so/symbol.c

cvs diff -r1.74 -r1.75 src/libexec/ld.elf_so/symbol.c (expand / switch to unified diff)

--- src/libexec/ld.elf_so/symbol.c 2023/04/18 16:48:45 1.74
+++ src/libexec/ld.elf_so/symbol.c 2023/04/18 22:42:52 1.75
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: symbol.c,v 1.74 2023/04/18 16:48:45 christos Exp $ */ 1/* $NetBSD: symbol.c,v 1.75 2023/04/18 22:42:52 christos Exp $ */
2 2
3/* 3/*
4 * Copyright 1996 John D. Polstra. 4 * Copyright 1996 John D. Polstra.
5 * Copyright 1996 Matt Thomas <matt@3am-software.com> 5 * Copyright 1996 Matt Thomas <matt@3am-software.com>
6 * Copyright 2002 Charles M. Hannum <root@ihack.net> 6 * Copyright 2002 Charles M. Hannum <root@ihack.net>
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -30,27 +30,27 @@ @@ -30,27 +30,27 @@
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35/* 35/*
36 * Dynamic linker for ELF. 36 * Dynamic linker for ELF.
37 * 37 *
38 * John Polstra <jdp@polstra.com>. 38 * John Polstra <jdp@polstra.com>.
39 */ 39 */
40 40
41#include <sys/cdefs.h> 41#include <sys/cdefs.h>
42#ifndef lint 42#ifndef lint
43__RCSID("$NetBSD: symbol.c,v 1.74 2023/04/18 16:48:45 christos Exp $"); 43__RCSID("$NetBSD: symbol.c,v 1.75 2023/04/18 22:42:52 christos Exp $");
44#endif /* not lint */ 44#endif /* not lint */
45 45
46#include <err.h> 46#include <err.h>
47#include <errno.h> 47#include <errno.h>
48#include <fcntl.h> 48#include <fcntl.h>
49#include <stdarg.h> 49#include <stdarg.h>
50#include <stdio.h> 50#include <stdio.h>
51#include <stdlib.h> 51#include <stdlib.h>
52#include <string.h> 52#include <string.h>
53#include <unistd.h> 53#include <unistd.h>
54#include <sys/types.h> 54#include <sys/types.h>
55#include <sys/mman.h> 55#include <sys/mman.h>
56#include <sys/bitops.h> 56#include <sys/bitops.h>
@@ -84,27 +84,27 @@ _rtld_donelist_check(DoneList *dlp, cons @@ -84,27 +84,27 @@ _rtld_donelist_check(DoneList *dlp, cons
84 * SysV hash function for symbol table lookup. It is a slightly optimized 84 * SysV hash function for symbol table lookup. It is a slightly optimized
85 * version of the hash specified by the System V ABI. 85 * version of the hash specified by the System V ABI.
86 */ 86 */
87Elf32_Word 87Elf32_Word
88_rtld_sysv_hash(const char *name) 88_rtld_sysv_hash(const char *name)
89{ 89{
90 const unsigned char *p = (const unsigned char *) name; 90 const unsigned char *p = (const unsigned char *) name;
91 Elf32_Word h = 0; 91 Elf32_Word h = 0;
92 92
93 while (__predict_true(*p != '\0')) { 93 while (__predict_true(*p != '\0')) {
94 h = (h << 4) + *p++; 94 h = (h << 4) + *p++;
95 h ^= (h >> 24) & 0xf0; 95 h ^= (h >> 24) & 0xf0;
96 } 96 }
97 return (h & 0xffffffff); 97 return (h & 0x0fffffff);
98} 98}
99 99
100/* 100/*
101 * Hash function for symbol table lookup. Don't even think about changing 101 * Hash function for symbol table lookup. Don't even think about changing
102 * this. It is specified by the GNU toolchain ABI. 102 * this. It is specified by the GNU toolchain ABI.
103 */ 103 */
104Elf32_Word 104Elf32_Word
105_rtld_gnu_hash(const char *name) 105_rtld_gnu_hash(const char *name)
106{ 106{
107 const unsigned char *p = (const unsigned char *) name; 107 const unsigned char *p = (const unsigned char *) name;
108 uint_fast32_t h = 5381; 108 uint_fast32_t h = 5381;
109 unsigned char c; 109 unsigned char c;
110 110