libobjc2 but not gatekept by cmake
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
sandyx86 9206f48bce remove cmake 1 year ago
.github Android CI: Enable KVM, Caching and AArch64 (#296) 1 year ago
ABIDoc Document a bit more of class structure and of type encodings. 8 years ago
CMake Windows on ARM64: Support Visual Studio ABI sret mechanism for non-trivial data types (#289) 2 years ago
Test Windows on ARM64: Support Visual Studio ABI sret mechanism for non-trivial data types (#289) 2 years ago
include remove cmake 1 year ago
objc remove cmake 1 year ago
src remove cmake 1 year ago
.cirrus.yml feat(blocks runtime): Enable using libBlocksRuntime instead of the embedded runtime 2 years ago
.gitignore Generate CMake Configuration File 2 years ago
ANNOUNCE Add support for fast-path alloc / init methods and direct methods. 2 years ago
ANNOUNCE.1.0 Added 1.1 announcement. Committed some work-in-progress clang-specific build stuff (don't use this, it doesn't work correctly yet). 15 years ago
ANNOUNCE.1.1 Added 1.1 announcement. Committed some work-in-progress clang-specific build stuff (don't use this, it doesn't work correctly yet). 15 years ago
ANNOUNCE.1.2 Added 1.2 release announcement. 15 years ago
ANNOUNCE.1.3 Added note about aliases to release announcement. 15 years ago
ANNOUNCE.1.4 Created 1.4 release announcement. 15 years ago
ANNOUNCE.1.5 s/fifth/sixth 15 years ago
ANNOUNCE.1.6 1.6 release announcement. 14 years ago
ANNOUNCE.1.6.1 Archive 1.6.1 release announcement. 14 years ago
ANNOUNCE.1.7 Fixed svn URL for 1.7 release announcement. 13 years ago
ANNOUNCE.1.8 Fix copy and paste error in release announcement. 11 years ago
ANNOUNCE.1.8.1 Added 1.8.1 release announcement to master branch. 11 years ago
ANNOUNCE.1.9 Add 1.9 release announcement to 2.x series. 8 years ago
ANNOUNCE.2.0 Update ANNOUNCE. 7 years ago
ANNOUNCE.2.1 Copy ANNOUNCE for 2.1 release. 5 years ago
API Added property_getName(). Added non-portable API documentation. 16 years ago
Block.h fix(libBlocksRuntime compatibility): Install proper compatibiltiy headers for libBlocksRuntime 7 years ago
Block_private.h fix(libBlocksRuntime compatibility): Install proper compatibiltiy headers for libBlocksRuntime 7 years ago
CMakeLists.txt feat(blocks runtime): Enable using libBlocksRuntime instead of the embedded runtime 2 years ago
COPYING Removed last bits of legacy code from libobjc2. Added new exception handling implementation. 16 years ago
Config.cmake.in Generate CMake Configuration File 2 years ago
INSTALL feat(blocks runtime): Enable using libBlocksRuntime instead of the embedded runtime 2 years ago
Makefile remove cmake 1 year ago
NSBlocks.m feat(blocks runtime): Enable using libBlocksRuntime instead of the embedded runtime 2 years ago
Protocol2.m Revert "Provide compat classes only in compat builds." 7 years ago
README.md Attempt to add QEMU to CI. 3 years ago
README.windows Tests: Append CMAKE_BINARY_DIR to PATH on Windows 2 years ago
abi_version.c Remove Boehm GC support code. 3 years ago
alias.h Rename PUBLIC to OBJC_PUBLIC to avoid some namespace pollution. 7 years ago
alias_table.c Rename PUBLIC to OBJC_PUBLIC to avoid some namespace pollution. 7 years ago
arc.mm feat(blocks runtime): Enable using libBlocksRuntime instead of the embedded runtime 2 years ago
asmconstants.h PowerPC {32, 64}-bit Block Trampolines (#272) 2 years ago
associate.m Use const pointers for associated object keys. 7 years ago
block_to_imp.c PowerPC {32, 64}-bit Block Trampolines (#272) 2 years ago
block_trampolines.S PowerPC {32, 64}-bit Block Trampolines (#272) 2 years ago
blocks_runtime.h Add objc/blocks_private.h header to expose some internals of the blocks runtime 14 years ago
blocks_runtime.m feat(blocks runtime): Enable using libBlocksRuntime instead of the embedded runtime 2 years ago
blocks_runtime_np.m feat(blocks runtime): Enable using libBlocksRuntime instead of the embedded runtime 2 years ago
buffer.h Allow the buffered objects to be something other than a pointer. 10 years ago
caps.c Rename PUBLIC to OBJC_PUBLIC to avoid some namespace pollution. 7 years ago
category.h Rename legacy types. 8 years ago
category_loader.c Correctly upgrade categories. 8 years ago
class.h feat(blocks runtime): Enable using libBlocksRuntime instead of the embedded runtime 2 years ago
class_table.c Make some private symbols private. 7 years ago
cmake_uninstall.cmake.in Add uninstall target to CMake. 13 years ago
common.S Support compiling on mingw (no exception handling) 2 years ago
constant_string.h Stop treating NSObject as magic and do what OS X does with regard to root objects and metaclasses. 15 years ago
deps.txt remove cmake 1 year ago
dtable.c PowerPC {32, 64}-bit Block Trampolines (#272) 2 years ago
dtable.h Rename PUBLIC to OBJC_PUBLIC to avoid some namespace pollution. 7 years ago
dwarf_eh.h (Hopefully) fix C++ exception interop on ARM. 10 years ago
eh_personality.c Support compiling on mingw (no exception handling) 2 years ago
eh_trampoline.cc Rework C++ exception interop again. 6 years ago
eh_win32_msvc.cc Add objc_setUncaughtExceptionHandler() API 2 years ago
encoding2.c Export encoding functions. 5 years ago
fast_paths.m Add OBJC_PUBLIC annotation to objc_alloc, objc_allocWithZone, objc_alloc_init 2 years ago
gc_none.c Remove Boehm GC support code. 3 years ago
gc_ops.h Remove Boehm GC support code. 3 years ago
hash_table.h Make some private symbols private. 7 years ago
hooks.c Fix visibility of hooks on Windows. 5 years ago
ivar.c Remove Boehm GC support code. 3 years ago
ivar.h Fix compiler warnings. 7 years ago
legacy.c Fix the `instance_size` field for upgraded classes. 3 years ago
legacy.h Rename legacy types. 8 years ago
legacy_malloc.c libobjc2: tweaks to build on Windows 16 years ago
libobjc.pc.in Remove GC leftovers from pkg-config file 2 years ago
loader.c feat(blocks runtime): Enable using libBlocksRuntime instead of the embedded runtime 2 years ago
loader.h Rename method_list.h to method.h 8 years ago
lock.h Rewrite the selector table in C++. 3 years ago
method.h Fix compiler warnings. 7 years ago
module.h Change [1] to [] for variable length structure elements (C99 - silences array out of bounds errors). 15 years ago
mutation.m fix typo (#208) 5 years ago
nsobject.h Added support for associative references. Modified sync code to use this. 15 years ago
objc_msgSend.S Initial RISC-V 64-bit Support (#261) 2 years ago
objc_msgSend.aarch64.S Windows on ARM64: Support Visual Studio ABI sret mechanism for non-trivial data types (#289) 2 years ago
objc_msgSend.arm.S Fix unwind info in objc_msgSend.arm.S 7 years ago
objc_msgSend.mips.S Use register names that don't make LLVM whine, rather than the correct 10 years ago
objc_msgSend.riscv64.S Initial RISC-V 64-bit Support (#261) 2 years ago
objc_msgSend.x86-32.S Support compiling on mingw (no exception handling) 2 years ago
objc_msgSend.x86-64.S Support compiling on mingw (no exception handling) 2 years ago
objcxx_eh.cc MinGW: Use _Unwind_RaiseException to throw exceptions (#278) 2 years ago
objcxx_eh.h objcxx_eh.h: Remove weak attribute 2 years ago
objcxx_eh_mingw.cc MSYS2: Enable unexpected exception handling on clang64 2 years ago
objcxx_eh_private.h MinGW: Use _Unwind_RaiseException to throw exceptions (#278) 2 years ago
pool.h Print some memory usage statistics on exit if LIBOBJC_MEMORY_PROFILE is 13 years ago
pool.hh Rewrite the selector table in C++. 3 years ago
prepare_android_env.sh Android CI: Enable KVM, Caching and AArch64 (#296) 1 year ago
properties.h Fix compiler warnings. 7 years ago
properties.m Remove Boehm GC support code. 3 years ago
protocol.c Fixed usage of properties linked list. 6 years ago
protocol.h Fix compiler warnings. 7 years ago
runtime.c Updated the class_copyMethodList (#206) 5 years ago
safewindows.h win32: use native threading APIs instead of pthreads 8 years ago
sarray2.c Make some private symbols private. 7 years ago
sarray2.h Fix typo in comment. 10 years ago
selector.h Rewrite the selector table in C++. 3 years ago
selector_table.cc Fix offsets in selector_table (#273) 2 years ago
sendmsg2.c PowerPC {32, 64}-bit Block Trampolines (#272) 2 years ago
spinlock.h win32: use native threading APIs instead of pthreads 8 years ago
statics_loader.c Allow the buffered objects to be something other than a pointer. 10 years ago
string_hash.h Implemented support for __weak with ARC. 15 years ago
type_encoding_cases.h Fix missing type encoding case for long double. 7 years ago
unwind-arm.h Add missing extern "C" in unwind-arm.h. 5 years ago
unwind-itanium.h Support compiling on mingw (no exception handling) 2 years ago
unwind.h Implement ARM EH support, fix objc_msgSend() to work on ARM. 14 years ago
visibility.h Rename PUBLIC to OBJC_PUBLIC to avoid some namespace pollution. 7 years ago

README.md

GNUstep Objective-C Runtime

Linux and Windows CI: Libobjc2 CI

FreeBSD CI: Build Status

The GNUstep Objective-C runtime was designed as a drop-in replacement for the GCC runtime. It supports three ABIs:

  • The old GCC ABI, which provides support for Objective-C 1.0 features. This can be selected via the -fobjc-runtime=gcc flag in Clang or by compiling with GCC.
  • The initial GNUstep non-fragile ABI, which was intended to be compatible with the GCC ABI, but provide support for modern Objective-C features. This can be selected with the -fobjc-runtime=gnustep-1.9 flag in Clang.
  • The modern (v2) ABI, which provides richer reflection metadata, smaller binaries and reduced memory usage. This is selected with the -fobjc-runtime=gnustep-2.0 flag in Clang 7.0 or later.

The runtime can be built without support for older ABIs by setting the OLDABI_COMPAT flag to OFF in CMake configuration. This will result in a smaller binary, which will not link against code using the older ABIs.

All ABIs support the following feature above and beyond the GCC runtime:

  • The modern Objective-C runtime APIs, initially introduced with OS X 10.5.
  • Blocks (closures).
  • Synthesised property accessors.
  • Efficient support for @synchronized()
  • Type-dependent dispatch, eliminating stack corruption from mismatched selectors.
  • Support for the associated reference APIs introduced with Mac OS X 10.6.
  • Support for the automatic reference counting APIs introduced with Mac OS X 10.7

History

Early work on the GNUstep runtime combined code from the GCC Objective-C runtime, the Étoilé Objective-C runtime, Remy Demarest's blocks runtime for OS X 10.5, and the Étoilé Objective-C 2 API compatibility framework. All of these aside from the GCC runtime were MIT licensed, although the GPL'd code present in the GCC runtime meant that the combined work had to remain under the GPL.

Since then, all of the GCC code has been removed, leaving the remaining files all MIT licensed, and allowing the entire work to be MIT licensed.

The exception handling code uses a header file implementing the generic parts of the Itanium EH ABI. This file comes from PathScale's libcxxrt. PathScale kindly allowed it to be MIT licensed for inclusion here.

Various parts of Windows support were contributed by the WinObjC team at Microsoft.

Type-Dependent Dispatch

Traditionally, Objective-C method lookup is done entirely on the name of the method. This is problematic when the sender and receiver of the method disagree on the types of a method.

For example, consider a trivial case where you have two methods with the same name, one taking an integer, the other taking a floating point value. Both will pass their argument in a register on most platforms, but not the same register. If the sender thinks it is calling one, but is really calling the other, then the receiver will look in the wrong register and use a nonsense value. The compiler will often not warn about this.

This is a relatively benign example, but if the mismatch is between methods taking or returning a structure and those only using scalar arguments and return then the call frame layout will be so different that the result will be stack corruption, possibly leading to security holes.

If you compile the GNUstep runtime with type-dependent dispatch enabled, then sending a message with a typed selector will only ever invoke a method with the same types. Sending a message with an untyped selector will invoke any method with a matching name, although the slot returned from the lookup function will contain the types, allowing the caller to check them and construct a valid call frame, if required.

If a lookup with a typed selector matches a method with the wrong types, the runtime will call a handler. This handler, by default, prints a helpful message and exits. LanguageKit provides an alternative version which dynamically generates a new method performing the required boxing and calling the original.