ObjFW  Check-in [c12ca9484e]

Overview
Comment:runtime/linklib: __attribute__((used)) for [cd]tor

Otherwise, amiga-gcc strips it when optimizations are enabled, resulting
in a linker error.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c12ca9484e7cdcec4393a9916d0a000edc735e172246c56107fd1679854bb141
User & Date: js on 2020-03-08 13:49:49
Other Links: manifest | tags
Context
2020-03-09
00:54
of_asprintf.m: Small optimization check-in: e0b659378f user: js tags: trunk
2020-03-08
13:49
runtime/linklib: __attribute__((used)) for [cd]tor check-in: c12ca9484e user: js tags: trunk
2020-03-07
18:11
.travis.yml: Add notifications check-in: e489612993 user: js tags: trunk
Changes

Modified src/runtime/linklib/linklib.m from [570378ad75] to [141357802d].

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#endif
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
ctor(void)
{
	static bool initialized = false;
	struct objc_libc libc = {
		.malloc = malloc,
		.calloc = calloc,
		.realloc = realloc,







|







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#endif
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 __attribute__((__used__))
ctor(void)
{
	static bool initialized = false;
	struct objc_libc libc = {
		.malloc = malloc,
		.calloc = calloc,
		.realloc = realloc,
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
		fputs("Failed to initialize " OBJFWRT_AMIGA_LIB "!\n", stderr);
		abort();
	}

	initialized = true;
}

static void __attribute__((__unused__))
dtor(void)
{
	CloseLibrary(ObjFWRTBase);
}

#if defined(OF_AMIGAOS_M68K)
ADD2INIT(ctor, -2);







|







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
		fputs("Failed to initialize " OBJFWRT_AMIGA_LIB "!\n", stderr);
		abort();
	}

	initialized = true;
}

static void __attribute__((__used__))
dtor(void)
{
	CloseLibrary(ObjFWRTBase);
}

#if defined(OF_AMIGAOS_M68K)
ADD2INIT(ctor, -2);