ObjFW  Check-in [8963dd5a1e]

Overview
Comment:Add linklib

No methods in the linklib yet.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | amiga-library
Files: files | file ages | folders
SHA3-256: 8963dd5a1e87d1d93052abedbbb8beccce0bff5a3d54dbc3bba7a9e25e7be4a0
User & Date: js on 2020-06-20 16:28:31
Other Links: branch diff | manifest | tags
Context
2020-06-20
16:38
OFStdIOStream: Add of_logv() check-in: 343501981b user: js tags: amiga-library
16:28
Add linklib check-in: 8963dd5a1e user: js tags: amiga-library
13:39
Add SFD file for AmigaOS 3 and generate inline.h check-in: ff3d26c61e user: js tags: amiga-library
Changes

Modified src/Makefile from [e116e87692] to [8464e86113].

1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
include ../extra.mk

SUBDIRS = ${RUNTIME} exceptions ${ENCODINGS} forwarding invocation
SUBDIRS_AFTER = ${BRIDGE}
CLEAN = amiga-end.amigalib.dep		\
	amiga-end.amigalib.o		\
	amiga-glue.amigalib.dep		\
	amiga-glue.amigalib.o		\
	amiga-library-functable.inc	\
	amiga-library.amigalib.dep	\
	amiga-library.amigalib.o

DISTCLEAN = Info.plist objfw-defs.h

SHARED_LIB = ${OBJFW_SHARED_LIB}
STATIC_LIB = ${OBJFW_STATIC_LIB}
FRAMEWORK = ${OBJFW_FRAMEWORK}
AMIGA_LIB = ${OBJFW_AMIGA_LIB}
LIB_MAJOR = ${OBJFW_LIB_MAJOR}



|






|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
include ../extra.mk

SUBDIRS = ${RUNTIME} exceptions ${ENCODINGS} forwarding invocation
SUBDIRS_AFTER = ${LINKLIB} ${BRIDGE}
CLEAN = amiga-end.amigalib.dep		\
	amiga-end.amigalib.o		\
	amiga-glue.amigalib.dep		\
	amiga-glue.amigalib.o		\
	amiga-library-functable.inc	\
	amiga-library.amigalib.dep	\
	amiga-library.amigalib.o	\
	inline.h
DISTCLEAN = Info.plist objfw-defs.h

SHARED_LIB = ${OBJFW_SHARED_LIB}
STATIC_LIB = ${OBJFW_STATIC_LIB}
FRAMEWORK = ${OBJFW_FRAMEWORK}
AMIGA_LIB = ${OBJFW_AMIGA_LIB}
LIB_MAJOR = ${OBJFW_LIB_MAJOR}

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

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
	void (*_Nonnull __register_frame_info)(const void *_Nonnull,
	    void *_Nonnull);
	void *_Nullable (*_Nonnull __deregister_frame_info)(
	    const void *_Nonnull);
#endif

	/* Needed only by ObjFW. */
	int (*_Nonnull vsnprintf)(const 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,
	    const char *_Nonnull restrict, va_list);
#endif
	void (*_Nonnull exit)(int);







|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
	void (*_Nonnull __register_frame_info)(const void *_Nonnull,
	    void *_Nonnull);
	void *_Nullable (*_Nonnull __deregister_frame_info)(
	    const void *_Nonnull);
#endif

	/* 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,
	    const char *_Nonnull restrict, va_list);
#endif
	void (*_Nonnull exit)(int);

Modified src/amigaos3.sfd from [1e3feef1e0] to [ba007648e9].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
==base _ObjFWBase
==basetype struct Library *
==libname objfw68k.library
==bias 30
==public
* The following function is only for the linklib.
bool glue_of_init(unsigned int version, struct of_libc *_Nonnull libc, FILE *_Nonnull *_Nonnull sF)(d0,a0,a1)
int glue_of_application_main(int *_Nonnull argc, char *_Nullable *_Nonnull *_Nonnull argv, id <OFApplicationDelegate> delegate)(a0,a1,a2)
const char *_Nullable glue_of_http_request_method_to_string(of_http_request_method_t method)(d0)
of_http_request_method_t glue_of_http_request_method_from_string(OFString *string)(a0)
OFString *_Nonnull glue_of_http_status_code_to_string(short code)(d0)
size_t glue_of_sizeof_type_encoding(const char *type)(a0)
size_t glue_of_alignof_type_encoding(const char *type)(a0)
void glue_of_log(OFConstantString *format, ...)(a0,printfcall)
OFString *glue_of_zip_archive_entry_version_to_string(uint16_t version)(d0)
OFString *glue_of_zip_archive_entry_compression_method_to_string(uint16_t compressionMethod)(d0)
size_t glue_of_zip_archive_entry_extra_field_find(OFData *extraField, uint16_t tag, uint16_t *size)(a0,d0,a1)
void glue_of_pbkdf2(OFHMAC *HMAC, size_t iterations, const unsigned char *salt, size_t saltLength, const char *password, size_t passwordLength, unsigned char *key, size_t keyLength, bool allowsSwappableMemory)(a0,d0,a1,d1,a2,d2,a3,d3,d4)
void glue_of_scrypt(size_t blockSize, size_t costFactor, size_t parallelization, const unsigned char *salt, size_t saltLength, const char *password, size_t passwordLength, unsigned char *key, size_t keyLength, bool allowsSwappableMemory)(d0,d1,d2,a0,d3,a1,d4,a2,d5,d6)
of_socket_address_t glue_of_socket_address_parse_ip(OFString *IP, uint16_t port)(a0,d0)
of_socket_address_t glue_of_socket_address_parse_ipv4(OFString *IP, uint16_t port)(a0,d0)
of_socket_address_t glue_of_socket_address_parse_ipv6(OFString *IP, uint16_t port)(a0,d0)
of_socket_address_t glue_of_socket_address_ipx(const unsigned char *_Nonnull node, uint32_t network, uint16_t port)(a0,d0,d1)













|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
==base _ObjFWBase
==basetype struct Library *
==libname objfw68k.library
==bias 30
==public
* The following function is only for the linklib.
bool glue_of_init(unsigned int version, struct of_libc *_Nonnull libc, FILE *_Nonnull *_Nonnull sF)(d0,a0,a1)
int glue_of_application_main(int *_Nonnull argc, char *_Nullable *_Nonnull *_Nonnull argv, id <OFApplicationDelegate> delegate)(a0,a1,a2)
const char *_Nullable glue_of_http_request_method_to_string(of_http_request_method_t method)(d0)
of_http_request_method_t glue_of_http_request_method_from_string(OFString *string)(a0)
OFString *_Nonnull glue_of_http_status_code_to_string(short code)(d0)
size_t glue_of_sizeof_type_encoding(const char *type)(a0)
size_t glue_of_alignof_type_encoding(const char *type)(a0)
void glue_of_logv(OFConstantString *format, va_list args)(a0,a1)
OFString *_Nonnull glue_of_zip_archive_entry_version_to_string(uint16_t version)(d0)
OFString *_Nonnull glue_of_zip_archive_entry_compression_method_to_string(uint16_t compressionMethod)(d0)
size_t glue_of_zip_archive_entry_extra_field_find(OFData *extraField, uint16_t tag, uint16_t *size)(a0,d0,a1)
void glue_of_pbkdf2(OFHMAC *HMAC, size_t iterations, const unsigned char *salt, size_t saltLength, const char *password, size_t passwordLength, unsigned char *key, size_t keyLength, bool allowsSwappableMemory)(a0,d0,a1,d1,a2,d2,a3,d3,d4)
void glue_of_scrypt(size_t blockSize, size_t costFactor, size_t parallelization, const unsigned char *salt, size_t saltLength, const char *password, size_t passwordLength, unsigned char *key, size_t keyLength, bool allowsSwappableMemory)(d0,d1,d2,a0,d3,a1,d4,a2,d5,d6)
of_socket_address_t glue_of_socket_address_parse_ip(OFString *IP, uint16_t port)(a0,d0)
of_socket_address_t glue_of_socket_address_parse_ipv4(OFString *IP, uint16_t port)(a0,d0)
of_socket_address_t glue_of_socket_address_parse_ipv6(OFString *IP, uint16_t port)(a0,d0)
of_socket_address_t glue_of_socket_address_ipx(const unsigned char *_Nonnull node, uint32_t network, uint16_t port)(a0,d0,d1)

Added src/linklib/Makefile version [f5bccff146].





















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

STATIC_LIB = libobjfw.library.a
SRCS = linklib.m

include ../../buildsys.mk

CPPFLAGS += -I.. -I../.. -I../exceptions -I../runtime	\
	    -DOBJFW_AMIGA_LIB=\"${OBJFW_AMIGA_LIB}\"	\
	    -DOBJFW_LIB_MINOR=${OBJFW_LIB_MINOR}

Added src/linklib/linklib.m version [c9930b8ec0].









































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
 *               2018, 2019, 2020
 *   Jonathan Schleifer <js@nil.im>
 *
 * 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.h"
#import "amiga-library.h"
#import "macros.h"

#include <proto/exec.h>

struct ObjFWBase;

#import "inline.h"

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

#if defined(OF_AMIGAOS_M68K)
# include <stabs.h>
# define SYM(name) __asm__("_" name)
#elif defined(OF_MORPHOS)
# include <constructor.h>
# define SYM(name) __asm__(name)
#endif

#ifdef HAVE_SJLJ_EXCEPTIONS
extern int _Unwind_SjLj_RaiseException(void *);
#else
extern int _Unwind_RaiseException(void *);
#endif
extern void _Unwind_DeleteException(void *);
extern void *_Unwind_GetLanguageSpecificData(void *);
extern uintptr_t _Unwind_GetRegionStart(void *);
extern uintptr_t _Unwind_GetDataRelBase(void *);
extern uintptr_t _Unwind_GetTextRelBase(void *);
extern uintptr_t _Unwind_GetIP(void *);
extern uintptr_t _Unwind_GetGR(void *, int);
extern void _Unwind_SetIP(void *, uintptr_t);
extern void _Unwind_SetGR(void *, int, uintptr_t);
#ifdef HAVE_SJLJ_EXCEPTIONS
extern void _Unwind_SjLj_Resume(void *);
#else
extern void _Unwind_Resume(void *);
#endif
#ifdef OF_AMIGAOS_M68K
extern void __register_frame_info(const void *, void *);
extern void *__deregister_frame_info(const void *);
#endif
extern int _Unwind_Backtrace(int (*)(void *, void *), void *);

struct Library *ObjFWBase;

static void __attribute__((__used__))
ctor(void)
{
	static bool initialized = false;
	struct of_libc libc = {
		.malloc = malloc,
		.calloc = calloc,
		.realloc = realloc,
		.free = free,
		.vfprintf = vfprintf,
		.fflush = fflush,
		.abort = abort,
#ifdef HAVE_SJLJ_EXCEPTIONS
		._Unwind_SjLj_RaiseException = _Unwind_SjLj_RaiseException,
#else
		._Unwind_RaiseException = _Unwind_RaiseException,
#endif
		._Unwind_DeleteException = _Unwind_DeleteException,
		._Unwind_GetLanguageSpecificData =
		    _Unwind_GetLanguageSpecificData,
		._Unwind_GetRegionStart = _Unwind_GetRegionStart,
		._Unwind_GetDataRelBase = _Unwind_GetDataRelBase,
		._Unwind_GetTextRelBase = _Unwind_GetTextRelBase,
		._Unwind_GetIP = _Unwind_GetIP,
		._Unwind_GetGR = _Unwind_GetGR,
		._Unwind_SetIP = _Unwind_SetIP,
		._Unwind_SetGR = _Unwind_SetGR,
#ifdef HAVE_SJLJ_EXCEPTIONS
		._Unwind_SjLj_Resume = _Unwind_SjLj_Resume,
#else
		._Unwind_Resume = _Unwind_Resume,
#endif
#ifdef OF_AMIGAOS_M68K
		.__register_frame_info = __register_frame_info,
		.__deregister_frame_info = __deregister_frame_info,
#endif
		.vsnprintf = vsnprintf,
#ifdef OF_AMIGAOS_M68K
		.vsscanf = vsscanf,
#endif
		.exit = exit,
		.signal = signal,
		.setlocale = setlocale,
		._Unwind_Backtrace = _Unwind_Backtrace
	};

	if (initialized)
		return;

	if ((ObjFWBase = OpenLibrary(OBJFW_AMIGA_LIB,
	    OBJFW_LIB_MINOR)) == NULL) {
		/*
		 * The linklib can be used by other libraries as well, so we
		 * can't have the compiler optimize this to another function,
		 * hence the use of an unnecessary format specifier.
		 */
		fprintf(stderr, "Failed to open %s!\n", OBJFW_AMIGA_LIB);
		abort();
	}

	if (!glue_of_init(1, &libc, __sF)) {
		/*
		 * The linklib can be used by other libraries as well, so we
		 * can't have the compiler optimize this to another function,
		 * hence the use of an unnecessary format specifier.
		 */
		fprintf(stderr, "Failed to initialize %s!\n", OBJFW_AMIGA_LIB);
		abort();
	}

	initialized = true;
}

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

#if defined(OF_AMIGAOS_M68K)
ADD2INIT(ctor, -2);
ADD2EXIT(dtor, -2);
#elif defined(OF_MORPHOS)
CONSTRUCTOR_P(ObjFW, 4000)
{
	ctor();

	return 0;
}

DESTRUCTOR_P(ObjFW, 4000)
{
	dtor();
}
#endif

Modified src/runtime/linklib/Makefile from [ebb3ee352e] to [498c4a2c2e].

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

STATIC_LIB = libobjfwrt.library.a
SRCS = linklib.m

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

CPPFLAGS += -I.. -I../.. -I../../..				\
	    -DOBJC_COMPILING_AMIGA_LINKLIB			\
	    -DOBJFWRT_AMIGA_LIB=\"${OBJFWRT_AMIGA_LIB}\"	\
	    -DOBJFWRT_LIB_MINOR=${OBJFWRT_LIB_MINOR}
LD = ${OBJC}











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

include ../../../extra.mk

STATIC_LIB = libobjfwrt.library.a
SRCS = linklib.m

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

CPPFLAGS += -I.. -I../.. -I../../..				\
	    -DOBJC_COMPILING_AMIGA_LINKLIB			\
	    -DOBJFWRT_AMIGA_LIB=\"${OBJFWRT_AMIGA_LIB}\"	\
	    -DOBJFWRT_LIB_MINOR=${OBJFWRT_LIB_MINOR}