objc4

by 0xxd0

0xxd0 / objc4

A buildable and debuggable latest Objective-C runtime objc4 (objc-781) project.

271 Stars 47 Forks Last release: 3 months ago (objc4-781) MIT License 91 Commits 2 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

objc runtime

build_status Join the chat at https://gitter.im/0xxd0/objc4 support

This project is a buildable and debuggable version of latest Objective-C runtime (objc4-781) on Apple Open Source

Requirement

Xcode 11.3 macOS Catalina

Installation

Manually

Download zip or clone this repo, select objc scheme and build.

Usage

After building the objc scheme, manually integrate generated

libobjc.A.dylib
into your project manually. Or you can use objc-inspect scheme which is a preset inspector for debugging objc4 runtime.

objc4 tarballs

Build Phases

Private Header

| objc header | #include | tarball | |------|--------|---------| | objc-os.h |

#include 
| /xnu-6153.41.3/bsd/sys/reason.h | | objc-os.h |
#include 
| /dyld-733.6/include/mach-o/dyldpriv.h | | objc-os.h | `#include <os/lockprivate.h>
| /libplatform-220/private/os/lock_private.h |
| lock_private.h |
#include
| /libplatform-220/private/os/base_private.h |
| objc-os.h |
#include
| removed in latest Libc tarball (Libc-1353.41.1), this header should be commented-out |
| pthread_machdep.h |
#include
| /xnu-6153.41.3/osfmk/machine/cpu_capabilities.h |
| objc-os.h |
#include
| /libpthread-416.40.3/private/workqueue_private.h | 
| objc-os.h |
#include
| /dyld-733.6/include/objc-shared-cache.h | 
| objc-errors.mm |
#include <simple.h>` | /libplatform-220/private/simple.h | | objc-block-trampolines.mm |
#include 
| /libclosure-74/Blockprivate.h | | objc-os.h | `#include <crtexterns.h>
| /Libc-1353.41.1/include/crt_externs.h |
| objc-runtime-new.mm |
#include
| /xnu-6153.41.3/osfmk/mach/shared_region.h |
| objc-cache.mm  |
#include
| /xnu-6153.41.3/osfmk/mach/restartable.defs, build from xnu kernel |
| objc-os.h |
#include ` | /Libc-825.24/include/CrashReporterClient.h |

Private Header Included Header

| private header | #include | tarball | |------|--------|---------| | tsdprivate.h |

#include 
| /xnu-6153.41.3/libsyscall/os/tsd.h | | tsdprivate.h |

#include 
| /libpthread-416.40.3/private/spinlockprivate.h | | lockprivate.h |
#include 
| /libpthread-416.40.3/private/tsdprivate.h | | workqueueprivate.h |
#include 
| /llibpthread-416.40.3/private/qosprivate.h | | qosprivate.h |
#include 
| /libpthread-416.40.3/sys/qos_private.h |

Bridge OS

In public macosx sdk (latest Xcode 11.3.1), bridgeos (e.g.

__has_feature(attribute_availability_bridgeos)
) is unavailable, bridgeos availability should be removed or commented-out.

dyld

In latest dyld-733.6 (dyld-421.2 later), apple use this ruby script to expand versions, platfrom versions from a

versionSets
which defined in a YAML file, code generated by this script will be inserted after
@[email protected]
,
@[email protected]
,
@[email protected]
,
@[email protected]
and
@[email protected]
in
dyld_priv.h
. For more detail please refer to dyld.

XNU

 is generated form 
restartable.defs
in xnu tarball during building xun kernel, which is a little different from the one that shipped with public sdk that located in
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/kern/restartable.h
.

Build Setting

| Declaration | Value | |-------------|-------| |

HEADER_SEARCH_PATHS
| $(SRCROOT)/../macosx.internal/System/Library/Frameworks/System.framework/PrivateHeaders | |
GCC_PREPROCESSOR_DEFINITIONS
| LIBCNOLIBCRASHREPORTERCLIENT | |
ORDER_FILE
| $(SRCROOT)/libobjc.order | |
OTHER_LDFLAGS[sdk=macosx*]
| -lc++abi -Xlinker -sectalign -Xlinker _DATA -Xlinker _objcdata -Xlinker 0x1000 -Xlinker -interposablelist -Xlinker interposable.txt | |
OTHER_LDFLAGS[sdk=iphoneos*][arch=*]
| -lc++abi -Wl,-segalign,0x4000 -Xlinker -sectalign -Xlinker _DATA -Xlinker _objcdata -Xlinker 0x1000 -Xlinker -interposablelist -Xlinker interposable.txt -isystem -iframework | |
OTHER_LDFLAGS[sdk=iphonesimulator*][arch=*]
| -lc++abi -Xlinker -interposable_list -Xlinker interposable.txt |

Run Script

Evidently public macosx sdk is our only choice, we need to update value of parameter

-sdk
from
macosx.internal
to
macosx
in run script of objc target.

License

This project is released under the MIT License. The objc4 project is released under the APPLE PUBLIC SOURCE LICENSE Version 2.0.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.