Skip to content

Commit f78b684

Browse files
committed
Fix build with -fno-common
Several of the hooks were being generated with common linkage in hooks.c and as normal initialised symbols in sendmsg2.c. Recent clang defaults to -fno-common, which causes the common linkage versions to become strong symbols and then causes a linkage failure from duplicate definitions: one zero initialised, one initialised with a real value. This removes copy in hooks.c, retaining only the initialised version. Fixes #171
1 parent 48c875f commit f78b684

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

objc/hooks.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ OBJC_HOOK void (*_objc_load_callback)(Class cls, struct objc_category *category)
3535
* The hook used for fast proxy lookups. This takes an object and a selector
3636
* and returns the instance that the message should be forwarded to.
3737
*/
38-
OBJC_HOOK id (*objc_proxy_lookup)(id receiver, SEL op);
38+
OBJC_PUBLIC extern id (*objc_proxy_lookup)(id receiver, SEL op);
3939
/**
4040
* New runtime forwarding hook. This is no longer used, but is retained to
4141
* prevent errors at link time.
4242
*/
43-
OBJC_HOOK struct objc_slot *(*__objc_msg_forward3)(id, SEL) OBJC_DEPRECATED;
43+
OBJC_PUBLIC extern struct objc_slot *(*__objc_msg_forward3)(id, SEL) OBJC_DEPRECATED;
4444
/**
4545
* Forwarding hook. Takes an object and a selector and returns a method that
4646
* handles the forwarding.
4747
*/
48-
OBJC_HOOK IMP (*__objc_msg_forward2)(id, SEL);
48+
OBJC_PUBLIC extern IMP (*__objc_msg_forward2)(id, SEL);
4949
/**
5050
* Hook defined for handling unhandled exceptions. If the unwind library
5151
* reaches the end of the stack without finding a handler then this hook is
@@ -67,13 +67,13 @@ OBJC_HOOK Class (*_objc_class_for_boxing_foreign_exception)(int64_t exceptionCla
6767
* receiver. This should return the slot to use instead, although it may throw
6868
* an exception or perform some other action.
6969
*/
70-
OBJC_HOOK IMP (*_objc_selector_type_mismatch2)(Class cls,
70+
OBJC_PUBLIC extern IMP (*_objc_selector_type_mismatch2)(Class cls,
7171
SEL selector, struct objc_slot2 *result);
7272
/**
7373
* Legacy hook for when selector types do not match. This is only called
7474
* `_objc_selector_type_mismatch2` is not installed.
7575
*/
76-
OBJC_HOOK struct objc_slot *(*_objc_selector_type_mismatch)(Class cls,
76+
OBJC_PUBLIC extern struct objc_slot *(*_objc_selector_type_mismatch)(Class cls,
7777
SEL selector, struct objc_slot *result) OBJC_DEPRECATED;
7878

7979
/**

0 commit comments

Comments
 (0)