ObjFW  Check-in [f840649052]

Overview
Comment:runtime: Add a linklib for the Amiga library
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f840649052a3dcd420d25701b658d5855ce02a3200425ef41e601f51f7f07112
User & Date: js on 2018-05-01 15:10:53
Other Links: manifest | tags
Context
2018-05-05
15:57
runtime: Make exceptions work in Amiga library check-in: 1cae2c720c user: js tags: trunk
2018-05-01
15:10
runtime: Add a linklib for the Amiga library check-in: f840649052 user: js tags: trunk
09:39
PLATFORMS.md: Add AmigaOS check-in: 1ff0d2581e user: js tags: trunk
Changes

Modified configure.ac from [7300383902] to [3670da2152].

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
			[Minimum value for long long])

		AC_DEFINE(__have_longlong64, 1,
			[Required for AmigaOS to correctly define PRI?64])

		AC_SUBST(NOIXEMUL, -noixemul)
		AC_SUBST(OBJFW_RT_AMIGA_LIB, objfw_rt.library)

		AC_SUBST(OBJFW_RT_INLINE_H, ObjFW_RT_inline.h)
		AC_SUBST(SFDC_TARGET, m68k-amigaos)
		;;
	powerpc-*-amigaos*)
		enable_shared="no"
		enable_threads="no"
		;;
	*-morphos*)
		AS_IF([test x"$with_ixemul" != x"yes"], [
			OBJCFLAGS="$OBJCFLAGS -noixemul"
			LDFLAGS="$LDFLAGS -noixemul"
			enable_files="yes"	# Required for reading ENV:

			AC_SUBST(NOIXEMUL, -noixemul)
			AC_SUBST(OBJFW_RT_AMIGA_LIB, objfw_rt.library)

			AC_SUBST(OBJFW_RT_INLINE_H, ObjFW_RT_inline.h)
			AC_SUBST(SFDC_TARGET, ppc-morphos)
		])

		enable_shared="no"
		enable_threads="no"
		;;







>















>







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
			[Minimum value for long long])

		AC_DEFINE(__have_longlong64, 1,
			[Required for AmigaOS to correctly define PRI?64])

		AC_SUBST(NOIXEMUL, -noixemul)
		AC_SUBST(OBJFW_RT_AMIGA_LIB, objfw_rt.library)
		AC_SUBST(OBJFW_RT_AMIGA_LINKLIB, libobjfw_rt.linklib.a)
		AC_SUBST(OBJFW_RT_INLINE_H, ObjFW_RT_inline.h)
		AC_SUBST(SFDC_TARGET, m68k-amigaos)
		;;
	powerpc-*-amigaos*)
		enable_shared="no"
		enable_threads="no"
		;;
	*-morphos*)
		AS_IF([test x"$with_ixemul" != x"yes"], [
			OBJCFLAGS="$OBJCFLAGS -noixemul"
			LDFLAGS="$LDFLAGS -noixemul"
			enable_files="yes"	# Required for reading ENV:

			AC_SUBST(NOIXEMUL, -noixemul)
			AC_SUBST(OBJFW_RT_AMIGA_LIB, objfw_rt.library)
			AC_SUBST(OBJFW_RT_AMIGA_LINKLIB, libobjfw_rt.linklib.a)
			AC_SUBST(OBJFW_RT_INLINE_H, ObjFW_RT_inline.h)
			AC_SUBST(SFDC_TARGET, ppc-morphos)
		])

		enable_shared="no"
		enable_threads="no"
		;;

Modified extra.mk.in from [b4e501de40] to [7c45526c61].

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
OBJFW_SHARED_LIB = @OBJFW_SHARED_LIB@
OBJFW_STATIC_LIB = @OBJFW_STATIC_LIB@
OBJFW_FRAMEWORK = @OBJFW_FRAMEWORK@
# When changing: Be sure to also change these in the Xcode project!
OBJFW_LIB_MAJOR = 9
OBJFW_LIB_MINOR = 0
OBJFW_LIB_MAJOR_MINOR = ${OBJFW_LIB_MAJOR}.${OBJFW_LIB_MINOR}

OBJFW_RT_SHARED_LIB = @OBJFW_RT_SHARED_LIB@
OBJFW_RT_STATIC_LIB = @OBJFW_RT_STATIC_LIB@
OBJFW_RT_FRAMEWORK = @OBJFW_RT_FRAMEWORK@
OBJFW_RT_AMIGA_LIB = @OBJFW_RT_AMIGA_LIB@

OBJFW_RT_LIB_MAJOR = 0
OBJFW_RT_LIB_MINOR = 0
OBJFW_RT_LIB_MAJOR_MINOR = ${OBJFW_RT_LIB_MAJOR}.${OBJFW_RT_LIB_MINOR}

OBJFW_BRIDGE_SHARED_LIB = @OBJFW_BRIDGE_SHARED_LIB@
OBJFW_BRIDGE_STATIC_LIB = @OBJFW_BRIDGE_STATIC_LIB@
OBJFW_BRIDGE_FRAMEWORK = @OBJFW_BRIDGE_FRAMEWORK@












>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
OBJFW_SHARED_LIB = @OBJFW_SHARED_LIB@
OBJFW_STATIC_LIB = @OBJFW_STATIC_LIB@
OBJFW_FRAMEWORK = @OBJFW_FRAMEWORK@
# When changing: Be sure to also change these in the Xcode project!
OBJFW_LIB_MAJOR = 9
OBJFW_LIB_MINOR = 0
OBJFW_LIB_MAJOR_MINOR = ${OBJFW_LIB_MAJOR}.${OBJFW_LIB_MINOR}

OBJFW_RT_SHARED_LIB = @OBJFW_RT_SHARED_LIB@
OBJFW_RT_STATIC_LIB = @OBJFW_RT_STATIC_LIB@
OBJFW_RT_FRAMEWORK = @OBJFW_RT_FRAMEWORK@
OBJFW_RT_AMIGA_LIB = @OBJFW_RT_AMIGA_LIB@
OBJFW_RT_AMIGA_LINKLIB = @OBJFW_RT_AMIGA_LINKLIB@
OBJFW_RT_LIB_MAJOR = 0
OBJFW_RT_LIB_MINOR = 0
OBJFW_RT_LIB_MAJOR_MINOR = ${OBJFW_RT_LIB_MAJOR}.${OBJFW_RT_LIB_MINOR}

OBJFW_BRIDGE_SHARED_LIB = @OBJFW_BRIDGE_SHARED_LIB@
OBJFW_BRIDGE_STATIC_LIB = @OBJFW_BRIDGE_STATIC_LIB@
OBJFW_BRIDGE_FRAMEWORK = @OBJFW_BRIDGE_FRAMEWORK@

Modified src/runtime/Makefile from [37696a2fb5] to [f41345f3e8].

1
2
3

4
5
6
7
8
9
10
include ../../extra.mk

SUBDIRS = lookup-asm

CLEAN = ${OBJFW_RT_INLINE_H}

SHARED_LIB = ${OBJFW_RT_SHARED_LIB}
STATIC_LIB = ${OBJFW_RT_STATIC_LIB}
FRAMEWORK = ${OBJFW_RT_FRAMEWORK}
AMIGA_LIB = ${OBJFW_RT_AMIGA_LIB}
LIB_MAJOR = ${OBJFW_RT_LIB_MAJOR}



>







1
2
3
4
5
6
7
8
9
10
11
include ../../extra.mk

SUBDIRS = lookup-asm
SUBDIRS_AFTER = linklib
CLEAN = ${OBJFW_RT_INLINE_H}

SHARED_LIB = ${OBJFW_RT_SHARED_LIB}
STATIC_LIB = ${OBJFW_RT_STATIC_LIB}
FRAMEWORK = ${OBJFW_RT_FRAMEWORK}
AMIGA_LIB = ${OBJFW_RT_AMIGA_LIB}
LIB_MAJOR = ${OBJFW_RT_LIB_MAJOR}
52
53
54
55
56
57
58





CPPFLAGS += -I. -I.. -I../..				\
	    -DOF_COMPILING_OBJFW_RT			\
	    -DOBJFW_RT_LIB_MAJOR=${OBJFW_RT_LIB_MAJOR}	\
	    -DOBJFW_RT_LIB_MINOR=${OBJFW_RT_LIB_MINOR}
AMIGA_LIB_CFLAGS += -DOBJC_COMPILING_AMIGA_LIBRARY
LD = ${OBJC}
FRAMEWORK_LIBS = ${LIBS}












>
>
>
>
>
53
54
55
56
57
58
59
60
61
62
63
64
CPPFLAGS += -I. -I.. -I../..				\
	    -DOF_COMPILING_OBJFW_RT			\
	    -DOBJFW_RT_LIB_MAJOR=${OBJFW_RT_LIB_MAJOR}	\
	    -DOBJFW_RT_LIB_MINOR=${OBJFW_RT_LIB_MINOR}
AMIGA_LIB_CFLAGS += -DOBJC_COMPILING_AMIGA_LIBRARY
LD = ${OBJC}
FRAMEWORK_LIBS = ${LIBS}

# For 68000, GCC emits calls to helper functions that expect a4 to be set.
# Remove this once the library is using -fbaserel.
AMIGA_LIB_CFLAGS += -mcpu=68020
AMIGA_LIB_LDFLAGS += -mcpu=68020

Modified src/runtime/ObjFW_RT.h from [45784520cd] to [df243066af].

217
218
219
220
221
222
223
224




225



226
227
228
229
230
231
232
	long count;
	Protocol *__unsafe_unretained _Nonnull list[1];
};

#ifdef __cplusplus
extern "C" {
#endif
# ifdef OBJC_AMIGA_LIBRARY




#  import "ObjFW_RT_inline.h"



extern struct Library *ObjFWRTBase;
# else
extern SEL _Nonnull sel_registerName(
    const char *_Nonnull name OBJC_M68K_REG("a0"));
extern const char *_Nonnull sel_getName(SEL _Nonnull sel OBJC_M68K_REG("a0"));
extern bool sel_isEqual(SEL _Nonnull sel1 OBJC_M68K_REG("a0"),
    SEL _Nonnull sel2 OBJC_M68K_REG("a1"));







|
>
>
>
>
|
>
>
>







217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
	long count;
	Protocol *__unsafe_unretained _Nonnull list[1];
};

#ifdef __cplusplus
extern "C" {
#endif
# if defined(OBJC_AMIGA_LIBRARY) || defined(OBJC_COMPILING_AMIGA_LINKLIB)
#  if defined(__amigaos__) && !defined(__MORPHOS__) && !defined(__amigaos4__)
#   define INTUITION_CLASSES_H
#  endif
#  include <exec/types.h>
#  include "ObjFW_RT_inline.h"
#  if defined(__amigaos__) && !defined(__MORPHOS__) && !defined(__amigaos4__)
#   undef INTUITION_CLASSES_H
#  endif
extern struct Library *ObjFWRTBase;
# else
extern SEL _Nonnull sel_registerName(
    const char *_Nonnull name OBJC_M68K_REG("a0"));
extern const char *_Nonnull sel_getName(SEL _Nonnull sel OBJC_M68K_REG("a0"));
extern bool sel_isEqual(SEL _Nonnull sel1 OBJC_M68K_REG("a0"),
    SEL _Nonnull sel2 OBJC_M68K_REG("a1"));
302
303
304
305
306
307
308


309
310
311
312
313
314
315
extern IMP _Nonnull objc_msg_lookup_super(struct objc_super *_Nonnull super,
    SEL _Nonnull sel);
extern IMP _Nonnull objc_msg_lookup_super_stret(
    struct objc_super *_Nonnull super, SEL _Nonnull sel);
extern id _Nullable objc_lookUpClass(const char *_Nonnull name);
extern id _Nullable objc_getClass(const char *_Nonnull name);
extern id _Nonnull objc_getRequiredClass(const char *_Nonnull name);


extern void objc_exception_throw(id _Nullable object);
extern int objc_sync_enter(id _Nullable object);
extern int objc_sync_exit(id _Nullable object);
extern id _Nullable objc_getProperty(id _Nonnull self, SEL _Nonnull _cmd,
    ptrdiff_t offset, bool atomic);
extern void objc_setProperty(id _Nonnull self, SEL _Nonnull _cmd,
    ptrdiff_t offset, id _Nullable value, bool atomic, signed char copy);







>
>







309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
extern IMP _Nonnull objc_msg_lookup_super(struct objc_super *_Nonnull super,
    SEL _Nonnull sel);
extern IMP _Nonnull objc_msg_lookup_super_stret(
    struct objc_super *_Nonnull super, SEL _Nonnull sel);
extern id _Nullable objc_lookUpClass(const char *_Nonnull name);
extern id _Nullable objc_getClass(const char *_Nonnull name);
extern id _Nonnull objc_getRequiredClass(const char *_Nonnull name);
extern Class _Nullable objc_lookup_class(const char *_Nonnull name);
extern Class _Nonnull objc_get_class(const char *_Nonnull name);
extern void objc_exception_throw(id _Nullable object);
extern int objc_sync_enter(id _Nullable object);
extern int objc_sync_exit(id _Nullable object);
extern id _Nullable objc_getProperty(id _Nonnull self, SEL _Nonnull _cmd,
    ptrdiff_t offset, bool atomic);
extern void objc_setProperty(id _Nonnull self, SEL _Nonnull _cmd,
    ptrdiff_t offset, id _Nullable value, bool atomic, signed char copy);

Modified src/runtime/ObjFW_RT.sfd from [daf0164aa0] to [576423b2b1].

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
==base _ObjFWRTBase
==basetype struct Library *
==libname objfw_rt.library
==bias 30
==public
* Functions for the linklib
void objc_init(struct objc_libc *libc)(a0)
* Used by the compiler - these need glue code
void glue___objc_exec_class(void *module)(a0)
IMP glue_objc_msg_lookup(id obj, SEL sel)(a0,a1)
IMP glue_objc_msg_lookup_stret(id obj, SEL sel)(a0,a1)
IMP glue_objc_msg_lookup_super(struct objc_super *super, SEL sel)(a0,a1)
IMP glue_objc_msg_lookup_super_stret(struct objc_super *super, SEL sel)(a0,a1)
id glue_objc_lookUpClass(const char *name)(a0)
id glue_objc_getClass(const char *name)(a0)
id glue_objc_getRequiredClass(const char *name)(a0)


void glue_objc_exception_throw(id object)(a0)
int glue_objc_sync_enter(id object)(a0)
int glue_objc_sync_exit(id object)(a0)
id glue_objc_getProperty(id self, SEL _cmd, ptrdiff_t offset, bool atomic)(a0,a1,d0,d1)
void glue_objc_setProperty(id self, SEL _cmd, ptrdiff_t offset, id value, bool atomic, signed char copy)(a0,a1,d0,a2,d1,d2)
void glue_objc_getPropertyStruct(void *dest, const void *src, ptrdiff_t size, bool atomic, bool strong)(a0,a1,d0,d1,d2)
void glue_objc_setPropertyStruct(void *dest, const void *src, ptrdiff_t size, bool atomic, bool strong)(a0,a1,d0,d1,d2)
void glue_objc_enumerationMutation(id obj)(a0)
* Functions declared in ObjFW_RT.h
SEL _Nonnull sel_registerName(const char *_Nonnull name)(a0)
const char *_Nonnull sel_getName(SEL _Nonnull sel)(a0)
bool sel_isEqual(SEL _Nonnull sel1, SEL _Nonnull sel2)(a0,a1)
Class _Nonnull objc_allocateClassPair(Class _Nullable superclass, const char *_Nonnull name, size_t extra_bytes)(a0,a1,d0)
void objc_registerClassPair(Class _Nonnull cls)(a0)
unsigned int objc_getClassList(Class _Nonnull *_Nullable buf, unsigned int count)(a0,d0)








|
|
|
|
|
|
|
|
>
>
|
|
|
|
|
|
|
|







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
==base _ObjFWRTBase
==basetype struct Library *
==libname objfw_rt.library
==bias 30
==public
* Functions for the linklib
void objc_init(struct objc_libc *libc)(a0)
* Used by the compiler - these need glue code
void glue___objc_exec_class(void *_Nonnull module)(a0)
IMP _Nonnull glue_objc_msg_lookup(id _Nullable obj, SEL _Nonnull sel)(a0,a1)
IMP _Nonnull glue_objc_msg_lookup_stret(id _Nullable obj, SEL _Nonnull sel)(a0,a1)
IMP _Nonnull glue_objc_msg_lookup_super(struct objc_super *_Nonnull super, SEL _Nonnull sel)(a0,a1)
IMP _Nonnull glue_objc_msg_lookup_super_stret(struct objc_super *_Nonnull super, SEL _Nonnull sel)(a0,a1)
id _Nullable glue_objc_lookUpClass(const char *_Nonnull name)(a0)
id _Nullable glue_objc_getClass(const char *_Nonnull name)(a0)
id _Nonnull glue_objc_getRequiredClass(const char *_Nonnull name)(a0)
Class _Nullable glue_objc_lookup_class(const char *_Nonnull name)(a0)
Class _Nonnull glue_objc_get_class(const char *_Nonnull name)(a0)
void glue_objc_exception_throw(id _Nonnull object)(a0)
int glue_objc_sync_enter(id _Nullable object)(a0)
int glue_objc_sync_exit(id _Nullable object)(a0)
id glue_objc_getProperty(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, bool atomic)(a0,a1,d0,d1)
void glue_objc_setProperty(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, id value, bool atomic, signed char copy)(a0,a1,d0,a2,d1,d2)
void glue_objc_getPropertyStruct(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong)(a0,a1,d0,d1,d2)
void glue_objc_setPropertyStruct(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong)(a0,a1,d0,d1,d2)
void glue_objc_enumerationMutation(id _Nonnull obj)(a0)
* Functions declared in ObjFW_RT.h
SEL _Nonnull sel_registerName(const char *_Nonnull name)(a0)
const char *_Nonnull sel_getName(SEL _Nonnull sel)(a0)
bool sel_isEqual(SEL _Nonnull sel1, SEL _Nonnull sel2)(a0,a1)
Class _Nonnull objc_allocateClassPair(Class _Nullable superclass, const char *_Nonnull name, size_t extra_bytes)(a0,a1,d0)
void objc_registerClassPair(Class _Nonnull cls)(a0)
unsigned int objc_getClassList(Class _Nonnull *_Nullable buf, unsigned int count)(a0,d0)

Modified src/runtime/amiga-glue.m from [742f84c7f3] to [f6066a455d].

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#import "ObjFW_RT.h"
#import "private.h"
#import "macros.h"

void
glue___objc_exec_class(void *module OBJC_M68K_REG("a0"))
{
	glue___objc_exec_class(module);
}

IMP
glue_objc_msg_lookup(id obj OBJC_M68K_REG("a0"), SEL sel OBJC_M68K_REG("a1"))
{
	return objc_msg_lookup(obj, sel);
}







|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#import "ObjFW_RT.h"
#import "private.h"
#import "macros.h"

void
glue___objc_exec_class(void *module OBJC_M68K_REG("a0"))
{
	__objc_exec_class(module);
}

IMP
glue_objc_msg_lookup(id obj OBJC_M68K_REG("a0"), SEL sel OBJC_M68K_REG("a1"))
{
	return objc_msg_lookup(obj, sel);
}
67
68
69
70
71
72
73












74
75
76
77
78
79
80
}

id
glue_objc_getRequiredClass(const char *name OBJC_M68K_REG("a0"))
{
	return objc_getRequiredClass(name);
}













void
glue_objc_exception_throw(id object OBJC_M68K_REG("a0"))
{
	objc_exception_throw(object);

	OF_UNREACHABLE







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







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
}

id
glue_objc_getRequiredClass(const char *name OBJC_M68K_REG("a0"))
{
	return objc_getRequiredClass(name);
}

Class
glue_objc_lookup_class(const char *name OBJC_M68K_REG("a0"))
{
	return objc_lookup_class(name);
}

Class
glue_objc_get_class(const char *name OBJC_M68K_REG("a0"))
{
	return objc_get_class(name);
}

void
glue_objc_exception_throw(id object OBJC_M68K_REG("a0"))
{
	objc_exception_throw(object);

	OF_UNREACHABLE

Modified src/runtime/amiga-library.m from [ec9a414c68] to [6c5b775beb].

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
objc_init(struct ObjFWRTBase *base OBJC_M68K_REG("a6"),
    struct objc_libc *libc_ OBJC_M68K_REG("a0"))
{
	uintptr_t *iter, *iter0;

	libc = libc_;

	stdout = libc->stdout;
	stderr = libc->stderr;

	iter0 = &__CTOR_LIST__[1];
	for (iter = iter0; *iter != 0; iter++);

	while (iter > iter0) {
		void (*ctor)(void) = (void (*)(void))*--iter;
		ctor();







|
|







137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
objc_init(struct ObjFWRTBase *base OBJC_M68K_REG("a6"),
    struct objc_libc *libc_ OBJC_M68K_REG("a0"))
{
	uintptr_t *iter, *iter0;

	libc = libc_;

	stdout = libc->stdout_;
	stderr = libc->stderr_;

	iter0 = &__CTOR_LIST__[1];
	for (iter = iter0; *iter != 0; iter++);

	while (iter > iter0) {
		void (*ctor)(void) = (void (*)(void))*--iter;
		ctor();
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
	ULONG data_size;
	CONST_APTR *function_table;
	ULONG *data_table;
	struct Library *(*init_func)(
	    struct ExecBase *exec_base OBJC_M68K_REG("a6"),
	    BPTR seg_list OBJC_M68K_REG("a0"),
	    struct ObjFWRTBase *base OBJC_M68K_REG("d0"));
} initTable = {
	sizeof(struct ObjFWRTBase),
	function_table,
	NULL,
	lib_init
};

static struct Resident resident = {







|







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
	ULONG data_size;
	CONST_APTR *function_table;
	ULONG *data_table;
	struct Library *(*init_func)(
	    struct ExecBase *exec_base OBJC_M68K_REG("a6"),
	    BPTR seg_list OBJC_M68K_REG("a0"),
	    struct ObjFWRTBase *base OBJC_M68K_REG("d0"));
} init_table = {
	sizeof(struct ObjFWRTBase),
	function_table,
	NULL,
	lib_init
};

static struct Resident resident = {
248
249
250
251
252
253
254
255
256
	    ,
	.rt_Version = OBJFW_RT_LIB_MAJOR,
	.rt_Type = NT_LIBRARY,
	.rt_Pri = 0,
	.rt_Name = (char *)"objfw_rt.library",
	.rt_IdString = (char *)"ObjFW_RT " VERSION_STRING
	    " \xA9 2008-2018 Jonathan Schleifer",
	.rt_Init = &initTable
};







|

248
249
250
251
252
253
254
255
256
	    ,
	.rt_Version = OBJFW_RT_LIB_MAJOR,
	.rt_Type = NT_LIBRARY,
	.rt_Pri = 0,
	.rt_Name = (char *)"objfw_rt.library",
	.rt_IdString = (char *)"ObjFW_RT " VERSION_STRING
	    " \xA9 2008-2018 Jonathan Schleifer",
	.rt_Init = &init_table
};

Added src/runtime/linklib/Makefile version [7d1dbba2ec].



















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
include ../../../extra.mk

STATIC_LIB = ${OBJFW_RT_AMIGA_LINKLIB}
SRCS = linklib.m

include ../../../buildsys.mk

CPPFLAGS += -DOBJC_COMPILING_AMIGA_LINKLIB -I.. -I../.. -I../../..
LD = ${OBJC}

Added src/runtime/linklib/linklib.m version [03684c47f6].















































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
 *               2018
 *   Jonathan Schleifer <js@heap.zone>
 *
 * 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"

#import "ObjFW_RT.h"
#import "private.h"
#import "macros.h"

#include <proto/exec.h>
#include <stdio.h>
#include <stdlib.h>

struct Library *ObjFWRTBase;

static void __attribute__((__constructor__))
init(void)
{
	static bool initialized = false;
	static struct objc_libc libc;

	if (initialized)
		return;

	if ((ObjFWRTBase = OpenLibrary("objfw_rt.library", 0)) == NULL) {
		fputs("Failed to open objfw_rt.library!\n", stderr);
		abort();
	}

	libc = (struct objc_libc){
		.malloc = malloc,
		.calloc = calloc,
		.realloc = realloc,
		.free = free,
		.vfprintf = vfprintf,
		.fputs = fputs,
		.exit = exit,
		.abort = abort,
		.stdout_ = stdout,
		.stderr_ = stderr
	};
	objc_init(&libc);

	initialized = true;
}

OF_DESTRUCTOR()
{
	CloseLibrary(ObjFWRTBase);
}

void
__objc_exec_class(void *module)
{
	/*
	 * The compiler generates constructors that call into this, so it is
	 * possible that we are not set up yet when we get called.
	 */
	init();

	glue___objc_exec_class(module);
}

IMP
objc_msg_lookup(id obj, SEL sel)
{
	return glue_objc_msg_lookup(obj, sel);
}

IMP
objc_msg_lookup_stret(id obj, SEL sel)
{
	return glue_objc_msg_lookup_stret(obj, sel);
}

IMP
objc_msg_lookup_super(struct objc_super *super, SEL sel)
{
	return glue_objc_msg_lookup_super(super, sel);
}

IMP
objc_msg_lookup_super_stret(struct objc_super *super, SEL sel)
{
	return glue_objc_msg_lookup_super_stret(super, sel);
}

id
objc_lookUpClass(const char *name)
{
	return glue_objc_lookUpClass(name);
}

id
objc_getClass(const char *name)
{
	return glue_objc_getClass(name);
}

id
objc_getRequiredClass(const char *name)
{
	return glue_objc_getRequiredClass(name);
}

Class
objc_lookup_class(const char *name)
{
	return glue_objc_lookup_class(name);
}

Class
objc_get_class(const char *name)
{
	return glue_objc_get_class(name);
}

void
objc_exception_throw(id object)
{
	glue_objc_exception_throw(object);

	OF_UNREACHABLE
}

int
objc_sync_enter(id object)
{
	return glue_objc_sync_enter(object);
}

int
objc_sync_exit(id object)
{
	return glue_objc_sync_exit(object);
}

id
objc_getProperty(id self, SEL _cmd, ptrdiff_t offset, bool atomic)
{
	return glue_objc_getProperty(self, _cmd, offset, atomic);
}

void
objc_setProperty(id self, SEL _cmd, ptrdiff_t offset, id value, bool atomic,
    signed char copy)
{
	glue_objc_setProperty(self, _cmd, offset, value, atomic, copy);
}

void
objc_getPropertyStruct(void *dest, const void *src, ptrdiff_t size, bool atomic,
    bool strong)
{
	glue_objc_getPropertyStruct(dest, src, size, atomic, strong);
}

void
objc_setPropertyStruct(void *dest, const void *src, ptrdiff_t size, bool atomic,
    bool strong)
{
	glue_objc_setPropertyStruct(dest, src, size, atomic, strong);
}

void
objc_enumerationMutation(id obj)
{
	glue_objc_enumerationMutation(obj);
}

Modified src/runtime/private.h from [9b8ebef4c7] to [2cf61640d4].

130
131
132
133
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
164
165
166
167
168
169




170
171
172
173
174
175
176
		} *_Nonnull buckets[256];
#else
		IMP _Nullable buckets[256];
#endif
	} *_Nonnull buckets[256];
};

#ifdef OBJC_COMPILING_AMIGA_LIBRARY
# undef stdout
# undef stderr
extern struct objc_libc {
	void *(*malloc)(size_t);
	void *(*calloc)(size_t, size_t);
	void *(*realloc)(void *, size_t);
	void (*free)(void *);
	int (*vfprintf)(FILE *, const char *, _BSD_VA_LIST_);
	int (*fputs)(const char *, FILE *);
	void (*exit)(int);
	void (*abort)(void);
	FILE *stdout;
	FILE *stderr;
} *objc_libc;





extern FILE *stdout, *stderr;

extern void glue___objc_exec_class(void *_Nonnull module OBJC_M68K_REG("a0"));
extern IMP _Nonnull glue_objc_msg_lookup(id _Nullable obj OBJC_M68K_REG("a0"),
    SEL _Nonnull sel OBJC_M68K_REG("a1"));
extern IMP _Nonnull glue_objc_msg_lookup_stret(
    id _Nullable obj OBJC_M68K_REG("a0"), SEL _Nonnull sel OBJC_M68K_REG("a1"));
extern IMP _Nonnull glue_objc_msg_lookup_super(
    struct objc_super *_Nonnull super OBJC_M68K_REG("a0"),
    SEL _Nonnull sel OBJC_M68K_REG("a1"));
extern IMP _Nonnull glue_objc_msg_lookup_super_stret(
    struct objc_super *_Nonnull super OBJC_M68K_REG("a0"),
    SEL _Nonnull sel OBJC_M68K_REG("a1"));
extern id _Nullable glue_objc_lookUpClass(
    const char *_Nonnull name OBJC_M68K_REG("a0"));
extern id _Nullable glue_objc_getClass(
    const char *_Nonnull name OBJC_M68K_REG("a0"));
extern id _Nonnull glue_objc_getRequiredClass(




    const char *_Nonnull name OBJC_M68K_REG("a0"));
extern void glue_objc_exception_throw(id _Nullable object OBJC_M68K_REG("a0"));
extern int glue_objc_sync_enter(id _Nullable object OBJC_M68K_REG("a0"));
extern int glue_objc_sync_exit(id _Nullable object OBJC_M68K_REG("a0"));
extern id _Nullable glue_objc_getProperty(id _Nonnull self OBJC_M68K_REG("a0"),
    SEL _Nonnull _cmd OBJC_M68K_REG("a1"), ptrdiff_t offset OBJC_M68K_REG("d0"),
    bool atomic OBJC_M68K_REG("d1"));







|
|
<





|



|
|

>
>
>
>
>


















>
>
>
>







130
131
132
133
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
		} *_Nonnull buckets[256];
#else
		IMP _Nullable buckets[256];
#endif
	} *_Nonnull buckets[256];
};

#if defined(OBJC_COMPILING_AMIGA_LIBRARY) || \
    defined(OBJC_COMPILING_AMIGA_LINKLIB)

extern struct objc_libc {
	void *(*malloc)(size_t);
	void *(*calloc)(size_t, size_t);
	void *(*realloc)(void *, size_t);
	void (*free)(void *);
	int (*vfprintf)(FILE *, const char *, va_list);
	int (*fputs)(const char *, FILE *);
	void (*exit)(int);
	void (*abort)(void);
	FILE *stdout_;
	FILE *stderr_;
} *objc_libc;
#endif

#ifdef OBJC_COMPILING_AMIGA_LIBRARY
# undef stdout
# undef stderr
extern FILE *stdout, *stderr;

extern void glue___objc_exec_class(void *_Nonnull module OBJC_M68K_REG("a0"));
extern IMP _Nonnull glue_objc_msg_lookup(id _Nullable obj OBJC_M68K_REG("a0"),
    SEL _Nonnull sel OBJC_M68K_REG("a1"));
extern IMP _Nonnull glue_objc_msg_lookup_stret(
    id _Nullable obj OBJC_M68K_REG("a0"), SEL _Nonnull sel OBJC_M68K_REG("a1"));
extern IMP _Nonnull glue_objc_msg_lookup_super(
    struct objc_super *_Nonnull super OBJC_M68K_REG("a0"),
    SEL _Nonnull sel OBJC_M68K_REG("a1"));
extern IMP _Nonnull glue_objc_msg_lookup_super_stret(
    struct objc_super *_Nonnull super OBJC_M68K_REG("a0"),
    SEL _Nonnull sel OBJC_M68K_REG("a1"));
extern id _Nullable glue_objc_lookUpClass(
    const char *_Nonnull name OBJC_M68K_REG("a0"));
extern id _Nullable glue_objc_getClass(
    const char *_Nonnull name OBJC_M68K_REG("a0"));
extern id _Nonnull glue_objc_getRequiredClass(
    const char *_Nonnull name OBJC_M68K_REG("a0"));
extern Class _Nullable glue_objc_lookup_class(
    const char *_Nonnull name OBJC_M68K_REG("a0"));
extern Class _Nonnull glue_objc_get_class(
    const char *_Nonnull name OBJC_M68K_REG("a0"));
extern void glue_objc_exception_throw(id _Nullable object OBJC_M68K_REG("a0"));
extern int glue_objc_sync_enter(id _Nullable object OBJC_M68K_REG("a0"));
extern int glue_objc_sync_exit(id _Nullable object OBJC_M68K_REG("a0"));
extern id _Nullable glue_objc_getProperty(id _Nonnull self OBJC_M68K_REG("a0"),
    SEL _Nonnull _cmd OBJC_M68K_REG("a1"), ptrdiff_t offset OBJC_M68K_REG("d0"),
    bool atomic OBJC_M68K_REG("d1"));