1 # RUN: llvm-readelf --elf-hash-histogram %p/Inputs/gnuhash.so.elf-ppc64 \
2 # RUN: | FileCheck %s -check-prefix PPC64GNU
3 # RUN: llvm-readelf --elf-hash-histogram %p/Inputs/gnuhash.so.elf-x86_64 \
4 # RUN: | FileCheck %s -check-prefix X86GNU
5 # RUN: llvm-readelf --elf-hash-histogram %p/Inputs/got-plt.exe.elf-mipsel \
6 # RUN: | FileCheck %s -check-prefix SYSV
8 # PPC64GNU: Histogram for `.gnu.hash' bucket list length (total of 3 buckets)
9 # PPC64GNU-NEXT: Length Number % of total Coverage
10 # PPC64GNU-NEXT: 0 1 ( 33.3%) 0.0%
11 # PPC64GNU-NEXT: 1 1 ( 33.3%) 25.0%
12 # PPC64GNU-NEXT: 2 0 ( 0.0%) 25.0%
13 # PPC64GNU-NEXT: 3 1 ( 33.3%) 100.0%
15 # X86GNU: Histogram for `.gnu.hash' bucket list length (total of 3 buckets)
16 # X86GNU-NEXT: Length Number % of total Coverage
17 # X86GNU-NEXT: 0 1 ( 33.3%) 0.0%
18 # X86GNU-NEXT: 1 1 ( 33.3%) 25.0%
19 # X86GNU-NEXT: 2 0 ( 0.0%) 25.0%
20 # X86GNU-NEXT: 3 1 ( 33.3%) 100.0%
22 # SYSV: Histogram for bucket list length (total of 3 buckets)
23 # SYSV-NEXT: Length Number % of total Coverage
24 # SYSV-NEXT: 0 0 ( 0.0%) 0.0%
25 # SYSV-NEXT: 1 0 ( 0.0%) 0.0%
26 # SYSV-NEXT: 2 2 ( 66.7%) 57.1%
27 # SYSV-NEXT: 3 1 ( 33.3%) 100.0%
29 ## Show that we report a warning for a hash table which contains an entry of
30 ## the bucket array pointing to a cycle.
32 # RUN: yaml2obj %s -o %t.o
33 # RUN: llvm-readelf --elf-hash-histogram 2>&1 %t.o | FileCheck -DFILE=%t.o %s --check-prefix BROKEN
35 # BROKEN: warning: '[[FILE]]': .hash section is invalid: bucket 1: a cycle was detected in the linked chain
36 # BROKEN: Histogram for bucket list length (total of 1 buckets)
37 # BROKEN-NEXT: Length Number % of total Coverage
38 # BROKEN-NEXT: 0 0 ( 0.0%) 0.0%
39 # BROKEN-NEXT: 1 1 (100.0%) 100.0%
57 ## llvm-readelf will read the hash table from the file offset
58 ## p_offset + (p_vaddr - DT_HASH) = p_offset + (0 - 0) = p_offset,
59 ## which is the start of PT_LOAD, i.e. the file offset of .hash.