symbol-visibility.test
2.43 KB
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
85
86
87
## Show that llvm-readobj prints the symbol visibility where recognised, or
## something sensible when not, for both GNU and LLVM output.
## Check how we dump symbols when they have only STV_* bits set for st_other.
## (This is the most common case).
# RUN: yaml2obj --docnum=1 %s > %t1.o
# RUN: llvm-readobj --symbols %t1.o | FileCheck %s --check-prefix=LLVM
# RUN: llvm-readelf --symbols %t1.o | FileCheck %s --strict-whitespace --check-prefix=GNU
# LLVM: Name: default
# LLVM: Other: 0
# LLVM: Name: internal
# LLVM: Other [ (0x1)
# LLVM-NEXT: STV_INTERNAL (0x1)
# LLVM-NEXT: ]
# LLVM: Name: hidden
# LLVM: Other [ (0x2)
# LLVM-NEXT: STV_HIDDEN (0x2)
# LLVM-NEXT: ]
# LLVM: Name: protected
# LLVM: Other [ (0x3)
# LLVM-NEXT: STV_PROTECTED (0x3)
# LLVM-NEXT: ]
# GNU: Vis Ndx Name
# GNU-NEXT: DEFAULT UND
# GNU-NEXT: DEFAULT UND default
# GNU-NEXT: INTERNAL UND internal
# GNU-NEXT: HIDDEN UND hidden
# GNU-NEXT: PROTECTED UND protected
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Symbols:
- Name: default
Other: [ STV_DEFAULT ]
Binding: STB_GLOBAL
- Name: internal
Other: [ STV_INTERNAL ]
Binding: STB_GLOBAL
- Name: hidden
Other: [ STV_HIDDEN ]
Binding: STB_GLOBAL
- Name: protected
Other: [ STV_PROTECTED ]
Binding: STB_GLOBAL
## Check the output when we have non-visibility bits set for at least one of the symbols.
# RUN: yaml2obj --docnum=2 %s > %t2.o
# RUN: llvm-readobj --symbols %t2.o | FileCheck %s --check-prefixes=LLVM,LLVM-OTHER
# RUN: llvm-readelf --symbols %t2.o | FileCheck %s --strict-whitespace --check-prefix=GNU-OTHER
# LLVM-OTHER: Name: other
# LLVM-OTHER: Other [ (0x4)
# LLVM-OTHER-NEXT: ]
# GNU-OTHER: Vis Ndx Name
# GNU-OTHER-NEXT: DEFAULT UND
# GNU-OTHER-NEXT: DEFAULT UND default
# GNU-OTHER-NEXT: INTERNAL UND internal
# GNU-OTHER-NEXT: HIDDEN UND hidden
# GNU-OTHER-NEXT: PROTECTED UND protected
# GNU-OTHER-NEXT: DEFAULT [<other: 0x4>] UND other
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Symbols:
- Name: default
Other: [ STV_DEFAULT ]
- Name: internal
Other: [ STV_INTERNAL ]
- Name: hidden
Other: [ STV_HIDDEN ]
- Name: protected
Other: [ STV_PROTECTED ]
- Name: other
Other: [ 4 ]