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
|
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -t -r --expand-relocs | FileCheck %s
// Local symbol overriding section.
.section x1,"a",@progbits
.local x1
.comm x1,4,4
.long x1 // reloc: .bss + 0
// Section declared after local. Local symbol wins.
.local x2
.comm x2,4,4
.section x2,"a",@progbits
.long x2 // reloc: .bss + 4
// No overriding symbol.
.section x3,"a",@progbits
.long x3 // reloc: x3(section) + 0
// Global vs section.
.section x4,"a",@progbits
.long 0
.globl x4
.section foo, "a", @progbits
x4:
.long 0
.long x4 // reloc: x4(global) + 0
// Global vs implicit section
.globl .data
.data:
.long 42
.long .data // reloc: .data(global) + 0
// CHECK: Relocations [
// CHECK: Section (4) .relax1 {
// CHECK: Relocation {
// CHECK: Offset: 0x0
// CHECK: Type: R_X86_64_32 (10)
// CHECK: Symbol: .bss (3)
// CHECK: Addend: 0x0
// CHECK: }
// CHECK: }
// CHECK: Section (7) .relax2 {
// CHECK: Relocation {
// CHECK: Offset: 0x0
// CHECK: Type: R_X86_64_32 (10)
// CHECK: Symbol: .bss (3)
// CHECK: Addend: 0x4
// CHECK: }
// CHECK: }
// CHECK: Section (9) .relax3 {
// CHECK: Relocation {
// CHECK: Offset: 0x0
// CHECK: Type: R_X86_64_32 (10)
// CHECK: Symbol: x3 (4)
// CHECK: Addend: 0x0
// CHECK: }
// CHECK: }
// CHECK: Section (12) .relafoo {
// CHECK: Relocation {
// CHECK: Offset: 0x4
// CHECK: Type: R_X86_64_32 (10)
// CHECK: Symbol: x4 (6)
// CHECK: Addend: 0x0
// CHECK: }
// CHECK: Relocation {
// CHECK: Offset: 0xC
// CHECK: Type: R_X86_64_32 (10)
// CHECK: Symbol: .data (5)
// CHECK: Addend: 0x0
// CHECK: }
// CHECK: }
// CHECK: ]
// CHECK: Symbols [
// CHECK: Symbol {
// CHECK: Name: (0)
// CHECK: Value: 0x0
// CHECK: Size: 0
// CHECK: Binding: Local (0x0)
// CHECK: Type: None (0x0)
// CHECK: Other: 0
// CHECK: Section: Undefined (0x0)
// CHECK: }
// CHECK: Symbol {
// CHECK: Name: x1 (67)
// CHECK: Value: 0x0
// CHECK: Size: 4
// CHECK: Binding: Local (0x0)
// CHECK: Type: Object (0x1)
// CHECK: Other: 0
// CHECK: Section: .bss (0x5)
// CHECK: }
// CHECK: Symbol {
// CHECK: Name: x2 (59)
// CHECK: Value: 0x4
// CHECK: Size: 4
// CHECK: Binding: Local (0x0)
// CHECK: Type: Object (0x1)
// CHECK: Other: 0
// CHECK: Section: .bss (0x5)
// CHECK: }
// CHECK: Symbol {
// CHECK: Name: (0)
// CHECK: Value: 0x0
// CHECK: Size: 0
// CHECK: Binding: Local (0x0)
// CHECK: Type: Section (0x3)
// CHECK: Other: 0
// CHECK: Section: .bss (0x5)
// CHECK: }
// CHECK: Symbol {
// CHECK: Name: (0)
// CHECK: Value: 0x0
// CHECK: Size: 0
// CHECK: Binding: Local (0x0)
// CHECK: Type: Section (0x3)
// CHECK: Other: 0
// CHECK: Section: x3 (0x8)
// CHECK: }
// CHECK: Symbol {
// CHECK: Name: .data (37)
// CHECK: Value: 0x8
// CHECK: Size: 0
// CHECK: Binding: Global (0x1)
// CHECK: Type: None (0x0)
// CHECK: Other: 0
// CHECK: Section: foo (0xB)
// CHECK: }
// CHECK: Symbol {
// CHECK: Name: x4 (43)
// CHECK: Value: 0x0
// CHECK: Size: 0
// CHECK: Binding: Global (0x1)
// CHECK: Type: None (0x0)
// CHECK: Other: 0
// CHECK: Section: foo (0xB)
// CHECK: }
// CHECK: ]
|