[InstCombine] Signed saturation patterns
[llvm-complete.git] / test / MC / MachO / darwin-x86_64-reloc-offsets.s
blobfc73ec633c280d69c1aec2984b054667869c77dc
1 // RUN: llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o - | llvm-readobj --file-headers -S --sd -r --symbols --macho-segment --macho-dysymtab --macho-indirect-symbols | FileCheck %s
3 .data
5 .org 0x10
6 L0:
7 .long 0
8 .long 0
9 .long 0
10 .long 0
12 _d:
13 .long 0
14 L1:
15 .long 0
17 .text
19 // These generate normal x86_64 (external) relocations. They could all use
20 // SIGNED, but don't for pedantic compatibility with Darwin 'as'.
22 // SIGNED1
23 movb $0x12, _d(%rip)
25 // SIGNED
26 movb $0x12, _d + 1(%rip)
28 // SIGNED4
29 movl $0x12345678, _d(%rip)
31 // SIGNED
32 movl $0x12345678, _d + 1(%rip)
34 // SIGNED2
35 movl $0x12345678, _d + 2(%rip)
37 // SIGNED1
38 movl $0x12345678, _d + 3(%rip)
40 // SIGNED
41 movl $0x12345678, _d + 4(%rip)
43 movb %al, _d(%rip)
44 movb %al, _d + 1(%rip)
45 movl %eax, _d(%rip)
46 movl %eax, _d + 1(%rip)
47 movl %eax, _d + 2(%rip)
48 movl %eax, _d + 3(%rip)
49 movl %eax, _d + 4(%rip)
51 // These have to use local relocations. Since that uses an offset into the
52 // section in x86_64 (as opposed to a scattered relocation), and since the
53 // linker can only decode this to an atom + offset by scanning the section,
54 // it is not possible to correctly encode these without SIGNED<N>. This is
55 // ultimately due to a design flaw in the x86_64 relocation format, it is
56 // not possible to encode an address (L<foo> + <constant>) which is outside the
57 // atom containing L<foo>.
59 // SIGNED1
60 movb $0x12, L0(%rip)
62 // SIGNED
63 movb $0x12, L0 + 1(%rip)
65 // SIGNED4
66 movl $0x12345678, L0(%rip)
68 // SIGNED
69 movl $0x12345678, L0 + 1(%rip)
71 // SIGNED2
72 movl $0x12345678, L0 + 2(%rip)
74 // SIGNED1
75 movl $0x12345678, L0 + 3(%rip)
77 // SIGNED
78 movl $0x12345678, L0 + 4(%rip)
80 movb %al, L0(%rip)
81 movb %al, L0 + 1(%rip)
82 movl %eax, L0(%rip)
83 movl %eax, L0 + 1(%rip)
84 movl %eax, L0 + 2(%rip)
85 movl %eax, L0 + 3(%rip)
86 movl %eax, L0 + 4(%rip)
88 // SIGNED1
89 movb $0x12, L1(%rip)
91 // SIGNED
92 movb $0x12, L1 + 1(%rip)
94 // SIGNED4
95 movl $0x12345678, L1(%rip)
97 // SIGNED
98 movl $0x12345678, L1 + 1(%rip)
100 // SIGNED2
101 movl $0x12345678, L1 + 2(%rip)
103 // SIGNED1
104 movl $0x12345678, L1 + 3(%rip)
106 // SIGNED
107 movl $0x12345678, L1 + 4(%rip)
109 movb %al, L1(%rip)
110 movb %al, L1 + 1(%rip)
111 movl %eax, L1(%rip)
112 movl %eax, L1 + 1(%rip)
113 movl %eax, L1 + 2(%rip)
114 movl %eax, L1 + 3(%rip)
115 movl %eax, L1 + 4(%rip)
117 // CHECK: File: <stdin>
118 // CHECK: Format: Mach-O 64-bit x86-64
119 // CHECK: Arch: x86_64
120 // CHECK: AddressSize: 64bit
121 // CHECK: MachHeader {
122 // CHECK: Magic: Magic64 (0xFEEDFACF)
123 // CHECK: CpuType: X86-64 (0x1000007)
124 // CHECK: CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)
125 // CHECK: FileType: Relocatable (0x1)
126 // CHECK: NumOfLoadCommands: 4
127 // CHECK: SizeOfLoadCommands: 352
128 // CHECK: Flags [ (0x0)
129 // CHECK: ]
130 // CHECK: Reserved: 0x0
131 // CHECK: }
132 // CHECK: Sections [
133 // CHECK: Section {
134 // CHECK: Index: 0
135 // CHECK: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
136 // CHECK: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
137 // CHECK: Address: 0x0
138 // CHECK: Size: 0x13E
139 // CHECK: Offset: 384
140 // CHECK: Alignment: 0
141 // CHECK: RelocationOffset: 0x2E8
142 // CHECK: RelocationCount: 42
143 // CHECK: Type: Regular (0x0)
144 // CHECK: Attributes [ (0x800004)
145 // CHECK: PureInstructions (0x800000)
146 // CHECK: SomeInstructions (0x4)
147 // CHECK: ]
148 // CHECK: Reserved1: 0x0
149 // CHECK: Reserved2: 0x0
150 // CHECK: Reserved3: 0x0
151 // CHECK: SectionData (
152 // CHECK: 0000: C605FFFF FFFF12C6 05000000 0012C705 |................|
153 // CHECK: 0010: FCFFFFFF 78563412 C705FDFF FFFF7856 |....xV4.......xV|
154 // CHECK: 0020: 3412C705 FEFFFFFF 78563412 C705FFFF |4.......xV4.....|
155 // CHECK: 0030: FFFF7856 3412C705 00000000 78563412 |..xV4.......xV4.|
156 // CHECK: 0040: 88050000 00008805 01000000 89050000 |................|
157 // CHECK: 0050: 00008905 01000000 89050200 00008905 |................|
158 // CHECK: 0060: 03000000 89050400 0000C605 DD000000 |................|
159 // CHECK: 0070: 12C605D7 00000012 C705CC00 00007856 |..............xV|
160 // CHECK: 0080: 3412C705 C3000000 78563412 C705BA00 |4.......xV4.....|
161 // CHECK: 0090: 00007856 3412C705 B1000000 78563412 |..xV4.......xV4.|
162 // CHECK: 00A0: C705A800 00007856 34128805 9E000000 |......xV4.......|
163 // CHECK: 00B0: 88059900 00008905 92000000 89058D00 |................|
164 // CHECK: 00C0: 00008905 88000000 89058300 00008905 |................|
165 // CHECK: 00D0: 7E000000 C6050300 000012C6 05040000 |~...............|
166 // CHECK: 00E0: 0012C705 00000000 78563412 C7050100 |........xV4.....|
167 // CHECK: 00F0: 00007856 3412C705 02000000 78563412 |..xV4.......xV4.|
168 // CHECK: 0100: C7050300 00007856 3412C705 04000000 |......xV4.......|
169 // CHECK: 0110: 78563412 88050400 00008805 05000000 |xV4.............|
170 // CHECK: 0120: 89050400 00008905 05000000 89050600 |................|
171 // CHECK: 0130: 00008905 07000000 89050800 0000 |..............|
172 // CHECK: )
173 // CHECK: }
174 // CHECK: Section {
175 // CHECK: Index: 1
176 // CHECK: Name: __data (5F 5F 64 61 74 61 00 00 00 00 00 00 00 00 00 00)
177 // CHECK: Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)
178 // CHECK: Address: 0x13E
179 // CHECK: Size: 0x28
180 // CHECK: Offset: 702
181 // CHECK: Alignment: 0
182 // CHECK: RelocationOffset: 0x0
183 // CHECK: RelocationCount: 0
184 // CHECK: Type: Regular (0x0)
185 // CHECK: Attributes [ (0x0)
186 // CHECK: ]
187 // CHECK: Reserved1: 0x0
188 // CHECK: Reserved2: 0x0
189 // CHECK: Reserved3: 0x0
190 // CHECK: SectionData (
191 // CHECK: 0000: 00000000 00000000 00000000 00000000 |................|
192 // CHECK: 0010: 00000000 00000000 00000000 00000000 |................|
193 // CHECK: 0020: 00000000 00000000 |........|
194 // CHECK: )
195 // CHECK: }
196 // CHECK: ]
197 // CHECK: Relocations [
198 // CHECK: Section __text {
199 // CHECK: 0x13A 1 2 1 X86_64_RELOC_SIGNED 0 _d
200 // CHECK: 0x134 1 2 1 X86_64_RELOC_SIGNED 0 _d
201 // CHECK: 0x12E 1 2 1 X86_64_RELOC_SIGNED 0 _d
202 // CHECK: 0x128 1 2 1 X86_64_RELOC_SIGNED 0 _d
203 // CHECK: 0x122 1 2 1 X86_64_RELOC_SIGNED 0 _d
204 // CHECK: 0x11C 1 2 1 X86_64_RELOC_SIGNED 0 _d
205 // CHECK: 0x116 1 2 1 X86_64_RELOC_SIGNED 0 _d
206 // CHECK: 0x10C 1 2 1 X86_64_RELOC_SIGNED 0 _d
207 // CHECK: 0x102 1 2 1 X86_64_RELOC_SIGNED_1 0 _d
208 // CHECK: 0xF8 1 2 1 X86_64_RELOC_SIGNED_2 0 _d
209 // CHECK: 0xEE 1 2 1 X86_64_RELOC_SIGNED 0 _d
210 // CHECK: 0xE4 1 2 1 X86_64_RELOC_SIGNED_4 0 _d
211 // CHECK: 0xDD 1 2 1 X86_64_RELOC_SIGNED 0 _d
212 // CHECK: 0xD6 1 2 1 X86_64_RELOC_SIGNED_1 0 _d
213 // CHECK: 0xD0 1 2 0 X86_64_RELOC_SIGNED 0 __data
214 // CHECK: 0xCA 1 2 0 X86_64_RELOC_SIGNED 0 __data
215 // CHECK: 0xC4 1 2 0 X86_64_RELOC_SIGNED 0 __data
216 // CHECK: 0xBE 1 2 0 X86_64_RELOC_SIGNED 0 __data
217 // CHECK: 0xB8 1 2 0 X86_64_RELOC_SIGNED 0 __data
218 // CHECK: 0xB2 1 2 0 X86_64_RELOC_SIGNED 0 __data
219 // CHECK: 0xAC 1 2 0 X86_64_RELOC_SIGNED 0 __data
220 // CHECK: 0xA2 1 2 0 X86_64_RELOC_SIGNED 0 __data
221 // CHECK: 0x98 1 2 0 X86_64_RELOC_SIGNED_1 0 __data
222 // CHECK: 0x8E 1 2 0 X86_64_RELOC_SIGNED_2 0 __data
223 // CHECK: 0x84 1 2 0 X86_64_RELOC_SIGNED 0 __data
224 // CHECK: 0x7A 1 2 0 X86_64_RELOC_SIGNED_4 0 __data
225 // CHECK: 0x73 1 2 0 X86_64_RELOC_SIGNED 0 __data
226 // CHECK: 0x6C 1 2 0 X86_64_RELOC_SIGNED_1 0 __data
227 // CHECK: 0x66 1 2 1 X86_64_RELOC_SIGNED 0 _d
228 // CHECK: 0x60 1 2 1 X86_64_RELOC_SIGNED 0 _d
229 // CHECK: 0x5A 1 2 1 X86_64_RELOC_SIGNED 0 _d
230 // CHECK: 0x54 1 2 1 X86_64_RELOC_SIGNED 0 _d
231 // CHECK: 0x4E 1 2 1 X86_64_RELOC_SIGNED 0 _d
232 // CHECK: 0x48 1 2 1 X86_64_RELOC_SIGNED 0 _d
233 // CHECK: 0x42 1 2 1 X86_64_RELOC_SIGNED 0 _d
234 // CHECK: 0x38 1 2 1 X86_64_RELOC_SIGNED 0 _d
235 // CHECK: 0x2E 1 2 1 X86_64_RELOC_SIGNED_1 0 _d
236 // CHECK: 0x24 1 2 1 X86_64_RELOC_SIGNED_2 0 _d
237 // CHECK: 0x1A 1 2 1 X86_64_RELOC_SIGNED 0 _d
238 // CHECK: 0x10 1 2 1 X86_64_RELOC_SIGNED_4 0 _d
239 // CHECK: 0x9 1 2 1 X86_64_RELOC_SIGNED 0 _d
240 // CHECK: 0x2 1 2 1 X86_64_RELOC_SIGNED_1 0 _d
241 // CHECK: }
242 // CHECK: ]
243 // CHECK: Symbols [
244 // CHECK: Symbol {
245 // CHECK: Name: _d (1)
246 // CHECK: Type: Section (0xE)
247 // CHECK: Section: __data (0x2)
248 // CHECK: RefType: UndefinedNonLazy (0x0)
249 // CHECK: Flags [ (0x0)
250 // CHECK: ]
251 // CHECK: Value: 0x15E
252 // CHECK: }
253 // CHECK: ]
254 // CHECK: Indirect Symbols {
255 // CHECK: Number: 0
256 // CHECK: Symbols [
257 // CHECK: ]
258 // CHECK: }
259 // CHECK: Segment {
260 // CHECK: Cmd: LC_SEGMENT_64
261 // CHECK: Name:
262 // CHECK: Size: 232
263 // CHECK: vmaddr: 0x0
264 // CHECK: vmsize: 0x166
265 // CHECK: fileoff: 384
266 // CHECK: filesize: 358
267 // CHECK: maxprot: rwx
268 // CHECK: initprot: rwx
269 // CHECK: nsects: 2
270 // CHECK: flags: 0x0
271 // CHECK: }
272 // CHECK: Dysymtab {
273 // CHECK: ilocalsym: 0
274 // CHECK: nlocalsym: 1
275 // CHECK: iextdefsym: 1
276 // CHECK: nextdefsym: 0
277 // CHECK: iundefsym: 1
278 // CHECK: nundefsym: 0
279 // CHECK: tocoff: 0
280 // CHECK: ntoc: 0
281 // CHECK: modtaboff: 0
282 // CHECK: nmodtab: 0
283 // CHECK: extrefsymoff: 0
284 // CHECK: nextrefsyms: 0
285 // CHECK: indirectsymoff: 0
286 // CHECK: nindirectsyms: 0
287 // CHECK: extreloff: 0
288 // CHECK: nextrel: 0
289 // CHECK: locreloff: 0
290 // CHECK: nlocrel: 0
291 // CHECK: }