]> git.saurik.com Git - cycript.git/commitdiff
Don't rely on cc1obj for Objective-C struct tables.
authorJay Freeman (saurik) <saurik@saurik.com>
Sat, 15 Jun 2013 21:27:33 +0000 (14:27 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Sat, 15 Jun 2013 21:27:33 +0000 (14:27 -0700)
.gitignore
Makefile.am
ObjectiveC/Library.mm

index 159fb219e79bdc616155012dcae67c4984d4ac05..a324699781dce559202a7bdb87b5f64af433095e 100644 (file)
@@ -27,6 +27,5 @@ lex.cy.cpp
 cycript
 Trampoline.t.hpp
 Bridge.hpp
-Struct.hpp
 package
 aclocal.m4
index fc2287288cfd8d846f9afffc8b39f0d8ce04b2cd..205c1c8e3322c93e751695c22be88414d25060a5 100644 (file)
@@ -49,14 +49,6 @@ endif
 if CY_OBJECTIVEC
 filters += ObjectiveC
 libcycript_la_SOURCES += ObjectiveC/Output.mm ObjectiveC/Replace.cpp ObjectiveC/Library.mm
-
-ObjectiveC/Library.lo: Struct.hpp
-
-# XXX: this is not architecture-specific... isn't this just totally wrong?!
-# XXX: clang doesn't support this feature... that makes me really very sad.
-CLEANFILES += Struct.hpp
-Struct.hpp:
-       $$($(OBJCXX) -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
 endif
 
 if CY_MACH
index f4a72d738cc4604b4e2dd6f433849b98848b0074..f0e6b20411ee4f1ad7c84e770b785c7256e91b95 100644 (file)
 **/
 /* }}} */
 
-#ifdef __APPLE__
-#include "Struct.hpp"
-#endif
-
 #include <Foundation/Foundation.h>
 
 #include "ObjectiveC/Internal.hpp"
@@ -2166,6 +2162,18 @@ static void ObjectiveC_Constants_getPropertyNames(JSContextRef context, JSObject
 }
 
 #ifdef __APPLE__
+#if defined(__i386__) || defined(__x86_64__)
+#define OBJC_MAX_STRUCT_BY_VALUE 8
+static int struct_forward_array[] = {
+    0, 0, 0, 1, 0, 1, 1, 1, 0 };
+#elif defined(__arm__)
+#define OBJC_MAX_STRUCT_BY_VALUE 1
+static int struct_forward_array[] = {
+    0, 0 };
+#else
+#error missing objc-runtime-info
+#endif
+
 static bool stret(ffi_type *ffi_type) {
     return ffi_type->type == FFI_TYPE_STRUCT && (
         ffi_type->size > OBJC_MAX_STRUCT_BY_VALUE ||