1elf_hash(3ELF)               ELF Library Functions              elf_hash(3ELF)
2
3
4

NAME

6       elf_hash - compute hash value
7

SYNOPSIS

9       cc [ flag ... ] file ... -lelf [ library ... ]
10       #include <libelf.h>
11
12       unsigned long elf_hash(const char *name);
13
14

DESCRIPTION

16       The  elf_hash() function computes a hash value, given a null terminated
17       string, name. The returned hash value, h,  can  be  used  as  a  bucket
18       index, typically after computing h mod x to ensure appropriate bounds.
19
20
21       Hash  tables  may  be  built on one machine and used on another because
22       elf_hash() uses unsigned arithmetic to avoid possible   differences  in
23       various  machines'  signed  arithmetic. Although name is shown as char*
24       above, elf_hash() treats it as unsigned char* to avoid  sign  extension
25       differences.  Using  char*  eliminates  type conflicts with expressions
26       such as elf_hash(name).
27
28
29       ELF files' symbol hash tables are computed  using  this  function  (see
30       elf_getdata(3ELF) and elf32_xlatetof(3ELF)). The hash value returned is
31       guaranteed not to be the bit pattern of all ones ( ~0UL).
32

ATTRIBUTES

34       See attributes(5) for descriptions of the following attributes:
35
36
37
38
39       ┌─────────────────────────────┬─────────────────────────────┐
40       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
41       ├─────────────────────────────┼─────────────────────────────┤
42       │Interface Stability          │Stable                       │
43       ├─────────────────────────────┼─────────────────────────────┤
44       │MT-Level                     │MT-Safe                      │
45       └─────────────────────────────┴─────────────────────────────┘
46

SEE ALSO

48       elf(3ELF),   elf32_xlatetof(3ELF),   elf_getdata(3ELF),   libelf(3LIB),
49       attributes(5)
50
51
52
53SunOS 5.11                        11 Jul 2001                   elf_hash(3ELF)
Impressum