2 .\" Copyright 1989 AT&T Copyright (c) 2001, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH ELF_HASH 3ELF "Jul 11, 2001"
8 elf_hash \- compute hash value
12 cc [ \fIflag\fR ... ] \fIfile\fR ... \fB-lelf\fR [ \fIlibrary\fR ... ]
15 \fBunsigned long\fR \fBelf_hash\fR(\fBconst char *\fR\fIname\fR);
21 The \fBelf_hash()\fR function computes a hash value, given a null terminated
22 string, \fIname\fR. The returned hash value, \fIh\fR, can be used as a bucket
23 index, typically after computing \fIh \fRmod x to ensure appropriate bounds.
26 Hash tables may be built on one machine and used on another because
27 \fBelf_hash()\fR uses unsigned arithmetic to avoid possible differences in
28 various machines' signed arithmetic. Although \fIname\fR is shown as
29 \fBchar*\fR above, \fBelf_hash()\fR treats it as \fBunsigned char*\fR to avoid
30 sign extension differences. Using \fBchar*\fR eliminates type conflicts with
31 expressions such as \fBelf_hash(\fR\fIname\fR\fB).\fR
34 \fBELF\fR files' symbol hash tables are computed using this function (see
35 \fBelf_getdata\fR(3ELF) and \fBelf32_xlatetof\fR(3ELF)). The hash value
36 returned is guaranteed not to be the bit pattern of all ones ( \fB~0UL\fR).
40 See \fBattributes\fR(5) for descriptions of the following attributes:
48 ATTRIBUTE TYPE ATTRIBUTE VALUE
50 Interface Stability Stable
58 \fBelf\fR(3ELF), \fBelf32_xlatetof\fR(3ELF), \fBelf_getdata\fR(3ELF),
59 \fBlibelf\fR(3LIB), \fBattributes\fR(5)