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
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
49 ShOffset: [[VERDEFOFFSET=<none>]]
57 - Name: .gnu.version_r
79 EntSize: [[ENTSIZE=<none>]]
82 Index: [[INDEX=<none>]]
85 Index: [[INDEX=<none>]]
88 Index: [[INDEX=<none>]]
91 Index: [[INDEX=<none>]]
94 Index: [[INDEX=<none>]]
97 Index: [[INDEX=<none>]]
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
120 - Name: .gnu.version_d
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