1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
| ## Show that llvm-readobj can dump SHT_LLVM_ADDRSIG sections.
# RUN: yaml2obj --docnum=1 %s -o %t1.o
# RUN: llvm-readobj --addrsig %t1.o | FileCheck -DFILE=%t1.o %s --check-prefix LLVM
# RUN: not llvm-readelf --addrsig %t1.o 2>&1 | FileCheck -DFILE=%t1.o %s --check-prefix GNU
# LLVM: Addrsig [
# LLVM-NEXT: Sym: foo (1)
# LLVM-NEXT: Sym: bar (2)
# LLVM-NEXT: ]
# GNU: error: '[[FILE]]': --addrsig: not implemented
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .llvm_addrsig
Type: SHT_LLVM_ADDRSIG
Symbols:
- Name: foo
- Name: bar
Symbols:
- Name: foo
- Name: bar
## Check that llvm-readobj dumps any SHT_LLVM_ADDRSIG section when --all
## is specified for LLVM style, but not for GNU style.
## TODO: Refine the llvm-readelf check when GNU-style dumping is implemented.
# RUN: llvm-readobj --all %t1.o | FileCheck %s --check-prefix LLVM
# RUN: llvm-readelf --all %t1.o 2>&1 | FileCheck %s --implicit-check-not=warning --implicit-check-not=error
## Check we report a warning when SHT_LLVM_ADDRSIG is broken (e.g. contains a malformed uleb128).
# RUN: yaml2obj --docnum=2 %s -o %t2.o
# RUN: llvm-readobj --addrsig %t2.o 2>&1 | FileCheck %s -DFILE=%t2.o --check-prefix=MALFORMED
# MALFORMED: warning: '[[FILE]]': malformed uleb128, extends past end
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .llvm_addrsig
Type: SHT_LLVM_ADDRSIG
Content: "FF"
## Check we report a warning when SHT_LLVM_ADDRSIG references a symbol that can't be
## dumped (e.g. the index value is larger than the number of symbols in .symtab).
# RUN: yaml2obj --docnum=3 %s -o %t3.o
# RUN: llvm-readobj --addrsig %t3.o 2>&1 | FileCheck %s -DFILE=%t3.o --check-prefix=INVALID-INDEX
# INVALID-INDEX: Addrsig [
# INVALID-INDEX-NEXT: Sym: foo (1)
# INVALID-INDEX-EMPTY:
# INVALID-INDEX-NEXT: warning: '[[FILE]]': unable to get symbol from section [index 2]: invalid symbol index (255)
# INVALID-INDEX-NEXT: Sym: <?> (255)
# INVALID-INDEX-NEXT: Sym: bar (2)
# INVALID-INDEX-NEXT: ]
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .llvm_addrsig
Type: SHT_LLVM_ADDRSIG
Symbols:
- Index: 1
- Index: 255
- Index: 2
Symbols:
- Name: foo
- Name: bar
|