1 # RUN: llvm-readelf --hash-symbols %p/Inputs/dynamic-table-exe.x86 \
2 # RUN: | FileCheck %s --check-prefix HASH
4 # HASH: Symbol table of .hash for image:
5 # HASH-NEXT: Num Buc: Value Size Type Bind Vis Ndx Name
6 # HASH-NEXT: 9 0: 00000000 0 FUNC GLOBAL DEFAULT UND __gxx_personality_v0@CXXABI_1.3
7 # HASH-NEXT: 13 0: 00001b64 0 NOTYPE GLOBAL DEFAULT ABS _edata{{$}}
8 # HASH-NEXT: 7 0: 00000000 0 FUNC GLOBAL DEFAULT UND _ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@GLIBCXX_3.4
9 # HASH-NEXT: 2 0: 00000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses{{$}}
10 # HASH-NEXT: 1 0: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__{{$}}
11 # HASH-NEXT: 16 1: 00000850 81 FUNC GLOBAL DEFAULT 14 main{{$}}
12 # HASH-NEXT: 10 1: 00000000 0 FUNC GLOBAL DEFAULT UND _Unwind_Resume@GCC_3.0
13 # HASH-NEXT: 8 1: 00000000 0 FUNC GLOBAL DEFAULT UND puts@GLIBC_2.0
14 # HASH-NEXT: 12 1: 00001b68 0 NOTYPE GLOBAL DEFAULT ABS _end{{$}}
15 # HASH-NEXT: 6 1: 00000000 0 FUNC GLOBAL DEFAULT UND _ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@GLIBCXX_3.4
16 # HASH-NEXT: 5 1: 00000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable{{$}}
17 # HASH-NEXT: 4 1: 00000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable{{$}}
18 # HASH-NEXT: 3 1: 00000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.0
19 # HASH-NEXT: 11 2: 00000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.1.3
20 # HASH-NEXT: 15 2: 00001b64 0 NOTYPE GLOBAL DEFAULT ABS __bss_start{{$}}
21 # HASH-NEXT: 14 2: 0000093c 4 OBJECT GLOBAL DEFAULT 16 _IO_stdin_used{{$}}
22 # HASH: Symbol table of .gnu.hash for image:
23 # HASH-NEXT: Num Buc: Value Size Type Bind Vis Ndx Name
24 # HASH-NEXT: 12 0: 00001b68 0 NOTYPE GLOBAL DEFAULT ABS _end{{$}}
25 # HASH-NEXT: 13 0: 00001b64 0 NOTYPE GLOBAL DEFAULT ABS _edata{{$}}
26 # HASH-NEXT: 14 1: 0000093c 4 OBJECT GLOBAL DEFAULT 16 _IO_stdin_used{{$}}
27 # HASH-NEXT: 15 1: 00001b64 0 NOTYPE GLOBAL DEFAULT ABS __bss_start{{$}}
28 # HASH-NEXT: 16 1: 00000850 81 FUNC GLOBAL DEFAULT 14 main{{$}}
30 ## Show that if there are no hash sections, we do not print anything.
31 # RUN: yaml2obj %s -o %t.o
32 # RUN: llvm-readelf --hash-symbols %t.o \
33 # RUN: | FileCheck %s --check-prefix NO-HASH --allow-empty
37 ## Sanity check that we can still find the dynamic symbols (i.e. the above test
38 ## doesn't pass due to a mistake in the dynamic section).
39 # RUN: llvm-readelf --dyn-symbols %t.o | FileCheck %s --check-prefix DYNSYMS
41 # DYNSYMS: Symbol table '.dynsym' contains 2 entries:
50 ## TODO: Replace the raw section contents with more meaningful dynamic
51 ## tags/symbols/etc, once yaml2obj supports it.
52 ## FIXME: yaml2obj does not currently allow custom addresses for .dynstr and
53 ## .dynsym if DynamicSymbols are specified.
54 ## See https://bugs.llvm.org/show_bug.cgi?id=40339
61 Content: "005f5a33666f6f6900"
70 ## st_name: 1; st_info: Global | Func; st_other: 0;
71 ## st_shndx: .text.foo; st_value: 0x2000; st_size: 0
72 Content: "000000000000000000000000000000000000000000000000010000001200040000200000000000000000000000000000"
76 Address: 0x0000000000001000
78 AddressAlign: 0x0000000000001000
79 EntSize: 0x0000000000000010
82 Value: 0x0000000000000000
84 Value: 0x0000000000000009
86 Value: 0x0000000000000100
88 Value: 0x0000000000000018
90 Value: 0x0000000000000000
93 Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]