ObjFW  Check-in [1712033509]

Overview
Comment:Pass errno to Amiga library
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | amiga-library
Files: files | file ages | folders
SHA3-256: 1712033509734ec1e512e0fcafb039fafbf2c89d65399dd2f6d78d3e4cfe3fb4
User & Date: js on 2020-12-12 21:25:07
Other Links: branch diff | manifest | tags
Context
2020-12-12
21:35
Register frames of Amiga lib on MorphOS check-in: bc91edf1b8 user: js tags: amiga-library
21:25
Pass errno to Amiga library check-in: 1712033509 user: js tags: amiga-library
21:08
Merge trunk into branch "amiga-library" check-in: 637ca0be9f user: js tags: amiga-library
Changes

Modified extra.mk.in from [0772774b93] to [9c4ced3311].

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
20
21
22
23
24
25
26



27
28
29
30
31
32
33







-
-
-








BIN_PREFIX = @BIN_PREFIX@
BRIDGE = @BRIDGE@
CVINCLUDE_INLINE_H = @CVINCLUDE_INLINE_H@
ENCODINGS = @ENCODINGS@
ENCODINGS_A = @ENCODINGS_A@
ENCODINGS_AMIGALIB_A = @ENCODINGS_AMIGALIB_A@
ENCODINGS_ENCODINGS_A = @ENCODINGS_ENCODINGS_A@
ENCODINGS_ENCODINGS_AMIGALIB_A = @ENCODINGS_ENCODINGS_AMIGALIB_A@
ENCODINGS_ENCODINGS_LIB_A = @ENCODINGS_ENCODINGS_LIB_A@
ENCODINGS_LIB_A = @ENCODINGS_LIB_A@
ENCODINGS_SRCS = @ENCODINGS_SRCS@
EXCEPTIONS_A = @EXCEPTIONS_A@
EXCEPTIONS_AMIGALIB_A = @EXCEPTIONS_AMIGALIB_A@
EXCEPTIONS_LIB_A = @EXCEPTIONS_LIB_A@
FISH_COMPLETIONS = @FISH_COMPLETIONS@
FORWARDING_A = @FORWARDING_A@

Modified src/amiga-library.h from [c45ea8943a] to [d1ef677ea6].

63
64
65
66
67
68
69

70
71
72
73
74
75
76
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77







+







#endif
#ifdef OF_AMIGAOS_M68K
	void (*_Nonnull __register_frame_info)(const void *_Nonnull,
	    void *_Nonnull);
	void *_Nullable (*_Nonnull __deregister_frame_info)(
	    const void *_Nonnull);
#endif
	int *_Nonnull (*_Nonnull get_errno)(void);

	/* Needed only by ObjFW. */
	int (*_Nonnull vsnprintf)(char *_Nonnull restrict, size_t,
	    const char *_Nonnull restrict, va_list);
#ifdef OF_AMIGAOS_M68K
	/* strtod() uses sscanf() internally */
	int (*_Nonnull vsscanf)(const char *_Nonnull restrict,

Modified src/amiga-library.m from [e46fd1fbb1] to [34398bab6e].

571
572
573
574
575
576
577






578
579
580
581
582
583
584
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590







+
+
+
+
+
+








void
*__deregister_frame_info(const void *begin)
{
	return libc.__deregister_frame_info(begin);
}
#endif

int *
of_get_errno(void)
{
	return libc.get_errno();
}

int
vsnprintf(char *restrict str, size_t size, const char *restrict fmt,
    va_list args)
{
	return libc.vsnprintf(str, size, fmt, args);
}

Modified src/linklib/linklib.m from [4e6a5f801d] to [3c9770138e].

23
24
25
26
27
28
29

30
31
32
33
34
35
36
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37







+








#include <proto/exec.h>

struct ObjFWBase;

#import "inline.h"

#include <errno.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>

#if defined(OF_AMIGAOS_M68K)
# include <stabs.h>
# define SYM(name) __asm__("_" name)
268
269
270
271
272
273
274






275
276
277
278
279
280
281
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288







+
+
+
+
+
+







void *__objc_class_name_OFBitSetCharacterSet;
void *__objc_class_name_OFMapTableSet;
void *__objc_class_name_OFMutableMapTableSet;
void *__objc_class_name_OFMutableUTF8String;
void *__objc_class_name_OFRangeCharacterSet;
void *__objc_class_name_OFSelectKernelEventObserver;
void *__objc_class_name_OFUTF8String;

static int *
get_errno(void)
{
	return &errno;
}

static void __attribute__((__used__))
ctor(void)
{
	static bool initialized = false;
	struct of_libc libc = {
		.malloc = malloc,
305
306
307
308
309
310
311

312
313
314
315
316
317
318
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326







+







#else
		._Unwind_Resume = _Unwind_Resume,
#endif
#ifdef OF_AMIGAOS_M68K
		.__register_frame_info = __register_frame_info,
		.__deregister_frame_info = __deregister_frame_info,
#endif
		.get_errno = get_errno,
		.vsnprintf = vsnprintf,
#ifdef OF_AMIGAOS_M68K
		.vsscanf = vsscanf,
#endif
		.exit = exit,
		.signal = signal,
		.setlocale = setlocale,

Modified src/macros.h from [7383bf6570] to [9f0be8e20b].

316
317
318
319
320
321
322






323
324
325
326
327
328
329
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335







+
+
+
+
+
+







# define OF_DIRECT
#endif
#if __has_attribute(__objc_direct_members__) && defined(OF_APPLE_RUNTIME)
# define OF_DIRECT_MEMBERS __attribute__((__objc_direct_members__))
#else
# define OF_DIRECT_MEMBERS
#endif

#ifdef OF_COMPILING_AMIGA_LIBRARY
# undef errno
extern int *_Nonnull of_get_errno(void);
# define errno (*of_get_errno())
#endif

#ifdef __GNUC__
# ifdef OF_X86_64
#  define OF_X86_64_ASM
# endif
# ifdef OF_X86
#  define OF_X86_ASM