1## Test how --syms/-t prints the static symbol table.
2# RUN: yaml2obj --docnum=1 %s -o %t
3# RUN: llvm-objdump --syms %t > %t.txt
4# RUN: llvm-objdump -t %t | cmp - %t.txt
5# RUN: FileCheck %s --input-file=%t.txt --match-full-lines --strict-whitespace
6
7#      CHECK:SYMBOL TABLE:
8# CHECK-NEXT:0000000000000000 l    df *ABS*	0000000000000000 a.c
9# CHECK-NEXT:0000000000000000 l    d  .text	0000000000000000 .text
10# CHECK-NEXT:0000000000002000 l     O .data	0000000000000000 local_object
11# CHECK-NEXT:0000000000001fff l     F .text	0000000000000000 local_func
12# CHECK-NEXT:0000000000000000 l       *ABS*	0000000000000000 local_abs
13# CHECK-NEXT:0000000000000000 g       .data	0000000000000000 notype
14# CHECK-NEXT:0000000000000000 g     O .data	0000000000000010 object
15# CHECK-NEXT:0000000000000000 g     F .text	000000000000000f func
16# CHECK-NEXT:0000000000000000 g     O *COM*	0000000000000000 common
17# CHECK-NEXT:0000000000000000 g     O .data	0000000000000000 tls
18# CHECK-NEXT:0000000000000000 g   i   .text	0000000000000000 ifunc
19# CHECK-NEXT:0000000000000000 g       .text	0000000000000000 invalid_type
20# CHECK-NEXT:0000000000000000 g       .text	0000000000000000 STT_HIOS
21# CHECK-NEXT:0000000000000000 g       .text	0000000000000000 STT_LOPROC
22# CHECK-NEXT:0000000000000000         *UND*	0000000000000000 undef
23# CHECK-NEXT:0000000000000000         *UND*	0000000000000000 SHN_LOPROC
24# CHECK-NEXT:0000000000000000         *UND*	0000000000000000 SHN_LOOS
25# CHECK-NEXT:0000000000000000         *UND*	0000000000000000 reserve
26# CHECK-NEXT:0000000000000000 g       *ABS*	0000000000000000 abs
27# CHECK-NEXT:0000000000000000         *COM*	0000000000000000 common2
28# CHECK-NEXT:0000000000000000 u     O .data	0000000000000000 gnu_unique
29# CHECK-NEXT:0000000000000000 g       .data	0000000000000000 invalid_binding
30# CHECK-NEXT:0000000000000000 g       .data	0000000000000000 STB_HIOS
31# CHECK-NEXT:0000000000000000 g       .data	0000000000000000 STB_LOPROC
32
33--- !ELF
34FileHeader:
35  Class:   ELFCLASS64
36  Data:    ELFDATA2LSB
37  Type:    ET_EXEC
38  Machine: EM_X86_64
39Sections:
40  - Name:  .text
41    Type:  SHT_PROGBITS
42  - Name:  .data
43    Type:  SHT_PROGBITS
44Symbols:
45  - Name:    "a.c"
46    Type:    STT_FILE
47    Index:   SHN_ABS
48  - Type:    STT_SECTION
49    Section: .text
50  - Name:    local_object
51    Type:    STT_OBJECT
52    Section: .data
53    Value:   0x2000
54  - Name:    local_func
55    Type:    STT_FUNC
56    Section: .text
57    Value:   0x1fff
58  - Name:    local_abs
59    Index:   SHN_ABS
60  - Name:    notype
61    Binding: STB_GLOBAL
62    Section: .data
63  - Name:    object
64    Type:    STT_OBJECT
65    Size:    0x10
66    Binding: STB_GLOBAL
67    Section: .data
68  - Name:    func
69    Type:    STT_FUNC
70    Size:    0xf
71    Binding: STB_GLOBAL
72    Section: .text
73  - Name:    common
74    Type:    STT_COMMON
75    Binding: STB_GLOBAL
76    Section: .data
77  - Name:    tls
78    Type:    STT_TLS
79    Binding: STB_GLOBAL
80    Section: .data
81  - Name:    ifunc
82    Type:    STT_GNU_IFUNC
83    Binding: STB_GLOBAL
84    Section: .text
85  - Name:    invalid_type
86    Type:    7
87    Binding: STB_GLOBAL
88    Section: .text
89  - Name:    STT_HIOS
90    Type:    12
91    Binding: STB_GLOBAL
92    Section: .text
93  - Name:    STT_LOPROC
94    Type:    13
95    Binding: STB_GLOBAL
96    Section: .text
97  - Name:    undef
98    Binding: STB_GLOBAL
99  - Name:    SHN_LOPROC
100    Binding: STB_GLOBAL
101    Index:   0xff00
102  - Name:    SHN_LOOS
103    Binding: STB_GLOBAL
104    Index:   0xff20
105  - Name:    reserve
106    Binding: STB_GLOBAL
107    Index:   0xff40
108  - Name:    abs
109    Index:   SHN_ABS
110    Binding: STB_GLOBAL
111  - Name:    common2
112    Binding: STB_GLOBAL
113    Index:   SHN_COMMON
114  - Name:    gnu_unique
115    Type:    STT_OBJECT
116    Binding: STB_GNU_UNIQUE
117    Section: .data
118  - Name:    invalid_binding
119    Binding: 3
120    Section: .data
121  - Name:    STB_HIOS
122    Binding: 12
123    Section: .data
124  - Name:    STB_LOPROC
125    Binding: 13
126    Section: .data
127
128## For an ELF32 object, print the address and size fields as 32-bit hexadecimals.
129# RUN: yaml2obj --docnum=2 -D BITS=32 %s -o %t.32
130# RUN: llvm-objdump --syms %t.32 | FileCheck --check-prefix=ELF32 %s --match-full-lines --strict-whitespace
131## For an ELF64 object, print the address and size fields as 64-bit hexadecimals.
132# RUN: yaml2obj --docnum=2 -D BITS=64 %s -o %t.64
133# RUN: llvm-objdump --syms %t.64 | FileCheck --check-prefix=ELF64 %s --match-full-lines --strict-whitespace
134
135#      ELF32:SYMBOL TABLE:
136# ELF32-NEXT:00000000         *UND*	00000000 sym
137
138#      ELF64:SYMBOL TABLE:
139# ELF64-NEXT:0000000000000000         *UND*	0000000000000000 sym
140
141--- !ELF
142FileHeader:
143  Class:   ELFCLASS[[BITS]]
144  Data:    ELFDATA2LSB
145  Type:    ET_EXEC
146  Machine: EM_X86_64
147Symbols:
148  - Name: sym
149