Skip to content

Commit bf7fa56

Browse files
authored
Merge pull request swiftlang#34354 from mikeash/restore-objc_addLoadImageFunc
[Runtime] Restore objc_addLoadImageFunc in ImageInspectionMacho.cpp.
2 parents 1be7171 + 17e31d8 commit bf7fa56

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stdlib/public/runtime/ImageInspectionMachO.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ void addImageCallback2Sections(const mach_header *mh, intptr_t vmaddr_slide) {
122122

123123
#if OBJC_ADDLOADIMAGEFUNC_DEFINED && SWIFT_OBJC_INTEROP
124124
#define REGISTER_FUNC(...) \
125-
_dyld_register_func_for_add_image(__VA_ARGS__);
125+
if (__builtin_available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)) { \
126+
objc_addLoadImageFunc(__VA_ARGS__); \
127+
} else { \
128+
_dyld_register_func_for_add_image(__VA_ARGS__); \
129+
}
126130
#else
127131
#define REGISTER_FUNC(...) _dyld_register_func_for_add_image(__VA_ARGS__)
128132
#endif

0 commit comments

Comments
 (0)