aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/objc-probes.h65
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/pure.nix118
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/spinlocks.patch107
4 files changed, 327 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/default.nix
new file mode 100644
index 000000000000..2fc4afa77d9f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/default.nix
@@ -0,0 +1,37 @@
+{ appleDerivation, darwin-stubs }:
+
+appleDerivation {
+ phases = [ "unpackPhase" "installPhase" ];
+
+ # Not strictly necessary, since libSystem depends on it, but it's nice to be explicit so we
+ # can easily find out what's impure.
+ __propagatedImpureHostDeps = [
+ "/usr/lib/libauto.dylib"
+ "/usr/lib/libc++abi.dylib"
+ "/usr/lib/libc++.1.dylib"
+ "/usr/lib/libSystem.B.dylib"
+ ];
+
+ installPhase = ''
+ mkdir -p $out/include/objc $out/lib
+ cp ${darwin-stubs}/usr/lib/libobjc.A.tbd $out/lib/libobjc.A.tbd
+ ln -s libobjc.A.tbd $out/lib/libobjc.tbd
+ cp runtime/OldClasses.subproj/List.h $out/include/objc/List.h
+ cp runtime/NSObjCRuntime.h $out/include/objc/NSObjCRuntime.h
+ cp runtime/NSObject.h $out/include/objc/NSObject.h
+ cp runtime/Object.h $out/include/objc/Object.h
+ cp runtime/Protocol.h $out/include/objc/Protocol.h
+ cp runtime/hashtable.h $out/include/objc/hashtable.h
+ cp runtime/hashtable2.h $out/include/objc/hashtable2.h
+ cp runtime/message.h $out/include/objc/message.h
+ cp runtime/objc-api.h $out/include/objc/objc-api.h
+ cp runtime/objc-auto.h $out/include/objc/objc-auto.h
+ cp runtime/objc-class.h $out/include/objc/objc-class.h
+ cp runtime/objc-exception.h $out/include/objc/objc-exception.h
+ cp runtime/objc-load.h $out/include/objc/objc-load.h
+ cp runtime/objc-runtime.h $out/include/objc/objc-runtime.h
+ cp runtime/objc-sync.h $out/include/objc/objc-sync.h
+ cp runtime/objc.h $out/include/objc/objc.h
+ cp runtime/runtime.h $out/include/objc/runtime.h
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/objc-probes.h b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/objc-probes.h
new file mode 100644
index 000000000000..4ad9ba9ad104
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/objc-probes.h
@@ -0,0 +1,65 @@
+/*
+ * Generated by dtrace(1M).
+ */
+
+#ifndef _OBJC_PROBES_H
+#define _OBJC_PROBES_H
+
+#include <unistd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define OBJC_RUNTIME_STABILITY "___dtrace_stability$objc_runtime$v1$1_1_0_1_1_0_1_1_0_1_1_0_1_1_0"
+
+#define OBJC_RUNTIME_TYPEDEFS "___dtrace_typedefs$objc_runtime$v2"
+
+#if !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED
+
+#define OBJC_RUNTIME_OBJC_EXCEPTION_RETHROW() \
+do { \
+ __asm__ volatile(".reference " OBJC_RUNTIME_TYPEDEFS); \
+ __dtrace_probe$objc_runtime$objc_exception_rethrow$v1(); \
+ __asm__ volatile(".reference " OBJC_RUNTIME_STABILITY); \
+} while (0)
+#define OBJC_RUNTIME_OBJC_EXCEPTION_RETHROW_ENABLED() \
+ ({ int _r = __dtrace_isenabled$objc_runtime$objc_exception_rethrow$v1(); \
+ __asm__ volatile(""); \
+ _r; })
+#define OBJC_RUNTIME_OBJC_EXCEPTION_THROW(arg0) \
+do { \
+ __asm__ volatile(".reference " OBJC_RUNTIME_TYPEDEFS); \
+ __dtrace_probe$objc_runtime$objc_exception_throw$v1$766f6964202a(arg0); \
+ __asm__ volatile(".reference " OBJC_RUNTIME_STABILITY); \
+} while (0)
+#define OBJC_RUNTIME_OBJC_EXCEPTION_THROW_ENABLED() \
+ ({ int _r = __dtrace_isenabled$objc_runtime$objc_exception_throw$v1(); \
+ __asm__ volatile(""); \
+ _r; })
+
+
+extern void __dtrace_probe$objc_runtime$objc_exception_rethrow$v1(void);
+extern int __dtrace_isenabled$objc_runtime$objc_exception_rethrow$v1(void);
+extern void __dtrace_probe$objc_runtime$objc_exception_throw$v1$766f6964202a(const void *);
+extern int __dtrace_isenabled$objc_runtime$objc_exception_throw$v1(void);
+
+#else
+
+#define OBJC_RUNTIME_OBJC_EXCEPTION_RETHROW() \
+do { \
+ } while (0)
+#define OBJC_RUNTIME_OBJC_EXCEPTION_RETHROW_ENABLED() (0)
+#define OBJC_RUNTIME_OBJC_EXCEPTION_THROW(arg0) \
+do { \
+ } while (0)
+#define OBJC_RUNTIME_OBJC_EXCEPTION_THROW_ENABLED() (0)
+
+#endif /* !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OBJC_PROBES_H */
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/pure.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/pure.nix
new file mode 100644
index 000000000000..6a0c819a0a31
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/pure.nix
@@ -0,0 +1,118 @@
+{ stdenv, fetchapplesource, libauto, launchd, libc_old, libunwind }:
+
+stdenv.mkDerivation rec {
+ version = "551.1";
+ pname = "objc4";
+
+ src = fetchapplesource {
+ inherit version;
+ name = "objc4";
+ sha256 = "1jrdb6yyb5jwwj27c1r0nr2y2ihqjln8ynj61mpkvp144c1cm5bg";
+ };
+
+ patches = [ ./spinlocks.patch ];
+
+ buildInputs = [ libauto launchd libc_old libunwind ];
+
+ buildPhase = ''
+ cp ${./objc-probes.h} runtime/objc-probes.h
+
+ mkdir -p build/include/objc
+
+ cp runtime/hashtable.h build/include/objc/hashtable.h
+ cp runtime/OldClasses.subproj/List.h build/include/objc/List.h
+ cp runtime/hashtable2.h build/include/objc/hashtable2.h
+ cp runtime/message.h build/include/objc/message.h
+ cp runtime/objc-api.h build/include/objc/objc-api.h
+ cp runtime/objc-auto.h build/include/objc/objc-auto.h
+ cp runtime/objc-class.h build/include/objc/objc-class.h
+ cp runtime/objc-exception.h build/include/objc/objc-exception.h
+ cp runtime/objc-load.h build/include/objc/objc-load.h
+ cp runtime/objc-sync.h build/include/objc/objc-sync.h
+ cp runtime/objc.h build/include/objc/objc.h
+ cp runtime/objc-runtime.h build/include/objc/objc-runtime.h
+ cp runtime/Object.h build/include/objc/Object.h
+ cp runtime/Protocol.h build/include/objc/Protocol.h
+ cp runtime/runtime.h build/include/objc/runtime.h
+ cp runtime/NSObject.h build/include/objc/NSObject.h
+ cp runtime/NSObjCRuntime.h build/include/objc/NSObjCRuntime.h
+
+ # These would normally be in local/include but we don't do local, so they're
+ # going in with the others
+ cp runtime/maptable.h build/include/objc/maptable.h
+ cp runtime/objc-abi.h build/include/objc/objc-abi.h
+ cp runtime/objc-auto-dump.h build/include/objc/objc-auto-dump.h
+ cp runtime/objc-gdb.h build/include/objc/objc-gdb.h
+ cp runtime/objc-internal.h build/include/objc/objc-internal.h
+
+ cc -o markgc markgc.c
+
+ FLAGS="-Wno-deprecated-register -Wno-unknown-pragmas -Wno-deprecated-objc-isa-usage -Wno-invalid-offsetof -Wno-inline-new-delete -Wno-cast-of-sel-type -Iruntime -Ibuild/include -Iruntime/Accessors.subproj -D_LIBCPP_VISIBLE= -DOS_OBJECT_USE_OBJC=0 -DNDEBUG=1"
+
+ cc -std=gnu++11 $FLAGS -c runtime/hashtable2.mm
+ cc -std=gnu++11 $FLAGS -c runtime/maptable.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-auto.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-cache.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-class-old.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-class.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-errors.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-exception.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-file.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-initialize.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-layout.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-load.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-loadmethod.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-lockdebug.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-runtime-new.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-runtime-old.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-runtime.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-sel-set.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-sel.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-sync.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-typeencoding.mm
+ cc -std=gnu++11 $FLAGS -c runtime/Object.mm
+ cc -std=gnu++11 $FLAGS -c runtime/Protocol.mm
+
+ cc -std=gnu++11 $FLAGS -c runtime/objc-references.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-os.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-auto-dump.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-file-old.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-block-trampolines.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-externalref.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-weak.mm
+ cc -std=gnu++11 $FLAGS -c runtime/NSObject.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-opt.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-cache-old.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-sel-old.mm
+
+ cc -std=gnu++11 $FLAGS -c runtime/Accessors.subproj/objc-accessors.mm
+
+ cc $FLAGS -c runtime/objc-sel-table.s
+
+ cc $FLAGS -c runtime/OldClasses.subproj/List.m
+ cc $FLAGS -c runtime/Messengers.subproj/objc-msg-arm.s
+ cc $FLAGS -c runtime/Messengers.subproj/objc-msg-i386.s
+ cc $FLAGS -c runtime/Messengers.subproj/objc-msg-x86_64.s
+ cc $FLAGS -c runtime/Messengers.subproj/objc-msg-simulator-i386.s
+
+ cc $FLAGS -c runtime/a1a2-blocktramps-i386.s
+ cc $FLAGS -c runtime/a2a3-blocktramps-i386.s
+
+ cc $FLAGS -c runtime/a1a2-blocktramps-x86_64.s
+ cc $FLAGS -c runtime/a2a3-blocktramps-x86_64.s
+
+ cc $FLAGS -c runtime/a1a2-blocktramps-arm.s
+ cc $FLAGS -c runtime/a2a3-blocktramps-arm.s
+
+ c++ -Wl,-no_dtrace_dof --stdlib=libc++ -dynamiclib -lauto -install_name $out/lib/libobjc.dylib -o libobjc.dylib *.o
+
+ ./markgc -p libobjc.dylib
+ '';
+
+ installPhase = ''
+ mkdir -p $out/include $out/lib
+
+ mv build/include/objc $out/include
+ mv libobjc.dylib $out/lib
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/spinlocks.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/spinlocks.patch
new file mode 100644
index 000000000000..50c6a983fe4d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/spinlocks.patch
@@ -0,0 +1,107 @@
+--- objc4-551.1/runtime/objc-os.h 2013-06-10 21:16:15.000000000 -0400
++++ ../objc4-551.1/runtime/objc-os.h 2015-01-19 01:01:36.000000000 -0500
+@@ -77,27 +77,72 @@
+ # include <mach-o/getsect.h>
+ # include <mach-o/dyld_priv.h>
+ # include <malloc/malloc.h>
+-# include <os/lock_private.h>
+ # include <libkern/OSAtomic.h>
+ # include <libkern/OSCacheControl.h>
+-# include <System/pthread_machdep.h>
+ # include "objc-probes.h" // generated dtrace probe definitions.
+
++#define __PTK_FRAMEWORK_OBJC_KEY5 45
++#define __PTK_FRAMEWORK_OBJC_KEY6 46
++#define __PTK_FRAMEWORK_OBJC_KEY7 47
++#define __PTK_FRAMEWORK_OBJC_KEY8 48
++#define __PTK_FRAMEWORK_OBJC_KEY9 49
++
++extern "C" int pthread_key_init_np(int, void (*)(void *));
++
+ // Some libc functions call objc_msgSend()
+ // so we can't use them without deadlocks.
+ void syslog(int, const char *, ...) UNAVAILABLE_ATTRIBUTE;
+ void vsyslog(int, const char *, va_list) UNAVAILABLE_ATTRIBUTE;
+
++#if defined(__i386__) || defined(__x86_64__)
++
++// Inlined spinlock.
++// Not for arm on iOS because it hurts uniprocessor performance.
++
++#define ARR_SPINLOCK_INIT 0
++// XXX -- Careful: OSSpinLock isn't volatile, but should be
++typedef volatile int ARRSpinLock;
++__attribute__((always_inline))
++static inline void ARRSpinLockLock(ARRSpinLock *l)
++{
++ unsigned y;
++again:
++ if (__builtin_expect(__sync_lock_test_and_set(l, 1), 0) == 0) {
++ return;
++ }
++ for (y = 1000; y; y--) {
++#if defined(__i386__) || defined(__x86_64__)
++ asm("pause");
++#endif
++ if (*l == 0) goto again;
++ }
++ thread_switch(THREAD_NULL, SWITCH_OPTION_DEPRESS, 1);
++ goto again;
++}
++__attribute__((always_inline))
++static inline void ARRSpinLockUnlock(ARRSpinLock *l)
++{
++ __sync_lock_release(l);
++}
++__attribute__((always_inline))
++static inline int ARRSpinLockTry(ARRSpinLock *l)
++{
++ return __sync_bool_compare_and_swap(l, 0, 1);
++}
++
++#define spinlock_t ARRSpinLock
++#define spinlock_trylock(l) ARRSpinLockTry(l)
++#define spinlock_lock(l) ARRSpinLockLock(l)
++#define spinlock_unlock(l) ARRSpinLockUnlock(l)
++#define SPINLOCK_INITIALIZER ARR_SPINLOCK_INIT
+
+-#define spinlock_t os_lock_handoff_s
+-#define spinlock_trylock(l) os_lock_trylock(l)
+-#define spinlock_lock(l) os_lock_lock(l)
+-#define spinlock_unlock(l) os_lock_unlock(l)
+-#define SPINLOCK_INITIALIZER OS_LOCK_HANDOFF_INIT
++#endif
+
+
+ #if !TARGET_OS_IPHONE
+-# include <CrashReporterClient.h>
++#define CRSetCrashLogMessage(msg)
++#define CRGetCrashLogMessage() 0
++#define CRSetCrashLogMessage2(msg)
+ #else
+ // CrashReporterClient not yet available on iOS
+ __BEGIN_DECLS
+@@ -594,21 +639,13 @@
+ {
+ assert(is_valid_direct_key(k));
+
+- if (_pthread_has_direct_tsd()) {
+- return _pthread_getspecific_direct(k);
+- } else {
+- return pthread_getspecific(k);
+- }
++ return pthread_getspecific(k);
+ }
+ static inline void tls_set_direct(tls_key_t k, void *value)
+ {
+ assert(is_valid_direct_key(k));
+
+- if (_pthread_has_direct_tsd()) {
+- _pthread_setspecific_direct(k, value);
+- } else {
+- pthread_setspecific(k, value);
+- }
++ pthread_setspecific(k, value);
+ }
+
+ // not arm