Fix ___CFConstantStringClassReference...

...by making it an alias to the symbol for `__NSCFConstantString`
This commit is contained in:
Ariel Abreu 2021-03-19 17:11:06 -04:00
parent 662888280d
commit 8e68fa7bf5
No known key found for this signature in database
GPG Key ID: BB20848279B910AC
3 changed files with 8 additions and 18 deletions

View File

@ -210,21 +210,6 @@ CF_PRIVATE uintptr_t __CFRuntimeObjCClassTable[__CFRuntimeClassTableSize] = {0};
bool (*__CFObjCIsCollectable)(void *) = NULL;
#endif
#if !__CONSTANT_CFSTRINGS__ || DEPLOYMENT_TARGET_EMBEDDED_MINI
// Compiler uses this symbol name; must match compiler built-in decl, so we use 'int'
#if __LP64__
int __CFConstantStringClassReference[24] = {0};
#else
int __CFConstantStringClassReference[12] = {0};
#endif
#endif
#if __LP64__
int __CFConstantStringClassReference[24] = {0};
#else
int __CFConstantStringClassReference[12] = {0};
#endif
void *__CFConstantStringClassReferencePtr = NULL;
Boolean _CFIsObjC(CFTypeID typeID, void *obj) {
@ -1015,7 +1000,7 @@ void __CFInitialize(void) {
__NSRetainCounters[idx].lock = CFLockInit;
}
memcpy(__CFConstantStringClassReference, (void *)objc_getClass("__NSCFConstantString"), sizeof(__CFConstantStringClassReference));
extern char __CFConstantStringClassReference;
__CFConstantStringClassReferencePtr = &__CFConstantStringClassReference;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

View File

@ -185,11 +185,13 @@ add_separated_framework(CoreFoundation
if (TARGET_i386)
set_property(TARGET CoreFoundation_i386 APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/reexport_i386.exp")
LINK_FLAGS " -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/reexport_i386.exp \
-Wl,-alias,.objc_class_name___NSCFConstantString,___CFConstantStringClassReference")
endif (TARGET_i386)
if (TARGET_x86_64)
set_property(TARGET CoreFoundation_x86_64 APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/reexport_x86_64.exp")
LINK_FLAGS " -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/reexport_x86_64.exp \
-Wl,-alias,_OBJC_CLASS_\\$___NSCFConstantString,___CFConstantStringClassReference")
endif (TARGET_x86_64)
set_source_files_properties(${cf_c_sources} PROPERTIES COMPILE_FLAGS "-x objective-c")

View File

@ -20,6 +20,9 @@ SINGLETON_RR()
- (BOOL)isKindOfClass:(Class)cls
{
if ([super isKindOfClass: cls]) {
return YES;
}
return cls == objc_lookUpClass("NSString");
}