@@ -2674,12 +2674,19 @@ _swift_initClassMetadataImpl(ClassMetadata *self,
2674
2674
setUpObjCRuntimeGetImageNameFromClass ();
2675
2675
}, nullptr );
2676
2676
2677
+ #ifndef OBJC_REALIZECLASSFROMSWIFT_DEFINED
2677
2678
// Temporary workaround until _objc_realizeClassFromSwift is in the SDK.
2678
2679
static auto _objc_realizeClassFromSwift =
2679
- (Class (*)(Class _Nullable, const void *_Nullable))
2680
+ (Class (*)(Class _Nullable, void *_Nullable))
2680
2681
dlsym (RTLD_NEXT, " _objc_realizeClassFromSwift" );
2681
2682
#endif
2682
2683
2684
+ // Temporary workaround until objc_loadClassref is in the SDK.
2685
+ static auto objc_loadClassref =
2686
+ (Class (*)(void *))
2687
+ dlsym (RTLD_NEXT, " objc_loadClassref" );
2688
+ #endif
2689
+
2683
2690
// Copy field offsets, generic arguments and (if necessary) vtable entries
2684
2691
// from our superclass.
2685
2692
copySuperclassMetadataToSubclass (self, layoutFlags);
@@ -2705,12 +2712,13 @@ _swift_initClassMetadataImpl(ClassMetadata *self,
2705
2712
// however we should not be using it for anything in a non-generic
2706
2713
// class.
2707
2714
if (auto *stub = description->getObjCResilientClassStub ()) {
2708
- if (_objc_realizeClassFromSwift == nullptr ) {
2715
+ if (_objc_realizeClassFromSwift == nullptr ||
2716
+ objc_loadClassref == nullptr ) {
2709
2717
fatalError (0 , " class %s requires missing Objective-C runtime feature; "
2710
2718
" the deployment target was newer than this OS\n " ,
2711
2719
self->getDescription ()->Name .get ());
2712
2720
}
2713
- _objc_realizeClassFromSwift ((Class) self, stub);
2721
+ _objc_realizeClassFromSwift ((Class) self, const_cast < void *>( stub) );
2714
2722
} else
2715
2723
swift_instantiateObjCClass (self);
2716
2724
}
@@ -2762,7 +2770,7 @@ _swift_updateClassMetadataImpl(ClassMetadata *self,
2762
2770
#ifndef OBJC_REALIZECLASSFROMSWIFT_DEFINED
2763
2771
// Temporary workaround until _objc_realizeClassFromSwift is in the SDK.
2764
2772
static auto _objc_realizeClassFromSwift =
2765
- (Class (*)(Class _Nullable, const void *_Nullable))
2773
+ (Class (*)(Class _Nullable, void *_Nullable))
2766
2774
dlsym (RTLD_NEXT, " _objc_realizeClassFromSwift" );
2767
2775
#endif
2768
2776
0 commit comments