1 ## Show that llvm-readelf + llvm-readobj demangle symbol names in symbol tables
2 ## (including dynamic symbols), relocations (including dynamic relocations), and groups.
4 # RUN: yaml2obj %s > %t.so
6 ## Check LLVM output style.
7 # RUN: llvm-readobj --symbols --relocations --dyn-symbols --dyn-relocations \
8 # RUN: --elf-section-groups --elf-cg-profile --addrsig \
9 # RUN: --demangle %t.so > %t.llvm.long
10 # RUN: llvm-readobj --symbols --relocations --dyn-symbols --dyn-relocations \
11 # RUN: --elf-section-groups --elf-cg-profile --addrsig \
12 # RUN: -C %t.so > %t.llvm.short
13 # RUN: FileCheck %s --input-file %t.llvm.long --check-prefixes=LLVM-COMMON,LLVM-DEMANGLE
14 # RUN: diff %t.llvm.long %t.llvm.short
16 ## Check that default is no demangling.
17 # RUN: llvm-readobj --symbols --relocations --dyn-symbols --dyn-relocations \
18 # RUN: --elf-section-groups --elf-cg-profile --addrsig \
19 # RUN: %t.so > %t.llvm.default
20 # RUN: llvm-readobj --symbols --relocations --dyn-symbols --dyn-relocations \
21 # RUN: --elf-section-groups --elf-cg-profile --addrsig \
22 # RUN: --demangle=false %t.so > %t.llvm.nodemangle
23 # RUN: FileCheck %s --input-file %t.llvm.default --check-prefixes=LLVM-COMMON,LLVM-MANGLED
24 # RUN: diff %t.llvm.default %t.llvm.nodemangle
26 # LLVM-COMMON: Relocations [
27 # LLVM-COMMON: Section {{.*}} .rela.text.foo {
28 # LLVM-DEMANGLE-NEXT: {{ }}foo(char){{ }}
29 # LLVM-MANGLED-NEXT: {{ }}_Z3fooc{{ }}
33 # LLVM-COMMON: Dynamic Relocations {
34 # LLVM-DEMANGLE-NEXT: {{ }}foo(int){{ }}
35 # LLVM-MANGLED-NEXT: {{ }}_Z3fooi{{ }}
38 # LLVM-COMMON: Symbols [
39 # LLVM-DEMANGLE: Name: foo(char){{ }}
40 # LLVM-DEMANGLE: Name: blah(float){{ }}
41 # LLVM-MANGLED: Name: _Z3fooc{{ }}
42 # LLVM-MANGLED: Name: _Z4blahf{{ }}
45 # LLVM-COMMON: DynamicSymbols [
46 # LLVM-DEMANGLE: Name: foo(int){{ }}
47 # LLVM-MANGLED: Name: _Z3fooi{{ }}
50 # LLVM-COMMON: Groups {
51 # LLVM-DEMANGLE: Signature: foo(char){{$}}
52 # LLVM-MANGLED: Signature: _Z3fooc{{$}}
55 # LLVM-COMMON: CGProfile [
56 # LLVM-DEMANGLE: From: foo(char){{ }}
57 # LLVM-DEMANGLE: To: blah(float){{ }}
58 # LLVM-MANGLED: From: _Z3fooc{{ }}
59 # LLVM-MANGLED: To: _Z4blahf{{ }}
62 # LLVM-COMMON: Addrsig [
63 # LLVM-DEMANGLE-NEXT: Sym: foo(char){{ }}
64 # LLVM-DEMANGLE-NEXT: Sym: blah(float){{ }}
65 # LLVM-MANGLED-NEXT: Sym: _Z3fooc{{ }}
66 # LLVM-MANGLED-NEXT: Sym: _Z4blahf{{ }}
69 ## Check GNU output style.
70 # RUN: llvm-readelf --symbols --relocations --dyn-symbols --dyn-relocations \
71 # RUN: --elf-section-groups --demangle %t.so > %t.gnu.long
72 # RUN: llvm-readelf --symbols --relocations --dyn-symbols --dyn-relocations \
73 # RUN: --elf-section-groups -C %t.so > %t.gnu.short
74 # RUN: FileCheck %s --input-file %t.gnu.long --check-prefixes=GNU-COMMON,GNU-DEMANGLE
75 # RUN: diff %t.gnu.long %t.gnu.short
77 ## Check that default is no demangling.
78 # RUN: llvm-readelf --symbols --relocations --dyn-symbols --dyn-relocations \
79 # RUN: --elf-section-groups %t.so > %t.gnu.default
80 # RUN: llvm-readelf --symbols --relocations --dyn-symbols --dyn-relocations \
81 # RUN: --elf-section-groups --demangle=false %t.so > %t.gnu.nodemangle
82 # RUN: FileCheck %s --input-file %t.gnu.default --check-prefixes=GNU-COMMON,GNU-MANGLED
83 # RUN: diff %t.gnu.default %t.gnu.nodemangle
85 # GNU-COMMON: Relocation section '.rela.text.foo' at offset {{.*}} contains 1 entries:
86 # GNU-COMMON-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
87 # GNU-DEMANGLE-NEXT: foo(char){{ }}
88 # GNU-MANGLED-NEXT: _Z3fooc{{ }}
90 # GNU-COMMON: 'RELA' relocation section at offset {{.*}} contains 24 bytes:
91 # GNU-COMMON-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
92 # GNU-DEMANGLE-NEXT: foo(int){{ }}
93 # GNU-MANGLED-NEXT: _Z3fooi{{ }}
95 # GNU-COMMON: Symbol table '.dynsym' contains 2 entries:
96 # GNU-COMMON-NEXT: Num: Value Size Type Bind Vis Ndx Name
97 # GNU-COMMON-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
98 # GNU-DEMANGLE-NEXT: foo(int){{$}}
99 # GNU-MANGLED-NEXT: _Z3fooi{{$}}
101 # GNU-COMMON: Symbol table '.symtab' contains 3 entries:
102 # GNU-COMMON-NEXT: Num: Value Size Type Bind Vis Ndx Name
103 # GNU-COMMON-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
104 # GNU-DEMANGLE-NEXT: foo(char){{$}}
105 # GNU-DEMANGLE-NEXT: blah(float){{$}}
106 # GNU-MANGLED-NEXT: _Z3fooc{{$}}
107 # GNU-MANGLED-NEXT: _Z4blahf{{$}}
109 # GNU-COMMON: COMDAT group section [{{.*}}] `.group'
110 # GNU-DEMANGLE-SAME: [foo(char)]
111 # GNU-MANGLED-SAME: [_Z3fooc]
148 Address: 0x0000000000001000
150 AddressAlign: 0x0000000000001000
151 EntSize: 0x0000000000000010
154 Value: 0x0000000000000000
156 Value: 0x0000000000000009
158 Value: 0x0000000000000100
160 Value: 0x0000000000000018
162 Value: 0x0000000000000200
164 Value: 0x0000000000000018
166 Value: 0x0000000000000018
168 Value: 0x0000000000000000
171 Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
180 - SectionOrType: GRP_COMDAT
181 - SectionOrType: .text.foo
182 - Name: .rela.text.foo
190 - Name: .llvm.call-graph-profile
191 Type: SHT_LLVM_CALL_GRAPH_PROFILE
194 Content: "01000000020000002000000000000000"
195 - Name: .llvm_addrsig
196 Type: SHT_LLVM_ADDRSIG
213 Flags: [ PF_R, PF_X ]