ObjFW  Check-in [9686258014]

Overview
Comment:Add forwardingTargetForSelector: for x86/ELF.

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: 9686258014252af3897f5b6bb6c9456fc9e11e2df8ae335f6be3aa3f4616e54e
User & Date: js on 2013-07-07 14:14:05
Other Links: manifest | tags
Context
2013-07-08
15:30
Check for forwarding at compile time. check-in: bbabe17c4f user: js tags: trunk
2013-07-07
14:14
Add forwardingTargetForSelector: for x86/ELF. check-in: 9686258014 user: js tags: trunk
12:53
Fix dependency generation for .S files. check-in: 55b2494956 user: js tags: trunk
Changes

Modified configure.ac from [fedd750d77] to [97256323bc].

250
251
252
253
254
255
256


257
258
259
260
261
262
263
				#if defined(__i386__) && defined(__ELF__)
				yes
				#endif
			], [
				AC_SUBST(LOOKUP_S, lookup-x86-elf.S)
				AC_DEFINE(OF_ASM_LOOKUP, 1,
					[Whether to use assembly for lookup])


			])
		])

		AC_EGREP_CPP(yes, [
			#if defined(__amd64__) || defined(__x86_64__)
			# ifdef __MACH__
			yes







>
>







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
				#if defined(__i386__) && defined(__ELF__)
				yes
				#endif
			], [
				AC_SUBST(LOOKUP_S, lookup-x86-elf.S)
				AC_DEFINE(OF_ASM_LOOKUP, 1,
					[Whether to use assembly for lookup])
				AC_DEFINE(OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR, 1,
					[Whether we have forwardingTargetForSelector:])
			])
		])

		AC_EGREP_CPP(yes, [
			#if defined(__amd64__) || defined(__x86_64__)
			# ifdef __MACH__
			yes

Modified src/forwarding-amd64-elf.S from [d81347873d] to [ee4e7452e5].

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
	movq	%rbp, %rsp
	popq	%rbp

	jmp     *%r11

init:
	leaq	module(%rip), %rdi
	call	__objc_exec_class@PLT
	ret

.section .init_array
	.quad init

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







|
<







72
73
74
75
76
77
78
79

80
81
82
83
84
85
86
	movq	%rbp, %rsp
	popq	%rbp

	jmp     *%r11

init:
	leaq	module(%rip), %rdi
	jmp	__objc_exec_class@PLT


.section .init_array
	.quad init

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

Added src/forwarding-x86-elf.S version [c6c400862a].





















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/*
 * 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:
	pushl	%ebp
	movl	%esp, %ebp

	pushl	%ebx
	subl	$20, %esp

	call	get_eip
.L0:

	movl	8(%ebp), %eax
	movl	%eax, (%esp)
	leal	sel_forwardingTargetForSelector_-.L0(%ebx), %eax
	movl	%eax, 4(%esp)
	leal	objc_msg_lookup-.L0(%ebx), %eax
	call	*%eax

	movl	8(%ebp), %edx
	movl	%edx, (%esp)
	leal	sel_forwardingTargetForSelector_-.L0(%ebx), %edx
	movl	%edx, 4(%esp)
	movl	12(%ebp), %edx
	movl	%edx, 8(%esp)
	call	*%eax

	movl	%eax, 8(%ebp)
	movl	%eax, (%esp)
	movl	12(%ebp), %eax
	movl	%eax, 4(%esp)
	leal	objc_msg_lookup-.L0(%ebx), %eax
	call	*%eax

	addl	$20, %esp
	popl	%ebx
	popl	%ebp

	jmp	*%eax

init:
	pushl	%ebp
	movl	%esp, %ebp

	pushl	%ebx
	subl	$4, %esp

	call	get_eip
.L1:

	leal	module-.L1(%ebx), %eax
	movl	%eax, (%esp)
	leal	__objc_exec_class-.L1(%ebx), %eax
	call	*%eax

	addl	$4, %esp
	popl	%ebx
	popl	%ebp
	ret

get_eip:
	movl	(%esp), %ebx
	ret

.section .init_array
	.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

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

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