aboutsummaryrefslogtreecommitdiffstats
path: root/test/MC/ELF/type-propagate.s
blob: 15d05af7f2fa0eced951a268aade86fc1e2c99cf (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
151
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -t - | FileCheck %s

// This tests that types are propagated from symbols to their aliases. Our
// behavior is a bit different than gas. If the type of a symbol changes,
// gas will update the type of the aliases only if those aliases were declare
// at a point in the file where the aliased symbol was already define.

// The lines marked with GAS illustrate this difference.


	.type sym01, @object
sym01:
	.type sym02, @function
sym02:

	sym03 = sym01
	sym04 = sym03
.type sym03, @function
	sym05 = sym03
	sym06 = sym01 - sym02
	sym07 = sym02 - sym01

	sym08 = sym10
	sym09 = sym10 + 1
	.type sym10, @object
sym10:

	sym11 = sym10
	sym12 = sym10 + 1
	.type sym10, @function

// CHECK:       Symbol {
// CHECK:         Name: sym01
// CHECK-NEXT:    Value: 0x0
// CHECK-NEXT:    Size: 0
// CHECK-NEXT:    Binding: Local (0x0)
// CHECK-NEXT:    Type: Object (0x1)
// CHECK-NEXT:    Other: 0
// CHECK-NEXT:    Section: .text (0x1)
// CHECK-NEXT:  }
// CHECK-NEXT:  Symbol {
// CHECK-NEXT:    Name: sym02
// CHECK-NEXT:    Value: 0x0
// CHECK-NEXT:    Size: 0
// CHECK-NEXT:    Binding: Local (0x0)
// CHECK-NEXT:    Type: Function (0x2)
// CHECK-NEXT:    Other: 0
// CHECK-NEXT:    Section: .text (0x1)
// CHECK-NEXT:  }
// CHECK-NEXT:  Symbol {
// CHECK-NEXT:    Name: sym03
// CHECK-NEXT:    Value: 0x0
// CHECK-NEXT:    Size: 0
// CHECK-NEXT:    Binding: Local (0x0)
// CHECK-NEXT:    Type: Function (0x2)
// CHECK-NEXT:    Other: 0
// CHECK-NEXT:    Section: .text (0x1)
// CHECK-NEXT:  }
// CHECK-NEXT:  Symbol {
// CHECK-NEXT:    Name: sym04
// CHECK-NEXT:    Value: 0x0
// CHECK-NEXT:    Size: 0
// CHECK-NEXT:    Binding: Local (0x0)
// CHECK-NEXT:    Type: Object (0x1)
// CHECK-NEXT:    Other: 0
// CHECK-NEXT:    Section: .text (0x1)
// CHECK-NEXT:  }
// CHECK-NEXT:  Symbol {
// CHECK-NEXT:    Name: sym05
// CHECK-NEXT:    Value: 0x0
// CHECK-NEXT:    Size: 0
// CHECK-NEXT:    Binding: Local (0x0)

// GAS:           Type: Function (0x2)
// CHECK-NEXT:    Type: Object (0x1)

// CHECK-NEXT:    Other: 0
// CHECK-NEXT:    Section: .text (0x1)
// CHECK-NEXT:  }
// CHECK-NEXT:  Symbol {
// CHECK-NEXT:    Name: sym06
// CHECK-NEXT:    Value: 0x0
// CHECK-NEXT:    Size: 0
// CHECK-NEXT:    Binding: Local (0x0)
// CHECK-NEXT:    Type: None (0x0)
// CHECK-NEXT:    Other: 0
// CHECK-NEXT:    Section: Absolute (0xFFF1)
// CHECK-NEXT:  }
// CHECK-NEXT:  Symbol {
// CHECK-NEXT:    Name: sym07
// CHECK-NEXT:    Value: 0x0
// CHECK-NEXT:    Size: 0
// CHECK-NEXT:    Binding: Local (0x0)
// CHECK-NEXT:    Type: None (0x0)
// CHECK-NEXT:    Other: 0
// CHECK-NEXT:    Section: Absolute (0xFFF1)
// CHECK-NEXT:  }
// CHECK-NEXT:  Symbol {
// CHECK-NEXT:    Name: sym08
// CHECK-NEXT:    Value: 0x0
// CHECK-NEXT:    Size: 0
// CHECK-NEXT:    Binding: Local (0x0)
// CHECK-NEXT:    Type: Function (0x2)
// CHECK-NEXT:    Other: 0
// CHECK-NEXT:    Section: .text (0x1)
// CHECK-NEXT:  }
// CHECK-NEXT:  Symbol {
// CHECK-NEXT:    Name: sym09
// CHECK-NEXT:    Value: 0x1
// CHECK-NEXT:    Size: 0
// CHECK-NEXT:    Binding: Local (0x0)

// GAS:           Type: None (0x0)
// CHECK-NEXT:    Type: Function (0x2)

// CHECK-NEXT:    Other: 0
// CHECK-NEXT:    Section: .text (0x1)
// CHECK-NEXT:  }
// CHECK-NEXT:  Symbol {
// CHECK-NEXT:    Name: sym10
// CHECK-NEXT:    Value: 0x0
// CHECK-NEXT:    Size: 0
// CHECK-NEXT:    Binding: Local (0x0)
// CHECK-NEXT:    Type: Function (0x2)
// CHECK-NEXT:    Other: 0
// CHECK-NEXT:    Section: .text (0x1)
// CHECK-NEXT:  }
// CHECK-NEXT:  Symbol {
// CHECK-NEXT:    Name: sym11
// CHECK-NEXT:    Value: 0x0
// CHECK-NEXT:    Size: 0
// CHECK-NEXT:    Binding: Local (0x0)

// GAS:           Type: Object (0x1)
// CHECK-NEXT:    Type: Function (0x2)

// CHECK-NEXT:    Other: 0
// CHECK-NEXT:    Section: .text (0x1)
// CHECK-NEXT:  }
// CHECK-NEXT:  Symbol {
// CHECK-NEXT:    Name: sym12
// CHECK-NEXT:    Value: 0x1
// CHECK-NEXT:    Size: 0
// CHECK-NEXT:    Binding: Local (0x0)

// GAS:           Type: Object (0x1)
// CHECK-NEXT:    Type: Function (0x2)

// CHECK-NEXT:    Other: 0
// CHECK-NEXT:    Section: .text (0x1)
// CHECK-NEXT:  }