aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/tools/llvm-objdump/ELF/symbol-table.test
blob: cba5f75892935f1a49601aa27d8f4116f5f987b8 (plain)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
## Test how --syms/-t prints the static symbol table.
# RUN: yaml2obj --docnum=1 %s -o %t
# RUN: llvm-objdump --syms %t > %t.txt
# RUN: llvm-objdump -t %t | cmp - %t.txt
# RUN: FileCheck %s --input-file=%t.txt --match-full-lines --strict-whitespace

#      CHECK:{{.*}}file format elf64-x86-64
#CHECK-EMPTY:
# CHECK-NEXT:SYMBOL TABLE:
# CHECK-NEXT:0000000000000000 l    df *ABS*	0000000000000000 a.c
# CHECK-NEXT:0000000000000000 l    d  .text	0000000000000000 .text
# CHECK-NEXT:0000000000002000 l     O .data	0000000000000000 local_object
# CHECK-NEXT:0000000000001fff l     F .text	0000000000000000 local_func
# CHECK-NEXT:0000000000000000 l       *ABS*	0000000000000000 local_abs
# CHECK-NEXT:0000000000000000 g       .data	0000000000000000 notype
# CHECK-NEXT:0000000000000000 g     O .data	0000000000000010 object
# CHECK-NEXT:0000000000000000 g     F .text	000000000000000f func
# CHECK-NEXT:0000000000000000 g     O *COM*	0000000000000000 common
# CHECK-NEXT:0000000000000000 g       .data	0000000000000000 tls
# CHECK-NEXT:0000000000000000 g   i   .text	0000000000000000 ifunc
# CHECK-NEXT:0000000000000000 g       .text	0000000000000000 invalid_type
# CHECK-NEXT:0000000000000000 g       .text	0000000000000000 STT_HIOS
# CHECK-NEXT:0000000000000000 g       .text	0000000000000000 STT_LOPROC
# CHECK-NEXT:0000000000000000         *UND*	0000000000000000 undef
# CHECK-NEXT:0000000000000000         *UND*	0000000000000000 SHN_LOPROC
# CHECK-NEXT:0000000000000000         *UND*	0000000000000000 SHN_LOOS
# CHECK-NEXT:0000000000000000         *UND*	0000000000000000 reserve
# CHECK-NEXT:0000000000000000 g       *ABS*	0000000000000000 abs
# CHECK-NEXT:0000000000000000         *COM*	0000000000000000 common2
# CHECK-NEXT:0000000000000000 u     O .data	0000000000000000 gnu_unique
# CHECK-NEXT:0000000000000000 g       .data	0000000000000000 invalid_binding
# CHECK-NEXT:0000000000000000 g       .data	0000000000000000 STB_HIOS
# CHECK-NEXT:0000000000000000 g       .data	0000000000000000 STB_LOPROC

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
Sections:
  - Name:  .text
    Type:  SHT_PROGBITS
  - Name:  .data
    Type:  SHT_PROGBITS
Symbols:
  - Name:    "a.c"
    Type:    STT_FILE
    Index:   SHN_ABS
  - Type:    STT_SECTION
    Section: .text
  - Name:    local_object
    Type:    STT_OBJECT
    Section: .data
    Value:   0x2000
  - Name:    local_func
    Type:    STT_FUNC
    Section: .text
    Value:   0x1fff
  - Name:    local_abs
    Index:   SHN_ABS
  - Name:    notype
    Binding: STB_GLOBAL
    Section: .data
  - Name:    object
    Type:    STT_OBJECT
    Size:    0x10
    Binding: STB_GLOBAL
    Section: .data
  - Name:    func
    Type:    STT_FUNC
    Size:    0xf
    Binding: STB_GLOBAL
    Section: .text
  - Name:    common
    Type:    STT_COMMON
    Binding: STB_GLOBAL
    Section: .data
  - Name:    tls
    Type:    STT_TLS
    Binding: STB_GLOBAL
    Section: .data
  - Name:    ifunc
    Type:    STT_GNU_IFUNC
    Binding: STB_GLOBAL
    Section: .text
  - Name:    invalid_type
    Type:    7
    Binding: STB_GLOBAL
    Section: .text
  - Name:    STT_HIOS
    Type:    12
    Binding: STB_GLOBAL
    Section: .text
  - Name:    STT_LOPROC
    Type:    13
    Binding: STB_GLOBAL
    Section: .text
  - Name:    undef
    Binding: STB_GLOBAL
  - Name:    SHN_LOPROC
    Binding: STB_GLOBAL
    Index:   0xff00
  - Name:    SHN_LOOS
    Binding: STB_GLOBAL
    Index:   0xff20
  - Name:    reserve
    Binding: STB_GLOBAL
    Index:   0xff40
  - Name:    abs
    Index:   SHN_ABS
    Binding: STB_GLOBAL
  - Name:    common2
    Binding: STB_GLOBAL
    Index:   SHN_COMMON
  - Name:    gnu_unique
    Type:    STT_OBJECT
    Binding: STB_GNU_UNIQUE
    Section: .data
  - Name:    invalid_binding
    Binding: 3
    Section: .data
  - Name:    STB_HIOS
    Binding: 12
    Section: .data
  - Name:    STB_LOPROC
    Binding: 13
    Section: .data

## For an ELF32 object, print the address and size fields as 32-bit hexadecimals.
# RUN: yaml2obj --docnum=2 -D BITS=32 %s -o %t.32
# RUN: llvm-objdump --syms %t.32 | FileCheck --check-prefix=ELF32 %s --match-full-lines --strict-whitespace
## For an ELF64 object, print the address and size fields as 64-bit hexadecimals.
# RUN: yaml2obj --docnum=2 -D BITS=64 %s -o %t.64
# RUN: llvm-objdump --syms %t.64 | FileCheck --check-prefix=ELF64 %s --match-full-lines --strict-whitespace

#      ELF32:SYMBOL TABLE:
# ELF32-NEXT:00000000         *UND*	00000000 sym

#      ELF64:SYMBOL TABLE:
# ELF64-NEXT:0000000000000000         *UND*	0000000000000000 sym

--- !ELF
FileHeader:
  Class:   ELFCLASS[[BITS]]
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
Symbols:
  - Name: sym