Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -58,11 +58,12 @@ #elif defined(OF_HAVE_THREADS) # import "threading.h" #endif #ifdef OF_APPLE_RUNTIME -extern double *NSFoundationVersionNumber __attribute__((__weak__)); +static double NSFoundationVersionNumber + OF_WEAK_REF("NSFoundationVersionNumber"); #endif #if defined(OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR) extern id of_forward(id, SEL, ...); extern struct stret of_forward_stret(id, SEL, ...); Index: src/macros.h ================================================================== --- src/macros.h +++ src/macros.h @@ -68,16 +68,18 @@ # define OF_INLINE inline __attribute__((__always_inline__)) # define OF_LIKELY(cond) (__builtin_expect(!!(cond), 1)) # define OF_UNLIKELY(cond) (__builtin_expect(!!(cond), 0)) # define OF_CONST_FUNC __attribute__((__const__)) # define OF_NO_RETURN_FUNC __attribute__((__noreturn__)) +# define OF_WEAK_REF(sym) __attribute__((__weakref__(sym))) #else # define OF_INLINE inline # define OF_LIKELY(cond) cond # define OF_UNLIKELY(cond) cond # define OF_CONST_FUNC # define OF_NO_RETURN_FUNC +# define OF_WEAK_REF(sym) #endif #ifdef OF_BIG_ENDIAN # define OF_BYTE_ORDER_NATIVE OF_BYTE_ORDER_BIG_ENDIAN #else Index: src/runtime/exception.m ================================================================== --- src/runtime/exception.m +++ src/runtime/exception.m @@ -27,15 +27,15 @@ #import "runtime-private.h" #import "macros.h" #if defined(HAVE_DWARF_EXCEPTIONS) -# define PERSONALITY __gnu_objc_personality_v0 -# define CXX_PERSONALITY __gxx_personality_v0 +# define PERSONALITY __gnu_objc_personality_v0 +# define CXX_PERSONALITY_STR "__gxx_personality_v0" #elif defined(HAVE_SJLJ_EXCEPTIONS) -# define PERSONALITY __gnu_objc_personality_sj0 -# define CXX_PERSONALITY __gxx_personality_sj0 +# define PERSONALITY __gnu_objc_personality_sj0 +# define CXX_PERSONALITY_STR "__gxx_personality_sj0" # define _Unwind_RaiseException _Unwind_SjLj_RaiseException # define __builtin_eh_return_data_regno(i) (i) #elif defined(HAVE_SEH_EXCEPTIONS) # define PERSONALITY gnu_objc_personality #else @@ -213,11 +213,11 @@ _Unwind_SetGR(ctx, 15, (value | thumb)); } #endif #ifdef CXX_PERSONALITY -extern PERSONALITY_FUNC(CXX_PERSONALITY) __attribute__((__weak__)); +static PERSONALITY_FUNC(cxx_personality) OF_WEAK_REF(CXX_PERSONALITY_STR); #endif #ifdef HAVE_SEH_EXCEPTIONS extern EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, void*, PCONTEXT, PDISPATCHER_CONTEXT, _Unwind_Reason_Code(*)(int, int, uint64_t, @@ -568,12 +568,12 @@ if (foreign) { switch (ex_class) { #ifdef CXX_PERSONALITY case GNUCCXX0_EXCEPTION_CLASS: case CLNGCXX0_EXCEPTION_CLASS: - if (CXX_PERSONALITY != NULL) - return CALL_PERSONALITY(CXX_PERSONALITY); + if (cxx_personality != NULL) + return CALL_PERSONALITY(cxx_personality); break; #endif } /*