ObjFW  Check-in [98e5c779c8]

Overview
Comment:runtime/linklib: Use CONSTRUCTOR_P on MorphOS

This ensures the runtime gets initialized before anything else.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 98e5c779c8fca379da7ffda58045cd2489d98a4a463a71cb6b350d2c6d3eb2ba
User & Date: js on 2019-02-17 03:05:44
Other Links: manifest | tags
Context
2019-02-17
22:16
OFWindowsRegistryKey: Add write support check-in: 4c5f686a52 user: js tags: trunk
03:05
runtime/linklib: Use CONSTRUCTOR_P on MorphOS check-in: 98e5c779c8 user: js tags: trunk
2019-02-10
23:58
OFWindowsRegistryKey: Support for binary values check-in: 65b31518fc user: js tags: trunk
Changes

Modified src/runtime/linklib/linklib.m from [964c1adbfe] to [b14664876b].

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
54
55
56
57
58
59
60



61
62
63
64
65
66
67







-
-
-







extern void __register_frame_info(const void *, void *);
extern void __deregister_frame_info(const void *);

struct Library *ObjFWRTBase;
void *__objc_class_name_Protocol;

static void
#ifndef OF_AMIGAOS_M68K
    __attribute__((__constructor__))
#endif
ctor(void)
{
	static bool initialized = false;
	struct objc_libc libc = {
		.malloc = malloc,
		.calloc = calloc,
		.realloc = realloc,
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
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







-
-
-
-
-
+
-





-
+


+
+
+







		fputs("Failed to initialize objfw_rt.library!\n", stderr);
		abort();
	}

	initialized = true;
}

static void
#ifndef OF_AMIGAOS_M68K
    __attribute__((__destructor__))
#else
    __attribute__((__unused__))
static void __attribute__((__unused__))
#endif
dtor(void)
{
	CloseLibrary(ObjFWRTBase);
}

#ifdef OF_AMIGAOS_M68K
#if defined(OF_AMIGAOS_M68K)
ADD2INIT(ctor, -2);
ADD2EXIT(dtor, -2);
#elif defined(OF_MORPHOS)
CONSTRUCTOR_P(ctor, -2);
DESTRUCTOR_P(dtor, -2);
#endif

void
__objc_exec_class(void *module)
{
	/*
	 * The compiler generates constructors that call into this, so it is