You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I started working on this while compiling latest objc4 for porting it to older iOS. Commenting out featureflag and OS detection codes was really a bad idea since it ACTUALLY affecting how libobjc works. The reason I am doing this is, I can't find any useful information except bunch copies of articles telling me to comment these undefined values out, no, don't do that.
These undefined values and undeclared functions can be easily figured out by simple searching or reversing. For that non-open feature_private.h, I have done that here.
And for those dyld version check constants, they should originally be in <mach-o/dyld_priv.h> but stripped out by Apple. They are simple structs containing two uint32_t values referring to platforms and versions.
Using that CrashReporterClient.h stub which appears in older Libc was not quite a good idea, since linking libCrashReporterClient would insert a load command section to Mach-O files (that also indicates libCrashReporterClient was a static library)
For those Cambria APIs, we can see objc-cache.mm was calling two of them
#if TARGET_OS_OSX
if (oah_is_current_process_translated()) {
kern_return_t ret = objc_thread_get_rip(threads[count], (uint64_t*)&pc);
if (ret != KERN_SUCCESS) {
pc = PC_SENTINEL;
}
} else {
pc = _get_pc_for_thread (threads[count]);
}
#else
pc = _get_pc_for_thread (threads[count]);
#endif
It was really easy to figure out that oah_is_current_process_translated() was returning bool, with no arguments, then we have its prototype
bool oah_is_current_process_translated(void);
objc_thread_get_rip() was kinda tricky but still easy to find out how to correctly call it, the definition of thread was thread_act_port_array_t threads;, and the actual type of thread_act_port_array_t was
// <arm/_types.h> or <i386/_types.h>
typedef unsigned int __darwin_natural_t;
// <sys/_types.h>
typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
typedef __darwin_mach_port_name_t __darwin_mach_port_t; /* Used by mach */
// <sys/_types/_mach_port_t.h>
typedef __darwin_mach_port_t mach_port_t;
// <mach/mach-types.h>
typedef mach_port_t thread_act_t;
typedef thread_act_t *thread_act_array_t;
typedef thread_act_array_t thread_act_port_array_t;
We can see the 1st arg of objc_thread_get_rip() was a member of thread_act_port_array_t, then the type is thread_act_t but not thread_act_port_array_t, then we get prototype
These codes cannot successfully compile without linking liboah, which was not presenting in MacOSX.sdk, we can extract dyld shared cache, get /usr/lib/liboah.dylib, generate liboah.tbd from it. I have done Cambria headers also
The text was updated successfully, but these errors were encountered:
I figured out how <os/feature_private.h> was, and those dyld magic values.
https://github.com/Torrekie/apple_internal_sdk
I started working on this while compiling latest objc4 for porting it to older iOS. Commenting out featureflag and OS detection codes was really a bad idea since it ACTUALLY affecting how libobjc works. The reason I am doing this is, I can't find any useful information except bunch copies of articles telling me to comment these undefined values out, no, don't do that.
These undefined values and undeclared functions can be easily figured out by simple searching or reversing. For that non-open feature_private.h, I have done that here.
And for those dyld version check constants, they should originally be in <mach-o/dyld_priv.h> but stripped out by Apple. They are simple structs containing two uint32_t values referring to platforms and versions.
These are actual values of those
dyld_fall_20*_os_versions
stuffUsing that CrashReporterClient.h stub which appears in older Libc was not quite a good idea, since linking libCrashReporterClient would insert a load command section to Mach-O files (that also indicates libCrashReporterClient was a static library)
We can find CrashReporterClient implementation under WTF/wtf/spi/cocoa/CrashReporterClientSPI.h and WTF/wtf/cocoa/CrashReporter.cpp, these codes also appears in many other Apple OSSes.
Now we have <CrashReporterClient.h> and libCrashReporterClient.a
For those Cambria APIs, we can see objc-cache.mm was calling two of them
It was really easy to figure out that
oah_is_current_process_translated()
was returning bool, with no arguments, then we have its prototypeobjc_thread_get_rip()
was kinda tricky but still easy to find out how to correctly call it, the definition ofthread
wasthread_act_port_array_t threads;
, and the actual type ofthread_act_port_array_t
wasWe can see the 1st arg of
objc_thread_get_rip()
was a member ofthread_act_port_array_t
, then the type isthread_act_t
but notthread_act_port_array_t
, then we get prototypeThese codes cannot successfully compile without linking liboah, which was not presenting in MacOSX.sdk, we can extract dyld shared cache, get /usr/lib/liboah.dylib, generate liboah.tbd from it. I have done Cambria headers also
The text was updated successfully, but these errors were encountered: