2 * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 #if __ppc__ || __ppc64__
36 addis r2,r10,ha16(_a-Lpicbase)
37 lwz r2,lo16(_a-Lpicbase)(r2)
40 addis r2,r10,ha16(_c-Lpicbase)
41 lwz r2,lo16(_c-Lpicbase)(r2)
51 ; absolute load of external
55 ; absolute lea of external
60 ; PIC load of a + addend
61 addis r2,r10,ha16(_a+0x19000-Lpicbase)
62 lwz r2,lo16(_a+0x19000-Lpicbase)(r2)
64 ; absolute load of a + addend
65 lis r2,ha16(_a+0x19000)
66 lwz r2,lo16(_a+0x19000)(r2)
68 ; absolute load of external + addend
69 lis r2,ha16(_ax+0x19000)
70 lwz r2,lo16(_ax+0x19000)(r2)
72 ; absolute lea of external + addend
73 lis r2,hi16(_ax+0x19000)
74 ori r2,r2,lo16(_ax+0x19000)
77 ; PIC load of a + addend
78 addis r2,r10,ha16(_a+0x09000-Lpicbase)
79 lwz r2,lo16(_a+0x09000-Lpicbase)(r2)
81 ; absolute load of a + addend
82 lis r2,ha16(_a+0x09000)
83 lwz r2,lo16(_a+0x09000)(r2)
85 ; absolute load of external + addend
86 lis r2,ha16(_ax+0x09000)
87 lwz r2,lo16(_ax+0x09000)(r2)
89 ; absolute lea of external + addend
90 lis r2,hi16(_ax+0x09000)
91 ori r2,r2,lo16(_ax+0x09000)
100 ; call internal + addend
101 bl _test_branches+0x19000
106 ; call external + addend
114 ; call internal + addend
120 ; call external + addend
136 movl _a-Lpicbase(%ebx), %eax
141 # absolute load of external
144 # absolute lea of external
148 # PIC load of a + addend
149 movl _a-Lpicbase+0x19000(%ebx), %eax
151 # absolute load of a + addend
152 movl _a+0x19000(%ebx), %eax
154 # absolute load of external + addend
155 movl _ax+0x19000(%ebx), %eax
157 # absolute lea of external + addend
158 leal _ax+0x1900, %eax
167 # call internal + addend
168 call _test_branches+0x19000
173 # call external + addend
174 call _external+0x19000
181 # call internal + addend
187 # call external + addend
203 # PIC load of a + addend
204 movl _a+0x1234(%rip), %eax
209 # PIC lea through GOT
210 movq _a@GOTPCREL(%rip), %rax
213 pushq _a@GOTPCREL(%rip)
215 # PIC lea external through GOT
216 movq _ax@GOTPCREL(%rip), %rax
218 # PIC external access of GOT
219 pushq _ax@GOTPCREL(%rip)
225 movl $0x12345678, _a(%rip)
228 # lea L1(%rip), %rax ### assembler bug
229 # movl L0(%rip), %eax ### assembler bug
238 # call internal + addend
239 call _test_branches+0x19000
244 # call external + addend
245 call _external+0x19000
252 # call internal + addend
258 # call external + addend
264 # test that pointer-diff relocs are preserved
270 .long Llocal2-_test_branches
272 .quad Llocal2-_test_branches
278 L0: .quad _test_branches
280 .quad _test_branches+4
281 L1: .quad _test_branches - _test_diffs
282 .quad _test_branches - _test_diffs + 4
283 .long _test_branches - _test_diffs
284 # .long LCL0-. ### assembler bug: content value should be (address(LCL0) - 0x24)
286 # .quad L0 ### assembler bug: should be internal reloc to L0
287 .quad _test_branches - .
288 .quad _test_branches - L1
291 # the following generates: _foo cannot be undefined in a subtraction expression
292 # but it should be ok (it will be a linker error if _foo and _bar are not in same linkage unit)
293 # .quad _foo - _bar ### assembler bug
295 .section __DATA,__data2
307 #if __ppc__ || __i386__
312 #elif __ppc64__ || __x86_64__
319 # test that reloc sizes are the same
326 .long Llocal4-Llocal3