ObjFW  Check-in [f1416bbdc2]

Overview
Comment:Add forwardingTargetForSelector: for MIPS/ELF.

Only for the O32 ABI and the 32-bit EABI.

Currently, no methods returning structs are supported, see the comment
in OFObject.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f1416bbdc22dcbe43d6c06340b479692eb97f8feb2502853a9b3ffbcc6d57ad6
User & Date: js on 2013-07-24 23:05:43
Other Links: manifest | tags
Context
2013-07-24
23:05
PLATFORMS.md: Add Linux/MIPS32. check-in: 5092bda14b user: js tags: trunk
23:05
Add forwardingTargetForSelector: for MIPS/ELF. check-in: f1416bbdc2 user: js tags: trunk
22:56
lookup-asm-mips-elf.S: Support PIC. check-in: 8108a32927 user: js tags: trunk
Changes

Modified src/OFObject.h from [58996a4468] to [5a670ed733].

98
99
100
101
102
103
104




105
106
107
108
109
110
111
#  define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR_STRET
# endif
#else
# ifdef __ELF__
#  if defined(__amd64__) || defined(__x86_64__) || defined(__i386__) || \
    defined(__arm__) || defined(__ARM__)
#   define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR




#  endif
# endif
#endif

#if __has_feature(objc_arc)
# define OF_RETURNS_RETAINED __attribute__((ns_returns_retained))
# define OF_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained))







>
>
>
>







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#  define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR_STRET
# endif
#else
# ifdef __ELF__
#  if defined(__amd64__) || defined(__x86_64__) || defined(__i386__) || \
    defined(__arm__) || defined(__ARM__)
#   define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR
#  endif
#  if (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32) || \
    (defined(__mips_eabi) && _MIPS_SZPTR == 32)
#   define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR
#  endif
# endif
#endif

#if __has_feature(objc_arc)
# define OF_RETURNS_RETAINED __attribute__((ns_returns_retained))
# define OF_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained))

Added src/forwarding-mips-elf.S version [53faa6cc87].





























































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * 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.
 */

.globl of_forward

.section .text
of_forward:
#ifdef __PIC__
	lui	$gp, %hi(_gp_disp)
	addiu	$gp, $gp, %lo(_gp_disp)
	addu	$gp, $gp, $t9
#endif

	addiu	$sp, -48
	sw	$gp, 0($sp)
	sw	$ra, 4($sp)
	sw	$a0, 8($sp)
	sw	$a1, 12($sp)
	sw	$a2, 16($sp)
	sw	$a3, 20($sp)
#ifdef __mips_eabi
	/* For some reason, $a4-$a8 are not always defined */
	sw	$8, 24($sp)
	sw	$9, 28($sp)
	sw	$10, 32($sp)
	sw	$11, 36($sp)
#endif

#ifdef __PIC__
	lw	$a1, %got(sel_forwardingTargetForSelector_)($gp)
#else
	lui	$a1, %hi(sel_forwardingTargetForSelector_)
#endif
	addiu	$a1, $a1, %lo(sel_forwardingTargetForSelector_)
#ifdef __PIC__
	lw	$t9, %call16(objc_msg_lookup)($gp)
	jalr	$t9
#else
	jal	objc_msg_lookup
#endif

	lw	$gp, 0($sp)
	lw	$a0, 8($sp)
#ifdef __PIC__
	lw	$a1, %got(sel_forwardingTargetForSelector_)($gp)
#else
	lui	$a1, %hi(sel_forwardingTargetForSelector_)
#endif
	addiu	$a1, $a1, %lo(sel_forwardingTargetForSelector_)
	lw	$a2, 12($sp)
#ifdef __PIC__
	move	$t9, $v0
	jalr	$t9
#else
	jalr	$v0
#endif
	sw	$v0, 8($sp)

	lw	$gp, 0($sp)
	move	$a0, $v0
	lw	$a1, 12($sp)
#ifdef __PIC__
	lw	$t9, %call16(objc_msg_lookup)($gp)
	jalr	$t9
#else
	jal	objc_msg_lookup
#endif

#ifdef __mips_eabi
	lw	$11, 36($sp)
	lw	$10, 32($sp)
	lw	$9, 28($sp)
	lw	$8, 24($sp)
#endif
	lw	$a3, 20($sp)
	lw	$a2, 16($sp)
	lw	$a1, 12($sp)
	lw	$a0, 8($sp)
	lw	$ra, 4($sp)
	addiu	$sp, 48

#ifdef __PIC__
	move	$t9, $v0
	jr	$t9
#else
	jr	$v0
#endif

.type of_forward, %function
.size of_forward, .-of_forward

init:
#ifdef __PIC__
	lui	$gp, %hi(_gp_disp)
	addiu	$gp, $gp, %lo(_gp_disp)
	addu	$gp, $gp, $t9

	lw	$a0, %got(module)($gp)
	addiu	$a0, $a0, %lo(module)
	lw	$t9, %call16(__objc_exec_class)($gp)
	jr	$t9
#else
	lui	$a0, %hi(module)
	addiu	$a0, $a0, %lo(module)
	j	__objc_exec_class
#endif

.section .ctors, "a", %progbits
	.long init

.section .rodata
str_forwardingTargetForSelector_:
	.asciz "forwardingTargetForSelector:"

.section .data
sel_forwardingTargetForSelector_:
	.long str_forwardingTargetForSelector_, 0
	.long 0, 0
symtab:
	.long 0, sel_forwardingTargetForSelector_
	.short 0, 0
	.long 0
	.long 0
module:
	.long 8, 16, 0, symtab

#ifdef __linux__
.section .note.GNU-stack, "", %progbits
#endif

Modified src/forwarding.S from [eaa3178c48] to [810ae34c05].

30
31
32
33
34
35
36



37
38
39
# ifdef __ELF__
#  if defined(__amd64__) || defined(__x86_64__)
#   include "forwarding-amd64-elf.S"
#  elif defined(__i386__)
#   include "forwarding-x86-elf.S"
#  elif defined(__arm__) || defined(__ARM__)
#   include "forwarding-arm-elf.S"



#  endif
# endif
#endif







>
>
>



30
31
32
33
34
35
36
37
38
39
40
41
42
# ifdef __ELF__
#  if defined(__amd64__) || defined(__x86_64__)
#   include "forwarding-amd64-elf.S"
#  elif defined(__i386__)
#   include "forwarding-x86-elf.S"
#  elif defined(__arm__) || defined(__ARM__)
#   include "forwarding-arm-elf.S"
#  elif (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32) || \
    (defined(__mips_eabi) && _MIPS_SZPTR == 32)
#   include "forwarding-mips-elf.S"
#  endif
# endif
#endif