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
|
/*
* Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#include "platform.h"
.globl objc_msg_lookup
.globl objc_msg_lookup_stret
.globl objc_msg_lookup_super
.globl objc_msg_lookup_super_stret
.section .text
.macro GENERATE_LOOKUP name notFound
.section .opd, "aw", @progbits
\name:
.p2align 3
.quad .Lbegin_\name
.quad .TOC.@tocbase
.quad 0
.text
.Lbegin_\name:
cmpdi %r3, 0
beq- .LreturnNilMethod
andi. %r0, %r3, 1
bne- .LtaggedPointer_\name
|
|
>
>
>
>
>
>
>
>
>
>
|
>
|
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
|
/*
* Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#include "platform.h"
#if defined(_CALL_ELF) && _CALL_ELF == 2
.abiversion 2
#endif
.globl objc_msg_lookup
.globl objc_msg_lookup_stret
.globl objc_msg_lookup_super
.globl objc_msg_lookup_super_stret
.section .text
.macro GENERATE_LOOKUP name notFound
#if defined(_CALL_ELF) && _CALL_ELF == 2
\name:
addis %r2, %r12, .TOC.-\name@ha
addi %r2, %r2, .TOC.-\name@l
.localentry \name, .-\name
#else
.section .opd, "aw", @progbits
\name:
.p2align 3
.quad .Lbegin_\name
.quad .TOC.@tocbase
.quad 0
.section .text
#endif
.Lbegin_\name:
cmpdi %r3, 0
beq- .LreturnNilMethod
andi. %r0, %r3, 1
bne- .LtaggedPointer_\name
|
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
b .Lmain_\name
.type \name, @function
.size \name, .-.Lbegin_\name
.endm
.macro GENERATE_LOOKUP_SUPER name lookup
.section .opd, "aw", @progbits
\name:
.p2align 3
.quad .Lbegin_\name
.quad .TOC.@tocbase
.quad 0
.text
.Lbegin_\name:
mr %r5, %r3
ld %r3, 0(%r3)
cmpdi %r3, 0
beq- .LreturnNilMethod
ld %r5, 8(%r5)
|
>
>
>
>
>
>
|
>
|
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
|
b .Lmain_\name
.type \name, @function
.size \name, .-.Lbegin_\name
.endm
.macro GENERATE_LOOKUP_SUPER name lookup
#if defined(_CALL_ELF) && _CALL_ELF == 2
\name:
addis %r2, %r12, .TOC.-\name@ha
addi %r2, %r2, .TOC.-\name@l
.localentry \name, .-\name
#else
.section .opd, "aw", @progbits
\name:
.p2align 3
.quad .Lbegin_\name
.quad .TOC.@tocbase
.quad 0
.section .text
#endif
.Lbegin_\name:
mr %r5, %r3
ld %r3, 0(%r3)
cmpdi %r3, 0
beq- .LreturnNilMethod
ld %r5, 8(%r5)
|
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
GENERATE_LOOKUP_SUPER objc_msg_lookup_super_stret objc_msg_lookup_stret
.LreturnNilMethod:
addis %r3, %r2, nilMethod@toc@ha
addi %r3, %r3, nilMethod@toc@l
blr
.section .opd, "aw", @progbits
nilMethod:
.p2align 3
.quad .Lbegin_nilMethod
.quad .TOC.@tocbase
.quad 0
.text
.Lbegin_nilMethod:
li %r3, 0
blr
.type nilMethod, @function
.size nilMethod, .-.Lbegin_nilMethod
#ifdef OF_LINUX
.section .note.GNU-stack, "", @progbits
#endif
|
>
>
>
>
>
>
|
>
|
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
GENERATE_LOOKUP_SUPER objc_msg_lookup_super_stret objc_msg_lookup_stret
.LreturnNilMethod:
addis %r3, %r2, nilMethod@toc@ha
addi %r3, %r3, nilMethod@toc@l
blr
#if defined(_CALL_ELF) && _CALL_ELF == 2
nilMethod:
addis %r2, %r12, .TOC.-nilMethod@ha
addi %r2, %r2, .TOC.-nilMethod@l
.localentry nilMethod, .-nilMethod
#else
.section .opd, "aw", @progbits
nilMethod:
.p2align 3
.quad .Lbegin_nilMethod
.quad .TOC.@tocbase
.quad 0
.section .text
#endif
.Lbegin_nilMethod:
li %r3, 0
blr
.type nilMethod, @function
.size nilMethod, .-.Lbegin_nilMethod
#ifdef OF_LINUX
.section .note.GNU-stack, "", @progbits
#endif
|