Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -9,11 +9,11 @@ AC_SUBST(BUNDLE_VERSION, 0.90.9900) AC_SUBST(BUNDLE_SHORT_VERSION, 0.90) for i in configure.ac build-aux/m4/*; do AS_IF([test $i -nt configure], [ - AC_MSG_ERROR([$i is newer than configure! Run autoreconf!]) + AC_MSG_ERROR([$i is newer than configure! Run ./autogen.sh!]) ]) done BUILDSYS_INIT @@ -56,11 +56,14 @@ enable_files="yes" # Required for reading ENV: supports_amiga_lib="yes" ac_cv_snprintf_useful_ret="yes" AS_IF([test x"$enable_amiga_lib" != x"no"], [ + AC_SUBST(OBJFW_RT_AMIGA_LIB, + 'objfw_rt_${OBJFW_RT_LIB_MAJOR}_68k.library') AC_SUBST(SFDC_TARGET, m68k-amigaos) + AC_SUBST(SFD_FILE, amigaos3.sfd) dnl For 68000, GCC emits calls to helper functions that dnl do not work properly in a library. AC_SUBST(AMIGA_LIB_CFLAGS, "-mcpu=68020 -fbaserel") AC_SUBST(AMIGA_LIB_LDFLAGS, "-mcpu=68020 -fbaserel -resident -nostartfiles") @@ -80,16 +83,19 @@ LDFLAGS="$LDFLAGS -noixemul" enable_files="yes" # Required for reading ENV: supports_amiga_lib="yes" AS_IF([test x"$enable_amiga_lib" != x"no"], [ + t='objfw_rt_${OBJFW_RT_LIB_MAJOR}_abox.library' + AC_SUBST(OBJFW_RT_AMIGA_LIB, $t) AC_SUBST(SFDC_TARGET, ppc-morphos) - tmp="-mresident32 -fno-builtin" - AC_SUBST(AMIGA_LIB_CFLAGS, $tmp) - tmp="-mresident32 -nostartfiles -nodefaultlibs" - tmp="$tmp -lc" - AC_SUBST(AMIGA_LIB_LDFLAGS, $tmp) + AC_SUBST(SFD_FILE, morphos.sfd) + t="-mresident32 -fno-builtin" + AC_SUBST(AMIGA_LIB_CFLAGS, $t) + t="-mresident32 -nostartfiles -nodefaultlibs" + t="$tmp -lc" + AC_SUBST(AMIGA_LIB_LDFLAGS, $t) ]) ]) enable_shared="no" enable_threads="no" @@ -510,11 +516,10 @@ AC_SUBST(OBJFW_RT_FRAMEWORK, "ObjFW_RT.framework") AC_SUBST(RUNTIME_FRAMEWORK_LIBS, "-framework ObjFW_RT") ]) AS_IF([test x"$enable_amiga_lib" != x"no"], [ - AC_SUBST(OBJFW_RT_AMIGA_LIB, objfw_rt.library) AC_SUBST(RUNTIME_LIBS, "-lobjfw_rt.library") AC_SUBST(LINKLIB, linklib) tmp="../src/runtime/linklib/libobjfw_rt.library.a" AC_SUBST(LIBOBJFW_RT_DEP, "$tmp") AC_SUBST(LIBOBJFW_RT_DEP_LVL2, "../$tmp") Index: extra.mk.in ================================================================== --- extra.mk.in +++ extra.mk.in @@ -68,10 +68,11 @@ RUNTIME = @RUNTIME@ RUNTIME_FRAMEWORK_LIBS = @RUNTIME_FRAMEWORK_LIBS@ RUNTIME_LIBS = @RUNTIME_LIBS@ RUN_TESTS = @RUN_TESTS@ SFDC_TARGET = @SFDC_TARGET@ +SFD_FILE = @SFD_FILE@ TESTPLUGIN = @TESTPLUGIN@ TESTPLUGIN_LIBS = @TESTPLUGIN_LIBS@ TESTS_LIBS = @TESTS_LIBS@ TESTS_STATIC_LIB = @TESTS_STATIC_LIB@ UNICODE_M = @UNICODE_M@ Index: generators/Makefile ================================================================== --- generators/Makefile +++ generators/Makefile @@ -9,11 +9,11 @@ rm -f libobjfw.so.${OBJFW_LIB_MAJOR_MINOR} rm -f libobjfw.dll libobjfw.${OBJFW_LIB_MAJOR}.dylib rm -f libobjfw_rt.so.${OBJFW_RT_LIB_MAJOR} rm -f libobjfw_rt.so.${OBJFW_RT_LIB_MAJOR_MINOR} rm -f libobjfw_rt.dll libobjfw_rt.${OBJFW_RT_LIB_MAJOR}.dylib - rm -f objfw_rt.library + rm -f ${OBJFW_RT_AMIGA_LIB} if test -f ../src/libobjfw.so; then \ ${LN_S} ../src/libobjfw.so libobjfw.so.${OBJFW_LIB_MAJOR}; \ ${LN_S} ../src/libobjfw.so \ libobjfw.so.${OBJFW_LIB_MAJOR_MINOR}; \ elif test -f ../src/libobjfw.so.${OBJFW_LIB_MAJOR_MINOR}; then \ @@ -40,12 +40,13 @@ fi if test -f ../src/runtime/libobjfw_rt.dylib; then \ ${LN_S} ../src/runtime/libobjfw_rt.dylib \ libobjfw_rt.${OBJFW_RT_LIB_MAJOR}.dylib; \ fi - if test -f ../src/runtime/objfw_rt.library; then \ - ${LN_S} ../src/runtime/objfw_rt.library objfw_rt.library; \ + if test -f ../src/runtime/${OBJFW_RT_AMIGA_LIB}; then \ + ${LN_S} ../src/runtime/${OBJFW_RT_AMIGA_LIB} \ + ${OBJFW_RT_AMIGA_LIB}; \ fi LD_LIBRARY_PATH=.$${LD_LIBRARY_PATH+:}$$LD_LIBRARY_PATH \ DYLD_FRAMEWORK_PATH=../src:../src/runtime$${DYLD_FRAMEWORK_PATH+:}$$DYLD_FRAMEWORK_PATH \ DYLD_LIBRARY_PATH=.$${DYLD_LIBRARY_PATH+:}$$DYLD_LIBRARY_PATH \ LIBRARY_PATH=.$${LIBRARY_PATH+:}$$LIBRARY_PATH \ Index: src/runtime/Makefile ================================================================== --- src/runtime/Makefile +++ src/runtime/Makefile @@ -43,17 +43,18 @@ ${OBJFW_RT_AMIGA_LIB}: inline.h amiga-library.m: amiga-library-functable.inc -amiga-library-functable.inc: ObjFW_RT.sfd +amiga-library-functable.inc: ${SFD_FILE} sfdc -q --target=${SFDC_TARGET} --mode=functable -o $@ $< -inline.h: ObjFW_RT.sfd +inline.h: ${SFD_FILE} sfdc -q --target=${SFDC_TARGET} --mode=macros -o $@ $< -CPPFLAGS += -I. -I.. -I../.. \ - -DOBJFW_RT_LIB_MAJOR=${OBJFW_RT_LIB_MAJOR} \ +CPPFLAGS += -I. -I.. -I../.. \ + -DOBJFW_RT_AMIGA_LIB=\"${OBJFW_RT_AMIGA_LIB}\" \ + -DOBJFW_RT_LIB_MAJOR=${OBJFW_RT_LIB_MAJOR} \ -DOBJFW_RT_LIB_MINOR=${OBJFW_RT_LIB_MINOR} AMIGA_LIB_CFLAGS += -DOBJC_COMPILING_AMIGA_LIBRARY LD = ${OBJC} FRAMEWORK_LIBS = ${LIBS} DELETED src/runtime/ObjFW_RT.sfd Index: src/runtime/ObjFW_RT.sfd ================================================================== --- src/runtime/ObjFW_RT.sfd +++ src/runtime/ObjFW_RT.sfd @@ -1,81 +0,0 @@ -==base _ObjFWRTBase -==basetype struct Library * -==libname objfw_rt.library -==bias 30 -==public -* Functions that are only for the linklib. -bool objc_init_m68k(unsigned int version, struct objc_libc *libc, FILE *stdout, FILE *stdin)(d0,a0,a1,a2) -* These have a built-in declaration in the compiler that does not use the -* registers and thus always need glue. -void __objc_exec_class_m68k(void *_Nonnull module)(a0) -IMP _Nonnull objc_msg_lookup_m68k(id _Nullable object, SEL _Nonnull selector)(a0,a1) -IMP _Nonnull objc_msg_lookup_stret_m68k(id _Nullable object, SEL _Nonnull selector)(a0,a1) -IMP _Nonnull objc_msg_lookup_super_m68k(struct objc_super *_Nonnull super, SEL _Nonnull selector)(a0,a1) -IMP _Nonnull objc_msg_lookup_super_stret_m68k(struct objc_super *_Nonnull super, SEL _Nonnull selector)(a0,a1) -Class _Nullable objc_lookUpClass_m68k(const char *_Nonnull name)(a0) -Class _Nullable objc_getClass_m68k(const char *_Nonnull name)(a0) -Class _Nonnull objc_getRequiredClass_m68k(const char *_Nonnull name)(a0) -Class _Nullable objc_lookup_class_m68k(const char *_Nonnull name)(a0) -Class _Nonnull objc_get_class_m68k(const char *_Nonnull name)(a0) -void objc_exception_throw_m68k(id _Nonnull object)(a0) -int objc_sync_enter_m68k(id _Nullable object)(a0) -int objc_sync_exit_m68k(id _Nullable object)(a0) -id objc_getProperty_m68k(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, bool atomic)(a0,a1,d0,d1) -void objc_setProperty_m68k(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, id value, bool atomic, signed char copy)(a0,a1,d0,a2,d1,d2) -void objc_getPropertyStruct_m68k(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong)(a0,a1,d0,d1,d2) -void objc_setPropertyStruct_m68k(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong)(a0,a1,d0,d1,d2) -void objc_enumerationMutation_m68k(id _Nonnull object)(a0) -int __gnu_objc_personality_v0_m68k(int version, int actions, uint64_t *_Nonnull exClass, void *_Nonnull ex, void *_Nonnull ctx)(d0,d1,d2,a0,a1) -int __gnu_objc_personality_sj0_m68k(int version, int actions, uint64_t *_Nonnull exClass, void *_Nonnull ex, void *_Nonnull ctx)(d0,d1,d2,a0,a1) -id _Nullable objc_retain_m68k(id _Nullable object)(a0) -id _Nullable objc_retainBlock_m68k(id _Nullable block)(a0) -id _Nullable objc_retainAutorelease_m68k(id _Nullable object)(a0) -void objc_release_m68k(id _Nullable object)(a0) -id _Nullable objc_autorelease_m68k(id _Nullable object)(a0) -id _Nullable objc_autoreleaseReturnValue_m68k(id _Nullable object)(a0) -id _Nullable objc_retainAutoreleaseReturnValue_m68k(id _Nullable object)(a0) -id _Nullable objc_retainAutoreleasedReturnValue_m68k(id _Nullable object)(a0) -id _Nullable objc_storeStrong_m68k(id _Nullable *_Nonnull object, id _Nullable value)(a0,a1) -id _Nullable objc_storeWeak_m68k(id _Nullable *_Nonnull object, id _Nullable value)(a0,a1) -id _Nullable objc_loadWeakRetained_m68k(id _Nullable *_Nonnull object)(a0) -id _Nullable objc_initWeak_m68k(id _Nullable *_Nonnull object, id _Nullable value)(a0,a1) -void objc_destroyWeak_m68k(id _Nullable *_Nonnull object)(a0) -id _Nullable objc_loadWeak_m68k(id _Nullable *_Nonnull object)(a0) -void objc_copyWeak_m68k(id _Nullable *_Nonnull dest, id _Nullable *_Nonnull src)(a0,a1) -void objc_moveWeak_m68k(id _Nullable *_Nonnull dest, id _Nullable *_Nonnull src)(a0,a1) -* These only need glue on MorphOS. As none of them are functions that are used -* in hot paths, it's easier to also use the glue on AmigaOS 3, which also has -* the benefit of having all __saveds in a single place. -SEL _Nonnull sel_registerName_m68k(const char *_Nonnull name)(a0) -const char *_Nonnull sel_getName_m68k(SEL _Nonnull selector)(a0) -bool sel_isEqual_m68k(SEL _Nonnull selector1, SEL _Nonnull selector2)(a0,a1) -Class _Nonnull objc_allocateClassPair_m68k(Class _Nullable superclass, const char *_Nonnull name, size_t extraBytes)(a0,a1,d0) -void objc_registerClassPair_m68k(Class _Nonnull class_)(a0) -unsigned int objc_getClassList_m68k(Class _Nonnull *_Nullable buffer, unsigned int count)(a0,d0) -Class _Nonnull *_Nonnull objc_copyClassList_m68k(unsigned int *_Nullable length)(a0) -bool class_isMetaClass_m68k(Class _Nullable class_)(a0) -const char *_Nullable class_getName_m68k(Class _Nullable class_)(a0) -Class _Nullable class_getSuperclass_m68k(Class _Nullable class_)(a0) -unsigned long class_getInstanceSize_m68k(Class _Nullable class_)(a0) -bool class_respondsToSelector_m68k(Class _Nullable class_, SEL _Nonnull selector)(a0,a1) -bool class_conformsToProtocol_m68k(Class _Nullable class_, Protocol *_Nonnull p)(a0,a1) -IMP _Nullable class_getMethodImplementation_m68k(Class _Nullable class_, SEL _Nonnull selector)(a0,a1) -IMP _Nullable class_getMethodImplementation_stret_m68k(Class _Nullable class_, SEL _Nonnull selector)(a0,a1) -const char *_Nullable class_getMethodTypeEncoding_m68k(Class _Nullable class_, SEL _Nonnull selector)(a0,a1) -bool class_addMethod_m68k(Class _Nonnull class_, SEL _Nonnull selector, IMP _Nonnull implementation, const char *_Nullable typeEncoding)(a0,a1,a2,a3) -IMP _Nullable class_replaceMethod_m68k(Class _Nonnull class_, SEL _Nonnull selector, IMP _Nonnull implementation, const char *_Nullable typeEncoding)(a0,a1,a2,a3) -Class _Nullable object_getClass_m68k(id _Nullable object)(a0) -Class _Nullable object_setClass_m68k(id _Nullable object, Class _Nonnull class_)(a0,a1) -const char *_Nullable object_getClassName_m68k(id _Nullable object)(a0) -const char *_Nonnull protocol_getName_m68k(Protocol *_Nonnull protocol)(a0) -bool protocol_isEqual_m68k(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2)(a0,a1) -bool protocol_conformsToProtocol_m68k(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2)(a0,a1) -void objc_exit_m68k(void)() -_Nullable objc_uncaught_exception_handler_t objc_setUncaughtExceptionHandler_m68k(objc_uncaught_exception_handler_t _Nullable handler)(a0) -void objc_setForwardHandler_m68k(IMP _Nullable forward, IMP _Nullable stretForward)(a0,a1) -void objc_setEnumerationMutationHandler_m68k(objc_enumeration_mutation_handler_t _Nullable handler)(a0) -void objc_zero_weak_references_m68k(id _Nonnull value)(a0) -* SysV functions for MorphOS could be added here for performance. Having them -* in addition to the m68k functions allows m68k applications to call into the -* PPC library, while native code can use the SysV functions. -==end Index: src/runtime/amiga-library.m ================================================================== --- src/runtime/amiga-library.m +++ src/runtime/amiga-library.m @@ -599,11 +599,11 @@ #endif , .rt_Version = OBJFW_RT_LIB_MAJOR, .rt_Type = NT_LIBRARY, .rt_Pri = 0, - .rt_Name = (char *)"objfw_rt.library", + .rt_Name = (char *)OBJFW_RT_AMIGA_LIB, .rt_IdString = (char *)"ObjFW_RT " VERSION_STRING " \xA9 2008-2019 Jonathan Schleifer", .rt_Init = &init_table, #ifdef OF_MORPHOS .rt_Revision = OBJFW_RT_LIB_MINOR, ADDED src/runtime/amigaos3.sfd Index: src/runtime/amigaos3.sfd ================================================================== --- src/runtime/amigaos3.sfd +++ src/runtime/amigaos3.sfd @@ -0,0 +1,81 @@ +==base _ObjFWRTBase +==basetype struct Library * +==libname objfw_rt_0_68k.library +==bias 30 +==public +* Functions that are only for the linklib. +bool objc_init_m68k(unsigned int version, struct objc_libc *libc, FILE *stdout, FILE *stdin)(d0,a0,a1,a2) +* These have a built-in declaration in the compiler that does not use the +* registers and thus always need glue. +void __objc_exec_class_m68k(void *_Nonnull module)(a0) +IMP _Nonnull objc_msg_lookup_m68k(id _Nullable object, SEL _Nonnull selector)(a0,a1) +IMP _Nonnull objc_msg_lookup_stret_m68k(id _Nullable object, SEL _Nonnull selector)(a0,a1) +IMP _Nonnull objc_msg_lookup_super_m68k(struct objc_super *_Nonnull super, SEL _Nonnull selector)(a0,a1) +IMP _Nonnull objc_msg_lookup_super_stret_m68k(struct objc_super *_Nonnull super, SEL _Nonnull selector)(a0,a1) +Class _Nullable objc_lookUpClass_m68k(const char *_Nonnull name)(a0) +Class _Nullable objc_getClass_m68k(const char *_Nonnull name)(a0) +Class _Nonnull objc_getRequiredClass_m68k(const char *_Nonnull name)(a0) +Class _Nullable objc_lookup_class_m68k(const char *_Nonnull name)(a0) +Class _Nonnull objc_get_class_m68k(const char *_Nonnull name)(a0) +void objc_exception_throw_m68k(id _Nonnull object)(a0) +int objc_sync_enter_m68k(id _Nullable object)(a0) +int objc_sync_exit_m68k(id _Nullable object)(a0) +id objc_getProperty_m68k(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, bool atomic)(a0,a1,d0,d1) +void objc_setProperty_m68k(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, id value, bool atomic, signed char copy)(a0,a1,d0,a2,d1,d2) +void objc_getPropertyStruct_m68k(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong)(a0,a1,d0,d1,d2) +void objc_setPropertyStruct_m68k(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong)(a0,a1,d0,d1,d2) +void objc_enumerationMutation_m68k(id _Nonnull object)(a0) +int __gnu_objc_personality_v0_m68k(int version, int actions, uint64_t *_Nonnull exClass, void *_Nonnull ex, void *_Nonnull ctx)(d0,d1,d2,a0,a1) +int __gnu_objc_personality_sj0_m68k(int version, int actions, uint64_t *_Nonnull exClass, void *_Nonnull ex, void *_Nonnull ctx)(d0,d1,d2,a0,a1) +id _Nullable objc_retain_m68k(id _Nullable object)(a0) +id _Nullable objc_retainBlock_m68k(id _Nullable block)(a0) +id _Nullable objc_retainAutorelease_m68k(id _Nullable object)(a0) +void objc_release_m68k(id _Nullable object)(a0) +id _Nullable objc_autorelease_m68k(id _Nullable object)(a0) +id _Nullable objc_autoreleaseReturnValue_m68k(id _Nullable object)(a0) +id _Nullable objc_retainAutoreleaseReturnValue_m68k(id _Nullable object)(a0) +id _Nullable objc_retainAutoreleasedReturnValue_m68k(id _Nullable object)(a0) +id _Nullable objc_storeStrong_m68k(id _Nullable *_Nonnull object, id _Nullable value)(a0,a1) +id _Nullable objc_storeWeak_m68k(id _Nullable *_Nonnull object, id _Nullable value)(a0,a1) +id _Nullable objc_loadWeakRetained_m68k(id _Nullable *_Nonnull object)(a0) +id _Nullable objc_initWeak_m68k(id _Nullable *_Nonnull object, id _Nullable value)(a0,a1) +void objc_destroyWeak_m68k(id _Nullable *_Nonnull object)(a0) +id _Nullable objc_loadWeak_m68k(id _Nullable *_Nonnull object)(a0) +void objc_copyWeak_m68k(id _Nullable *_Nonnull dest, id _Nullable *_Nonnull src)(a0,a1) +void objc_moveWeak_m68k(id _Nullable *_Nonnull dest, id _Nullable *_Nonnull src)(a0,a1) +* These only need glue on MorphOS. As none of them are functions that are used +* in hot paths, it's easier to also use the glue on AmigaOS 3, which also has +* the benefit of having all __saveds in a single place. +SEL _Nonnull sel_registerName_m68k(const char *_Nonnull name)(a0) +const char *_Nonnull sel_getName_m68k(SEL _Nonnull selector)(a0) +bool sel_isEqual_m68k(SEL _Nonnull selector1, SEL _Nonnull selector2)(a0,a1) +Class _Nonnull objc_allocateClassPair_m68k(Class _Nullable superclass, const char *_Nonnull name, size_t extraBytes)(a0,a1,d0) +void objc_registerClassPair_m68k(Class _Nonnull class_)(a0) +unsigned int objc_getClassList_m68k(Class _Nonnull *_Nullable buffer, unsigned int count)(a0,d0) +Class _Nonnull *_Nonnull objc_copyClassList_m68k(unsigned int *_Nullable length)(a0) +bool class_isMetaClass_m68k(Class _Nullable class_)(a0) +const char *_Nullable class_getName_m68k(Class _Nullable class_)(a0) +Class _Nullable class_getSuperclass_m68k(Class _Nullable class_)(a0) +unsigned long class_getInstanceSize_m68k(Class _Nullable class_)(a0) +bool class_respondsToSelector_m68k(Class _Nullable class_, SEL _Nonnull selector)(a0,a1) +bool class_conformsToProtocol_m68k(Class _Nullable class_, Protocol *_Nonnull p)(a0,a1) +IMP _Nullable class_getMethodImplementation_m68k(Class _Nullable class_, SEL _Nonnull selector)(a0,a1) +IMP _Nullable class_getMethodImplementation_stret_m68k(Class _Nullable class_, SEL _Nonnull selector)(a0,a1) +const char *_Nullable class_getMethodTypeEncoding_m68k(Class _Nullable class_, SEL _Nonnull selector)(a0,a1) +bool class_addMethod_m68k(Class _Nonnull class_, SEL _Nonnull selector, IMP _Nonnull implementation, const char *_Nullable typeEncoding)(a0,a1,a2,a3) +IMP _Nullable class_replaceMethod_m68k(Class _Nonnull class_, SEL _Nonnull selector, IMP _Nonnull implementation, const char *_Nullable typeEncoding)(a0,a1,a2,a3) +Class _Nullable object_getClass_m68k(id _Nullable object)(a0) +Class _Nullable object_setClass_m68k(id _Nullable object, Class _Nonnull class_)(a0,a1) +const char *_Nullable object_getClassName_m68k(id _Nullable object)(a0) +const char *_Nonnull protocol_getName_m68k(Protocol *_Nonnull protocol)(a0) +bool protocol_isEqual_m68k(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2)(a0,a1) +bool protocol_conformsToProtocol_m68k(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2)(a0,a1) +void objc_exit_m68k(void)() +_Nullable objc_uncaught_exception_handler_t objc_setUncaughtExceptionHandler_m68k(objc_uncaught_exception_handler_t _Nullable handler)(a0) +void objc_setForwardHandler_m68k(IMP _Nullable forward, IMP _Nullable stretForward)(a0,a1) +void objc_setEnumerationMutationHandler_m68k(objc_enumeration_mutation_handler_t _Nullable handler)(a0) +void objc_zero_weak_references_m68k(id _Nonnull value)(a0) +* SysV functions for MorphOS could be added here for performance. Having them +* in addition to the m68k functions allows m68k applications to call into the +* PPC library, while native code can use the SysV functions. +==end Index: src/runtime/linklib/Makefile ================================================================== --- src/runtime/linklib/Makefile +++ src/runtime/linklib/Makefile @@ -3,7 +3,10 @@ STATIC_LIB = libobjfw_rt.library.a SRCS = linklib.m include ../../../buildsys.mk -CPPFLAGS += -DOBJC_COMPILING_AMIGA_LINKLIB -I.. -I../.. -I../../.. +CPPFLAGS += -I.. -I../.. -I../../.. \ + -DOBJC_COMPILING_AMIGA_LINKLIB \ + -DOBJFW_RT_AMIGA_LIB=\"${OBJFW_RT_AMIGA_LIB}\" \ + -DOBJFW_RT_LIB_MINOR=${OBJFW_RT_LIB_MINOR} LD = ${OBJC} Index: src/runtime/linklib/linklib.m ================================================================== --- src/runtime/linklib/linklib.m +++ src/runtime/linklib/linklib.m @@ -94,17 +94,18 @@ }; if (initialized) return; - if ((ObjFWRTBase = OpenLibrary("objfw_rt.library", 0)) == NULL) { - fputs("Failed to open objfw_rt.library!\n", stderr); + if ((ObjFWRTBase = OpenLibrary(OBJFW_RT_AMIGA_LIB, + OBJFW_RT_LIB_MINOR)) == NULL) { + fputs("Failed to open " OBJFW_RT_AMIGA_LIB "!\n", stderr); abort(); } if (!objc_init_m68k(1, &libc, stdout, stderr)) { - fputs("Failed to initialize objfw_rt.library!\n", stderr); + fputs("Failed to initialize " OBJFW_RT_AMIGA_LIB "!\n", stderr); abort(); } initialized = true; } ADDED src/runtime/morphos.sfd Index: src/runtime/morphos.sfd ================================================================== --- src/runtime/morphos.sfd +++ src/runtime/morphos.sfd @@ -0,0 +1,81 @@ +==base _ObjFWRTBase +==basetype struct Library * +==libname objfw_rt_0_abox.library +==bias 30 +==public +* Functions that are only for the linklib. +bool objc_init_m68k(unsigned int version, struct objc_libc *libc, FILE *stdout, FILE *stdin)(d0,a0,a1,a2) +* These have a built-in declaration in the compiler that does not use the +* registers and thus always need glue. +void __objc_exec_class_m68k(void *_Nonnull module)(a0) +IMP _Nonnull objc_msg_lookup_m68k(id _Nullable object, SEL _Nonnull selector)(a0,a1) +IMP _Nonnull objc_msg_lookup_stret_m68k(id _Nullable object, SEL _Nonnull selector)(a0,a1) +IMP _Nonnull objc_msg_lookup_super_m68k(struct objc_super *_Nonnull super, SEL _Nonnull selector)(a0,a1) +IMP _Nonnull objc_msg_lookup_super_stret_m68k(struct objc_super *_Nonnull super, SEL _Nonnull selector)(a0,a1) +Class _Nullable objc_lookUpClass_m68k(const char *_Nonnull name)(a0) +Class _Nullable objc_getClass_m68k(const char *_Nonnull name)(a0) +Class _Nonnull objc_getRequiredClass_m68k(const char *_Nonnull name)(a0) +Class _Nullable objc_lookup_class_m68k(const char *_Nonnull name)(a0) +Class _Nonnull objc_get_class_m68k(const char *_Nonnull name)(a0) +void objc_exception_throw_m68k(id _Nonnull object)(a0) +int objc_sync_enter_m68k(id _Nullable object)(a0) +int objc_sync_exit_m68k(id _Nullable object)(a0) +id objc_getProperty_m68k(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, bool atomic)(a0,a1,d0,d1) +void objc_setProperty_m68k(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, id value, bool atomic, signed char copy)(a0,a1,d0,a2,d1,d2) +void objc_getPropertyStruct_m68k(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong)(a0,a1,d0,d1,d2) +void objc_setPropertyStruct_m68k(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong)(a0,a1,d0,d1,d2) +void objc_enumerationMutation_m68k(id _Nonnull object)(a0) +int __gnu_objc_personality_v0_m68k(int version, int actions, uint64_t *_Nonnull exClass, void *_Nonnull ex, void *_Nonnull ctx)(d0,d1,d2,a0,a1) +int __gnu_objc_personality_sj0_m68k(int version, int actions, uint64_t *_Nonnull exClass, void *_Nonnull ex, void *_Nonnull ctx)(d0,d1,d2,a0,a1) +id _Nullable objc_retain_m68k(id _Nullable object)(a0) +id _Nullable objc_retainBlock_m68k(id _Nullable block)(a0) +id _Nullable objc_retainAutorelease_m68k(id _Nullable object)(a0) +void objc_release_m68k(id _Nullable object)(a0) +id _Nullable objc_autorelease_m68k(id _Nullable object)(a0) +id _Nullable objc_autoreleaseReturnValue_m68k(id _Nullable object)(a0) +id _Nullable objc_retainAutoreleaseReturnValue_m68k(id _Nullable object)(a0) +id _Nullable objc_retainAutoreleasedReturnValue_m68k(id _Nullable object)(a0) +id _Nullable objc_storeStrong_m68k(id _Nullable *_Nonnull object, id _Nullable value)(a0,a1) +id _Nullable objc_storeWeak_m68k(id _Nullable *_Nonnull object, id _Nullable value)(a0,a1) +id _Nullable objc_loadWeakRetained_m68k(id _Nullable *_Nonnull object)(a0) +id _Nullable objc_initWeak_m68k(id _Nullable *_Nonnull object, id _Nullable value)(a0,a1) +void objc_destroyWeak_m68k(id _Nullable *_Nonnull object)(a0) +id _Nullable objc_loadWeak_m68k(id _Nullable *_Nonnull object)(a0) +void objc_copyWeak_m68k(id _Nullable *_Nonnull dest, id _Nullable *_Nonnull src)(a0,a1) +void objc_moveWeak_m68k(id _Nullable *_Nonnull dest, id _Nullable *_Nonnull src)(a0,a1) +* These only need glue on MorphOS. As none of them are functions that are used +* in hot paths, it's easier to also use the glue on AmigaOS 3, which also has +* the benefit of having all __saveds in a single place. +SEL _Nonnull sel_registerName_m68k(const char *_Nonnull name)(a0) +const char *_Nonnull sel_getName_m68k(SEL _Nonnull selector)(a0) +bool sel_isEqual_m68k(SEL _Nonnull selector1, SEL _Nonnull selector2)(a0,a1) +Class _Nonnull objc_allocateClassPair_m68k(Class _Nullable superclass, const char *_Nonnull name, size_t extraBytes)(a0,a1,d0) +void objc_registerClassPair_m68k(Class _Nonnull class_)(a0) +unsigned int objc_getClassList_m68k(Class _Nonnull *_Nullable buffer, unsigned int count)(a0,d0) +Class _Nonnull *_Nonnull objc_copyClassList_m68k(unsigned int *_Nullable length)(a0) +bool class_isMetaClass_m68k(Class _Nullable class_)(a0) +const char *_Nullable class_getName_m68k(Class _Nullable class_)(a0) +Class _Nullable class_getSuperclass_m68k(Class _Nullable class_)(a0) +unsigned long class_getInstanceSize_m68k(Class _Nullable class_)(a0) +bool class_respondsToSelector_m68k(Class _Nullable class_, SEL _Nonnull selector)(a0,a1) +bool class_conformsToProtocol_m68k(Class _Nullable class_, Protocol *_Nonnull p)(a0,a1) +IMP _Nullable class_getMethodImplementation_m68k(Class _Nullable class_, SEL _Nonnull selector)(a0,a1) +IMP _Nullable class_getMethodImplementation_stret_m68k(Class _Nullable class_, SEL _Nonnull selector)(a0,a1) +const char *_Nullable class_getMethodTypeEncoding_m68k(Class _Nullable class_, SEL _Nonnull selector)(a0,a1) +bool class_addMethod_m68k(Class _Nonnull class_, SEL _Nonnull selector, IMP _Nonnull implementation, const char *_Nullable typeEncoding)(a0,a1,a2,a3) +IMP _Nullable class_replaceMethod_m68k(Class _Nonnull class_, SEL _Nonnull selector, IMP _Nonnull implementation, const char *_Nullable typeEncoding)(a0,a1,a2,a3) +Class _Nullable object_getClass_m68k(id _Nullable object)(a0) +Class _Nullable object_setClass_m68k(id _Nullable object, Class _Nonnull class_)(a0,a1) +const char *_Nullable object_getClassName_m68k(id _Nullable object)(a0) +const char *_Nonnull protocol_getName_m68k(Protocol *_Nonnull protocol)(a0) +bool protocol_isEqual_m68k(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2)(a0,a1) +bool protocol_conformsToProtocol_m68k(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2)(a0,a1) +void objc_exit_m68k(void)() +_Nullable objc_uncaught_exception_handler_t objc_setUncaughtExceptionHandler_m68k(objc_uncaught_exception_handler_t _Nullable handler)(a0) +void objc_setForwardHandler_m68k(IMP _Nullable forward, IMP _Nullable stretForward)(a0,a1) +void objc_setEnumerationMutationHandler_m68k(objc_enumeration_mutation_handler_t _Nullable handler)(a0) +void objc_zero_weak_references_m68k(id _Nonnull value)(a0) +* SysV functions for MorphOS could be added here for performance. Having them +* in addition to the m68k functions allows m68k applications to call into the +* PPC library, while native code can use the SysV functions. +==end Index: tests/Makefile ================================================================== --- tests/Makefile +++ tests/Makefile @@ -79,11 +79,11 @@ rm -f libobjfw.so.${OBJFW_LIB_MAJOR_MINOR} rm -f libobjfw.dll libobjfw.${OBJFW_LIB_MAJOR}.dylib rm -f libobjfw_rt.so.${OBJFW_RT_LIB_MAJOR} rm -f libobjfw_rt.so.${OBJFW_RT_LIB_MAJOR_MINOR} rm -f libobjfw_rt.dll libobjfw_rt.${OBJFW_RT_LIB_MAJOR}.dylib - rm -f objfw_rt.library + rm -f ${OBJFW_RT_AMIGA_LIB} if test -f ../src/libobjfw.so; then \ ${LN_S} ../src/libobjfw.so libobjfw.so.${OBJFW_LIB_MAJOR}; \ ${LN_S} ../src/libobjfw.so \ libobjfw.so.${OBJFW_LIB_MAJOR_MINOR}; \ elif test -f ../src/libobjfw.so.${OBJFW_LIB_MAJOR_MINOR}; then \ @@ -110,12 +110,13 @@ fi if test -f ../src/runtime/libobjfw_rt.dylib; then \ ${LN_S} ../src/runtime/libobjfw_rt.dylib \ libobjfw_rt.${OBJFW_RT_LIB_MAJOR}.dylib; \ fi - if test -f ../src/runtime/objfw_rt.library; then \ - ${LN_S} ../src/runtime/objfw_rt.library objfw_rt.library; \ + if test -f ../src/runtime/${OBJFW_RT_AMIGA_LIB}; then \ + ${LN_S} ../src/runtime/${OBJFW_RT_AMIGA_LIB} \ + ${OBJFW_RT_AMIGA_LIB}; \ fi LD_LIBRARY_PATH=.$${LD_LIBRARY_PATH+:}$$LD_LIBRARY_PATH \ DYLD_FRAMEWORK_PATH=../src:../src/runtime$${DYLD_FRAMEWORK_PATH+:}$$DYLD_FRAMEWORK_PATH \ DYLD_LIBRARY_PATH=.$${DYLD_LIBRARY_PATH+:}$$DYLD_LIBRARY_PATH \ LIBRARY_PATH=.$${LIBRARY_PATH+:}$$LIBRARY_PATH \