offset.s
3.24 KB
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
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj --symbols - | FileCheck %s
// Test that a variable declared with "var = other_var + cst" is in the same
// section as other_var and its value is the value of other_var + cst.
.data
.globl sym_a
.size sym_a, 42
.byte 42
.type sym_a, @object
sym_a:
// CHECK: Symbol {
// CHECK: Name: sym_a
// CHECK-NEXT: Value: 0x1
// CHECK-NEXT: Size: 42
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .data
// CHECK-NEXT: }
.long 42
.globl sym_b
sym_b:
.globl sym_c
sym_c = sym_a
// CHECK: Symbol {
// CHECK: Name: sym_c
// CHECK-NEXT: Value: 0x1
// CHECK-NEXT: Size: 42
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .data
// CHECK-NEXT: }
.globl sym_d
sym_d = sym_a + 1
// CHECK: Symbol {
// CHECK: Name: sym_d
// CHECK-NEXT: Value: 0x2
// CHECK-NEXT: Size: 42
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .data
// CHECK-NEXT: }
.globl sym_e
sym_e = sym_a + (sym_b - sym_a) * 3
// CHECK: Symbol {
// CHECK: Name: sym_e
// CHECK-NEXT: Value: 0xD
// CHECK-NEXT: Size: 42
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .data
// CHECK-NEXT: }
.globl sym_f
sym_f = sym_a + (1 - 1)
// CHECK: Symbol {
// CHECK: Name: sym_f
// CHECK-NEXT: Value: 0x1
// CHECK-NEXT: Size: 42
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .data
// CHECK-NEXT: }
.globl test2_a
.globl test2_b
.globl test2_c
.globl test2_d
.globl test2_e
test2_a:
.long 0
test2_b = test2_a
test2_c:
.long 0
test2_d = test2_c
test2_e = test2_d - test2_b
// CHECK: Symbol {
// CHECK: Name: test2_a
// CHECK-NEXT: Value: 0x5
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .data
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: test2_b
// CHECK-NEXT: Value: 0x5
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .data
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: test2_c
// CHECK-NEXT: Value: 0x9
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .data
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: test2_d
// CHECK-NEXT: Value: 0x9
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .data
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: test2_e
// CHECK-NEXT: Value: 0x4
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Absolute
// CHECK-NEXT: }