[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / test / tools / llvm-objdump / ELF / dynsym-version.test
blobe21b3544be8543026f3289dd1f816b524ae00fbe
1 ## Check we print symbol versions, when they are available.
3 ## Test undefined symbols.
4 # RUN: yaml2obj %s -o %t-undef.o
5 # RUN: llvm-objdump -T %t-undef.o 2>&1 | tr '\t' '|' | FileCheck %s \
6 # RUN:   -DFILE=%t-undef.o --check-prefix=UNDEF --match-full-lines --strict-whitespace
8 ## version2sym and version3sym are invalid: undefined symbols cannot refer to .gnu.version_d.
9 ## We still check their behaviors.
10 #      UNDEF:DYNAMIC SYMBOL TABLE:
11 # UNDEF-NEXT:0000000000000000      D  *UND*|0000000000000000              localversym
12 # UNDEF-NEXT:0000000000000000      D  *UND*|0000000000000000              globalversym
13 # UNDEF-NEXT:0000000000000000      D  *UND*|0000000000000000 (v2)         version2sym
14 # UNDEF-NEXT:0000000000000000      D  *UND*|0000000000000000 (v3hidden)   version3sym
15 # UNDEF-NEXT:0000000000000000      D  *UND*|0000000000000000 (v4)         version4sym
16 # UNDEF-NEXT:0000000000000000      D  *UND*|0000000000000000 (v5hidden)   .hidden version5sym
18 ## Test defined symbols.
19 # RUN: yaml2obj -DINDEX=0x1 %s -o %t-def.o
20 # RUN: llvm-objdump -T %t-def.o 2>&1 | tr '\t' '|' | FileCheck %s \
21 # RUN:   -DFILE=%t-def.o --check-prefix=DEF --match-full-lines --strict-whitespace
23 #      DEF:DYNAMIC SYMBOL TABLE:
24 # DEF-NEXT:0000000000000000 g    D  .gnu.version|0000000000000000              localversym
25 # DEF-NEXT:0000000000000000 g    D  .gnu.version|0000000000000000              globalversym
26 # DEF-NEXT:0000000000000000 g    D  .gnu.version|0000000000000000  v2          version2sym
27 # DEF-NEXT:0000000000000000 g    D  .gnu.version|0000000000000000 (v3hidden)   version3sym
28 # DEF-NEXT:0000000000000000 g    D  .gnu.version|0000000000000000 (v4)         version4sym
29 # DEF-NEXT:0000000000000000 g    D  .gnu.version|0000000000000000 (v5hidden)   .hidden version5sym
31 --- !ELF
32 FileHeader:
33   Class: ELFCLASS64
34   Data:  ELFDATA2LSB
35   Type:  ET_DYN
36 Sections:
37   - Name:    .gnu.version
38     Type:    SHT_GNU_versym
39     Flags:   [ SHF_ALLOC ]
40 ## 0x8000 is a special VERSYM_HIDDEN bit.
41     Entries: [ 0, 0, 1, 2, 0x8003, 4, 0x8005 ]
42     ShSize:  [[VERSYMSIZE=<none>]]
43   - Name:         .gnu.version_d
44     Type:         SHT_GNU_verdef
45     Flags:        [ SHF_ALLOC ]
46     Link:         .dynstr
47     AddressAlign: 0x4
48     Info:         0x2
49     ShOffset:     [[VERDEFOFFSET=<none>]]
50     Entries:
51       - VersionNdx: 2
52         Names:
53           - v2
54       - VersionNdx: 3
55         Names:
56           - v3hidden
57   - Name:  .gnu.version_r
58     Type:  SHT_GNU_verneed
59     Flags: [ SHF_ALLOC ]
60     Link:  .dynstr
61     Info:  0x2
62     Dependencies:
63       - Version: 1
64         File:    file1.so
65         Entries:
66           - Name:  v4
67             Hash:  0
68             Flags: 0
69             Other: 4
70       - Version: 1
71         File:    file2.0
72         Entries:
73           - Name:  v5hidden
74             Hash:  0
75             Flags: 0
76             Other: 5
77   - Name:    .dynsym
78     Type:    SHT_DYNSYM
79     EntSize: [[ENTSIZE=<none>]]
80 DynamicSymbols:
81   - Name:  localversym
82     Index: [[INDEX=<none>]]
83     Binding: STB_GLOBAL
84   - Name:  globalversym
85     Index: [[INDEX=<none>]]
86     Binding: STB_GLOBAL
87   - Name:  version2sym
88     Index: [[INDEX=<none>]]
89     Binding: STB_GLOBAL
90   - Name:  version3sym
91     Index: [[INDEX=<none>]]
92     Binding: STB_GLOBAL
93   - Name:  version4sym
94     Index: [[INDEX=<none>]]
95     Binding: STB_GLOBAL
96   - Name:  version5sym
97     Index: [[INDEX=<none>]]
98     Other: [ STV_HIDDEN ]
99     Binding: STB_GLOBAL
101 ## Test the output with a long version name.
102 # RUN: yaml2obj --docnum=2 %s -o %t2
103 # RUN: llvm-objdump -T %t2 2>&1 | tr '\t' '|' | FileCheck %s \
104 # RUN:   --check-prefix=LONGNAME --match-full-lines --strict-whitespace
106 #      LONGNAME:DYNAMIC SYMBOL TABLE:
107 # LONGNAME-NEXT:0000000000000000 g    D  .gnu.version|0000000000000000  v2          sym1
108 # LONGNAME-NEXT:0000000000000000 g    D  .gnu.version|0000000000000000  v3withverylongname sym2
110 --- !ELF
111 FileHeader:
112   Class: ELFCLASS64
113   Data:  ELFDATA2LSB
114   Type:  ET_DYN
115 Sections:
116   - Name:    .gnu.version
117     Type:    SHT_GNU_versym
118     Flags:   [ SHF_ALLOC ]
119     Entries: [ 1, 2, 3 ]
120   - Name:         .gnu.version_d
121     Type:         SHT_GNU_verdef
122     Flags:        [ SHF_ALLOC ]
123     Link:         .dynstr
124     AddressAlign: 0x4
125     Info:         0x2
126     Entries:
127       - VersionNdx: 2
128         Names:
129           - v2
130       - VersionNdx: 3
131         Names:
132           - v3withverylongname
133   - Name:    .dynsym
134     Type:    SHT_DYNSYM
135 DynamicSymbols:
136   - Name:  sym1
137     Index: 1
138     Binding: STB_GLOBAL
139   - Name:  sym2
140     Index: 1
141     Binding: STB_GLOBAL
143 ## Check we report a warning when we are unable to read a SHT_GNU_versym section entry.
144 ## In this case, the section has a size that is not a multiple of its sh_entsize.
146 # RUN: yaml2obj -DVERSYMSIZE=0xff %s -o %t2-broken-versym.o
147 # RUN: llvm-objdump -T %t2-broken-versym.o 2>&1 | FileCheck %s --check-prefixes=VERSION-ERR1,NOVER
149 # VERSION-ERR1:warning: {{.*}}: unable to read an entry with index 1 from SHT_GNU_versym section
150 # NOVER-NEXT:0000000000000000      D  *UND*  0000000000000000 localversym
151 # NOVER-NEXT:0000000000000000      D  *UND*  0000000000000000 globalversym
152 # NOVER-NEXT:0000000000000000      D  *UND*  0000000000000000 version2sym
153 # NOVER-NEXT:0000000000000000      D  *UND*  0000000000000000 version3sym
154 # NOVER-NEXT:0000000000000000      D  *UND*  0000000000000000 version4sym
155 # NOVER-NEXT:0000000000000000      D  *UND*  0000000000000000 .hidden version5sym