Overview
Comment: | Pass ObjFWRTBase from the app to ObjFW .library |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | amiga-library |
Files: | files | file ages | folders |
SHA3-256: |
f56bb21f661e17d0cc206ca805cb5a1c |
User & Date: | js on 2022-12-16 20:27:14 |
Other Links: | branch diff | manifest | tags |
Context
2022-12-18
| ||
08:48 | amiga-library.xml: Fix register double use check-in: cee2c04176 user: js tags: amiga-library | |
2022-12-16
| ||
20:27 | Pass ObjFWRTBase from the app to ObjFW .library check-in: f56bb21f66 user: js tags: amiga-library | |
18:51 | Copy Amiga .library instead of symlinking it check-in: 2ce550435b user: js tags: amiga-library | |
Changes
Modified src/amiga-glue.h from [be6bd62ab2] to [effea05928].
︙ | ︙ | |||
41 42 43 44 45 46 47 | register type reg##name __asm__(#reg); \ type name = reg##name; #else # define PPC_PARAMS(...) (__VA_ARGS__) # define M68K_ARG(...) #endif | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | register type reg##name __asm__(#reg); \ type name = reg##name; #else # define PPC_PARAMS(...) (__VA_ARGS__) # define M68K_ARG(...) #endif extern bool glue_OFInit PPC_PARAMS(unsigned int version, struct OFLibC *_Nonnull libc, struct Library *_Nonnull RTBase); extern void *_Nullable glue_OFAllocMemory PPC_PARAMS(size_t count, size_t size); extern void *_Nullable glue_OFAllocZeroedMemory PPC_PARAMS(size_t count, size_t size); extern void *_Nullable glue_OFResizeMemory PPC_PARAMS(void *_Nullable pointer, size_t count, size_t size); extern void glue_OFFreeMemory PPC_PARAMS(void *_Nullable pointer); extern void glue_OFHashInit PPC_PARAMS(unsigned long *_Nonnull hash); extern uint16_t glue_OFRandom16(void); extern uint32_t glue_OFRandom32(void); |
︙ | ︙ |
Modified src/amiga-glue.m from [edf7296f72] to [3e5ca453ed].
︙ | ︙ | |||
27 28 29 30 31 32 33 | "__restore_r13:\n" " lwz %r13, 44(%r12)\n" " blr\n" ); #endif bool __saveds | | > | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | "__restore_r13:\n" " lwz %r13, 44(%r12)\n" " blr\n" ); #endif bool __saveds glue_OFInit PPC_PARAMS(unsigned int version, struct OFLibC *_Nonnull libc, struct Library *_Nonnull RTBase) { M68K_ARG(unsigned int, version, d0) M68K_ARG(struct OFLibC *_Nonnull, libc, a0) M68K_ARG(struct Library *_Nonnull, RTBase, a0) return OFInit(version, libc, RTBase); } void *_Nullable __saveds glue_OFAllocMemory PPC_PARAMS(size_t count, size_t size) { M68K_ARG(size_t, count, d0) M68K_ARG(size_t, size, d1) |
︙ | ︙ |
Modified src/amiga-library.h from [85a01bf187] to [2f42cb2fe9].
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * file. */ #import "macros.h" #import "OFPBKDF2.h" #import "OFScrypt.h" #ifdef OF_MORPHOS # include <ppcinline/macros.h> # define OF_M68K_ARG(type, name, reg) type name = (type)REG_##reg; #else # define OF_M68K_ARG(type, name, reg) \ register type reg_##name __asm__(#reg); \ type name = reg_##name; | > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * file. */ #import "macros.h" #import "OFPBKDF2.h" #import "OFScrypt.h" #include <exec/libraries.h> #ifdef OF_MORPHOS # include <ppcinline/macros.h> # define OF_M68K_ARG(type, name, reg) type name = (type)REG_##reg; #else # define OF_M68K_ARG(type, name, reg) \ register type reg_##name __asm__(#reg); \ type name = reg_##name; |
︙ | ︙ | |||
105 106 107 108 109 110 111 | void *_Null_unspecified), void *_Null_unspecified); #ifdef OF_MORPHOS int (*_Nonnull setjmp)(jmp_buf); void __dead2 (*_Nonnull longjmp)(jmp_buf, int); #endif }; | | > | 107 108 109 110 111 112 113 114 115 116 117 118 | void *_Null_unspecified), void *_Null_unspecified); #ifdef OF_MORPHOS int (*_Nonnull setjmp)(jmp_buf); void __dead2 (*_Nonnull longjmp)(jmp_buf, int); #endif }; extern bool OFInit(unsigned int version, struct OFLibC *_Nonnull libC, struct Library *_Nonnull RTBase); extern unsigned long *OFHashSeedRef(void); extern void OFPBKDF2Wrapper(const OFPBKDF2Parameters *_Nonnull parameters); extern void OFScryptWrapper(const OFScryptParameters *_Nonnull parameters); |
Modified src/amiga-library.m from [530b254cbd] to [ec8f0c881c].
︙ | ︙ | |||
77 78 79 80 81 82 83 84 85 86 87 88 89 90 | #endif #ifdef OF_MORPHOS const ULONG __abox__ = 1; #endif struct ExecBase *SysBase; struct OFLibC libC; #if defined(OF_AMIGAOS_M68K) __asm__ ( ".text\n" ".globl ___restore_a4\n" ".align 1\n" "___restore_a4:\n" | > | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | #endif #ifdef OF_MORPHOS const ULONG __abox__ = 1; #endif struct ExecBase *SysBase; struct OFLibC libC; struct Library *ObjFWRTBase; #if defined(OF_AMIGAOS_M68K) __asm__ ( ".text\n" ".globl ___restore_a4\n" ".align 1\n" "___restore_a4:\n" |
︙ | ︙ | |||
323 324 325 326 327 328 329 330 331 | } static void * libNull(void) { return NULL; } bool | > > > > > > > > > > > > > > > | | | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | } static void * libNull(void) { return NULL; } static void __saveds OFInitPart2(uintptr_t *iter0, struct Library *RTBase) { uintptr_t *iter; ObjFWRTBase = RTBase; for (iter = iter0; *iter != 0; iter++); while (iter > iter0) { void (*ctor)(void) = (void (*)(void))*--iter; ctor(); } } bool OFInit(unsigned int version, struct OFLibC *libC_, struct Library *RTBase) { #ifdef OF_AMIGAOS_M68K OF_M68K_ARG(struct ObjFWBase *, base, a6) #else register struct ObjFWBase *r12 __asm__("r12"); struct ObjFWBase *base = r12; #endif #ifdef OF_MORPHOS void *frame; #endif uintptr_t *iter0; if (version > 1) return false; if (base->initialized) return true; |
︙ | ︙ | |||
364 365 366 367 368 369 370 | "la %1, __CTOR_LIST__@l(%1)\n\t" : "=r"(frame), "=r"(iter0) ); libC.__register_frame(frame); #endif | < | < < < < | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | "la %1, __CTOR_LIST__@l(%1)\n\t" : "=r"(frame), "=r"(iter0) ); libC.__register_frame(frame); #endif OFInitPart2(iter0, RTBase); base->initialized = true; return true; } void * |
︙ | ︙ |
Modified src/amiga-library.xml from [31286c8139] to [25a1fc30c8].
1 2 3 4 5 6 7 8 9 10 11 12 13 | <amiga-library version='1.0' base='ObjFWBase'> <include>amiga-library.h</include> <!-- The following function is only for the linklib. --> <function name='OFInit' return-type='bool'> <argument name='version' type='unsigned int' m68k-reg='d0'/> <argument name='libc' type='struct OFLibC *_Nonnull' m68k-reg='a0'/> </function> <include>OFObject.h</include> <function name='OFAllocMemory' return-type='void *_Nullable'> <argument name='count' type='size_t' m68k-reg='d0'/> <argument name='size' type='size_t' m68k-reg='d1'/> </function> <function name='OFAllocZeroedMemory' return-type='void *_Nullable'> | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <amiga-library version='1.0' base='ObjFWBase'> <include>amiga-library.h</include> <!-- The following function is only for the linklib. --> <function name='OFInit' return-type='bool'> <argument name='version' type='unsigned int' m68k-reg='d0'/> <argument name='libc' type='struct OFLibC *_Nonnull' m68k-reg='a0'/> <argument name='RTBase' type='struct Library *_Nonnull' m68k-reg='a0'/> </function> <include>OFObject.h</include> <function name='OFAllocMemory' return-type='void *_Nullable'> <argument name='count' type='size_t' m68k-reg='d0'/> <argument name='size' type='size_t' m68k-reg='d1'/> </function> <function name='OFAllocZeroedMemory' return-type='void *_Nullable'> |
︙ | ︙ |
Modified src/linklib/Makefile from [e3799cef78] to [33cfe89605].
1 2 3 4 5 6 7 8 9 10 11 12 | include ../../extra.mk STATIC_LIB = libobjfw.library.a STATIC_AMIGA_LIB = libobjfw.library.amigalib.a SRCS = init.m \ linklib.m include ../../buildsys.mk CPPFLAGS += -I.. -I../.. -I../exceptions -I../runtime \ -DOBJFW_AMIGA_LIB=\"${OBJFW_AMIGA_LIB}\" \ -DOBJFW_LIB_MINOR=${OBJFW_LIB_MINOR} | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 | include ../../extra.mk STATIC_LIB = libobjfw.library.a STATIC_AMIGA_LIB = libobjfw.library.amigalib.a SRCS = init.m \ linklib.m include ../../buildsys.mk CPPFLAGS += -I.. -I../.. -I../exceptions -I../runtime \ -DOBJFW_AMIGA_LIB=\"${OBJFW_AMIGA_LIB}\" \ -DOBJFW_LIB_MINOR=${OBJFW_LIB_MINOR} AMIGA_LIB_CFLAGS += -DOF_AMIGA_LIB |
Modified src/linklib/init.m from [5a87af71c9] to [59e1e80ea6].
︙ | ︙ | |||
30 31 32 33 34 35 36 | #import "macros.h" #import "amiga-library.h" #define USE_INLINE_STDARG #include <proto/exec.h> #include <proto/intuition.h> | < < > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #import "macros.h" #import "amiga-library.h" #define USE_INLINE_STDARG #include <proto/exec.h> #include <proto/intuition.h> #if defined(OF_AMIGAOS_M68K) # include <stabs.h> #elif defined(OF_MORPHOS) # include <constructor.h> #endif extern struct Library *ObjFWRTBase; #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 *); |
︙ | ︙ | |||
271 272 273 274 275 276 277 278 279 280 281 282 283 284 | 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 void error(const char *string, ULONG arg) { struct Library *IntuitionBase = OpenLibrary("intuition.library", 0); if (IntuitionBase != NULL) { struct EasyStruct easy = { | > > > | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | 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; #ifndef OF_AMIGA_LIB struct Library *ObjFWBase; static void error(const char *string, ULONG arg) { struct Library *IntuitionBase = OpenLibrary("intuition.library", 0); if (IntuitionBase != NULL) { struct EasyStruct easy = { |
︙ | ︙ | |||
366 367 368 369 370 371 372 | if (initialized) return; if ((ObjFWBase = OpenLibrary(OBJFW_AMIGA_LIB, OBJFW_LIB_MINOR)) == NULL) error("Failed to open " OBJFW_AMIGA_LIB " version %lu!", OBJFW_LIB_MINOR); | | | | > | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | if (initialized) return; if ((ObjFWBase = OpenLibrary(OBJFW_AMIGA_LIB, OBJFW_LIB_MINOR)) == NULL) error("Failed to open " OBJFW_AMIGA_LIB " version %lu!", OBJFW_LIB_MINOR); if (!OFInit(1, &libC, ObjFWRTBase)) error("Failed to initialize " OBJFW_AMIGA_LIB "!", 0); 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, 5000) { ctor(); return 0; } DESTRUCTOR_P(ObjFW, 5000) { dtor(); } # endif #endif extern void OFPBKDF2Wrapper(const OFPBKDF2Parameters *parameters); extern void OFScryptWrapper(const OFScryptParameters *parameters); void OFLog(OFConstantString *format, ...) |
︙ | ︙ |
Modified src/linklib/linklib.m from [0835c2a6e1] to [862b2e6a2f].
︙ | ︙ | |||
40 41 42 43 44 45 46 | extern struct Library *ObjFWBase; #if OF_GCC_VERSION >= 1100 # pragma GCC diagnostic ignored "-Warray-parameter" #endif bool | | | | | 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 | extern struct Library *ObjFWBase; #if OF_GCC_VERSION >= 1100 # pragma GCC diagnostic ignored "-Warray-parameter" #endif bool OFInit(unsigned int version, struct OFLibC *_Nonnull libc, struct Library *_Nonnull RTBase) { #if defined(OF_AMIGAOS_M68K) register struct Library *a6 __asm__("a6") = ObjFWBase; (void)a6; return ((bool (*)(unsigned int __asm__("d0"), struct OFLibC *_Nonnull __asm__("a0"), struct Library *_Nonnull __asm__("a0")))(((uintptr_t)ObjFWBase) - 30))(version, libc, RTBase); #elif defined(OF_MORPHOS) __asm__ __volatile__ ( "mr %%r12, %0" :: "r"(ObjFWBase) : "r12" ); return __extension__ ((bool (*)(unsigned int, struct OFLibC *_Nonnull, struct Library *_Nonnull))*(void **)(((uintptr_t)ObjFWBase) - 28))(version, libc, RTBase); #endif } void *_Nullable OFAllocMemory(size_t count, size_t size) { #if defined(OF_AMIGAOS_M68K) |
︙ | ︙ |
Modified src/runtime/linklib/Makefile from [f3f7c9cd54] to [8d60ec1024].
1 2 3 4 5 6 7 8 9 10 11 12 13 | include ../../../extra.mk STATIC_LIB = libobjfwrt.library.a STATIC_AMIGA_LIB = libobjfwrt.library.amigalib.a SRCS = init.m \ 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} | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | include ../../../extra.mk STATIC_LIB = libobjfwrt.library.a STATIC_AMIGA_LIB = libobjfwrt.library.amigalib.a SRCS = init.m \ 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} AMIGA_LIB_CFLAGS += -DOBJC_AMIGA_LIB |
Modified src/runtime/linklib/init.m from [1251208ab8] to [aee4e3c855].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #import "private.h" #import "amiga-library.h" #define USE_INLINE_STDARG #include <proto/exec.h> #include <proto/intuition.h> | < < | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #import "private.h" #import "amiga-library.h" #define USE_INLINE_STDARG #include <proto/exec.h> #include <proto/intuition.h> #include <stdio.h> #include <stdlib.h> #if defined(OF_AMIGAOS_M68K) # include <stabs.h> #elif defined(OF_MORPHOS) # include <constructor.h> |
︙ | ︙ | |||
58 59 60 61 62 63 64 | extern void *__deregister_frame_info(const void *); #endif #ifdef OF_MORPHOS extern void __register_frame(void *); extern void __deregister_frame(void *); #endif | < > > > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | extern void *__deregister_frame_info(const void *); #endif #ifdef OF_MORPHOS extern void __register_frame(void *); extern void __deregister_frame(void *); #endif void *__objc_class_name_Protocol; #ifndef OBJC_AMIGA_LIB extern bool objc_init(unsigned int version, struct objc_libC *libC); struct Library *ObjFWRTBase; static void error(const char *string, ULONG arg) { struct Library *IntuitionBase = OpenLibrary("intuition.library", 0); if (IntuitionBase != NULL) { |
︙ | ︙ | |||
149 150 151 152 153 154 155 | static void __attribute__((__used__)) dtor(void) { CloseLibrary(ObjFWRTBase); } | | | > | 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 | static void __attribute__((__used__)) dtor(void) { CloseLibrary(ObjFWRTBase); } # if defined(OF_AMIGAOS_M68K) ADD2INIT(ctor, -5) ADD2EXIT(dtor, -5) # elif defined(OF_MORPHOS) CONSTRUCTOR_P(ObjFWRT, 4000) { ctor(); return 0; } DESTRUCTOR_P(ObjFWRT, 0) { dtor(); } # endif #endif extern int __gnu_objc_personality(int version, int actions, uint64_t *exClass, void *ex, void *ctx); int #ifdef HAVE_SJLJ_EXCEPTIONS |
︙ | ︙ |