ObjFW  Check-in [bbabe17c4f]

Overview
Comment:Check for forwarding at compile time.

Checking at configure time can potentially break universal builds.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bbabe17c4fa5627d61926fd8471ec2dc04d1f4fac96fc2aff303e826521566cd
User & Date: js on 2013-07-08 15:30:57
Other Links: manifest | tags
Context
2013-07-08
15:43
Check for ASM lookup at compile time. check-in: a4f1bd6c08 user: js tags: trunk
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
Changes

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

236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
			#if defined(__amd64__) || defined(__x86_64__)
			# ifdef __ELF__
			yes
			# endif
			#endif
		], [
			AC_SUBST(LOOKUP_S, lookup-amd64-elf.S)
			AC_SUBST(FORWARDING_S, forwarding-amd64-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(__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







<


<
<









<
<







236
237
238
239
240
241
242

243
244


245
246
247
248
249
250
251
252
253


254
255
256
257
258
259
260
			#if defined(__amd64__) || defined(__x86_64__)
			# ifdef __ELF__
			yes
			# endif
			#endif
		], [
			AC_SUBST(LOOKUP_S, lookup-amd64-elf.S)

			AC_DEFINE(OF_ASM_LOOKUP, 1,
				[Whether to use assembly for lookup])


		], [
			AC_EGREP_CPP(yes, [
				#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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
			[Whether we use the Apple ObjC runtime])

		AC_CHECK_LIB(objc, objc_msgSend, [
			LIBS="-lobjc $LIBS"
		], [
			AC_MSG_ERROR([libobjc not found!])
		])

		dnl We should check for PPC64, as this currently does not
		dnl support forwardingTargetForSelector: as there is no test
		dnl machine available.
		AC_SUBST(FORWARDING_S, "apple-forwarding.S")
		AC_DEFINE(OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR, 1,
			[Whether we have forwardingTargetForSelector:])
		;;
esac

AC_CHECK_FUNC(objc_constructInstance, [], [
	AC_SUBST(INSTANCE_M, "instance.m")
])








<
<
<
<
<
<
<







352
353
354
355
356
357
358







359
360
361
362
363
364
365
			[Whether we use the Apple ObjC runtime])

		AC_CHECK_LIB(objc, objc_msgSend, [
			LIBS="-lobjc $LIBS"
		], [
			AC_MSG_ERROR([libobjc not found!])
		])







		;;
esac

AC_CHECK_FUNC(objc_constructInstance, [], [
	AC_SUBST(INSTANCE_M, "instance.m")
])

Modified extra.mk.in from [4ecdb3ce4c] to [c7fdab5546].

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
OBJFW_SHARED_LIB = @OBJFW_SHARED_LIB@
OBJFW_STATIC_LIB = @OBJFW_STATIC_LIB@
# When changing: Be sure to also change these in the Xcode project!
OBJFW_LIB_MAJOR = 7
OBJFW_LIB_MINOR = 0
OBJFW_LIB_MAJOR_MINOR = ${OBJFW_LIB_MAJOR}.${OBJFW_LIB_MINOR}

OBJFW_BRIDGE_SHARED_LIB = @OBJFW_BRIDGE_SHARED_LIB@
OBJFW_BRIDGE_STATIC_LIB = @OBJFW_BRIDGE_STATIC_LIB@

APPLE_FORWARDING_S = @APPLE_FORWARDING_S@
ASPRINTF_M = @ASPRINTF_M@
ATOMIC_H = @ATOMIC_H@
AUTORELEASE_M = @AUTORELEASE_M@
BIN_PREFIX = @BIN_PREFIX@
BRIDGE = @BRIDGE@
EXCEPTIONS_A = @EXCEPTIONS_A@
EXCEPTIONS_EXCEPTIONS_A = @EXCEPTIONS_EXCEPTIONS_A@
EXCEPTIONS_EXCEPTIONS_LIB_A = @EXCEPTIONS_EXCEPTIONS_LIB_A@
EXCEPTIONS_LIB_A = @EXCEPTIONS_LIB_A@
FORWARDING_S = @FORWARDING_S@
FOUNDATION_COMPAT_M = @FOUNDATION_COMPAT_M@
INSTANCE_M = @INSTANCE_M@
LIBOBJFW_DEP = @LIBOBJFW_DEP@
LOOKUP_S = @LOOKUP_S@
MAP_LDFLAGS = @MAP_LDFLAGS@
OFBLOCKTESTS_M = @OFBLOCKTESTS_M@
OFHTTPCLIENTTESTS_M = @OFHTTPCLIENTTESTS_M@










<









<







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
OBJFW_SHARED_LIB = @OBJFW_SHARED_LIB@
OBJFW_STATIC_LIB = @OBJFW_STATIC_LIB@
# When changing: Be sure to also change these in the Xcode project!
OBJFW_LIB_MAJOR = 7
OBJFW_LIB_MINOR = 0
OBJFW_LIB_MAJOR_MINOR = ${OBJFW_LIB_MAJOR}.${OBJFW_LIB_MINOR}

OBJFW_BRIDGE_SHARED_LIB = @OBJFW_BRIDGE_SHARED_LIB@
OBJFW_BRIDGE_STATIC_LIB = @OBJFW_BRIDGE_STATIC_LIB@


ASPRINTF_M = @ASPRINTF_M@
ATOMIC_H = @ATOMIC_H@
AUTORELEASE_M = @AUTORELEASE_M@
BIN_PREFIX = @BIN_PREFIX@
BRIDGE = @BRIDGE@
EXCEPTIONS_A = @EXCEPTIONS_A@
EXCEPTIONS_EXCEPTIONS_A = @EXCEPTIONS_EXCEPTIONS_A@
EXCEPTIONS_EXCEPTIONS_LIB_A = @EXCEPTIONS_EXCEPTIONS_LIB_A@
EXCEPTIONS_LIB_A = @EXCEPTIONS_LIB_A@

FOUNDATION_COMPAT_M = @FOUNDATION_COMPAT_M@
INSTANCE_M = @INSTANCE_M@
LIBOBJFW_DEP = @LIBOBJFW_DEP@
LOOKUP_S = @LOOKUP_S@
MAP_LDFLAGS = @MAP_LDFLAGS@
OFBLOCKTESTS_M = @OFBLOCKTESTS_M@
OFHTTPCLIENTTESTS_M = @OFHTTPCLIENTTESTS_M@

Modified src/Makefile from [f0e6e1c6f7] to [d40a6c1db1].

112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
	OFMutableArray_adjacent.m	\
	OFMutableDictionary_hashtable.m	\
	OFMutableSet_hashtable.m	\
	OFMutableString_UTF8.m		\
	OFSet_hashtable.m		\
	OFString_UTF8.m			\
	${ASPRINTF_M}			\
	${FORWARDING_S}			\
	${FOUNDATION_COMPAT_M}		\
	iso_8859_15.m			\
	windows_1252.m
SRCS_SOCKETS += ${OFSTREAMOBSERVER_KQUEUE_M}	\
		${OFSTREAMOBSERVER_POLL_M}	\
		${OFSTREAMOBSERVER_SELECT_M}	\
		OFTCPSocket+SOCKS5.m







|







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
	OFMutableArray_adjacent.m	\
	OFMutableDictionary_hashtable.m	\
	OFMutableSet_hashtable.m	\
	OFMutableString_UTF8.m		\
	OFSet_hashtable.m		\
	OFString_UTF8.m			\
	${ASPRINTF_M}			\
	forwarding.S			\
	${FOUNDATION_COMPAT_M}		\
	iso_8859_15.m			\
	windows_1252.m
SRCS_SOCKETS += ${OFSTREAMOBSERVER_KQUEUE_M}	\
		${OFSTREAMOBSERVER_POLL_M}	\
		${OFSTREAMOBSERVER_SELECT_M}	\
		OFTCPSocket+SOCKS5.m

Deleted src/apple-forwarding.S version [d08cda50f4].

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
/*
 * 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.
 */

#include "config.h"

#if defined(__x86_64__)
# include "apple-forwarding-x86_64.S"
#elif defined(__i386__)
# include "apple-forwarding-i386.S"
#elif defined(__arm__)
# include "apple-forwarding-arm.S"
#elif defined(__ppc__)
# include "apple-forwarding-ppc.S"
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































Added src/forwarding.S version [e1168e09d5].











































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/*
 * 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.
 */

#include "config.h"

#ifdef OF_APPLE_RUNTIME
# if defined(__x86_64__)
#  include "apple-forwarding-x86_64.S"
# elif defined(__i386__)
#  include "apple-forwarding-i386.S"
# elif defined(__arm__)
#  include "apple-forwarding-arm.S"
# elif defined(__ppc__)
#  include "apple-forwarding-ppc.S"
# endif
#else
# ifdef __ELF__
#  if defined(__amd64__) || defined(__x86_64__)
#   include "forwarding-x86_64-elf.S"
#  elif defined(__i386__)
#   include "forwarding-x86-elf.S"
#  endif
# endif
#endif

Modified src/macros.h from [171260d70c] to [efb84c3744].

101
102
103
104
105
106
107













108
109
110
111
112
113
114
#   define OF_ARMV6_ASM
#  endif
#  ifdef OF_ARMV7_ASM
#   define OF_ARMV6_ASM
#  endif
# endif
#endif














#define OF_ENSURE(cond)							\
	if (!(cond)) {							\
		fprintf(stderr, "Failed to ensure condition in "	\
		    __FILE__ ":%d:\n" #cond "\n", __LINE__);		\
		abort();						\
	}







>
>
>
>
>
>
>
>
>
>
>
>
>







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
#   define OF_ARMV6_ASM
#  endif
#  ifdef OF_ARMV7_ASM
#   define OF_ARMV6_ASM
#  endif
# endif
#endif

#ifdef OF_APPLE_RUNTIME
# if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || \
    defined(__ppc__)
#  define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR
# endif
#else
# ifdef __ELF__
#  if defined(__amd64__) || defined(__x86_64__) || defined(__i386__)
#   define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR
#  endif
# endif
#endif

#define OF_ENSURE(cond)							\
	if (!(cond)) {							\
		fprintf(stderr, "Failed to ensure condition in "	\
		    __FILE__ ":%d:\n" #cond "\n", __LINE__);		\
		abort();						\
	}