From 5e7d51885f0a1062999ddaffc40bc73b26dd2c58 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 15 Jun 2013 14:27:33 -0700 Subject: [PATCH] Don't rely on cc1obj for Objective-C struct tables. --- .gitignore | 1 - Makefile.am | 8 -------- ObjectiveC/Library.mm | 16 ++++++++++++---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 159fb21..a324699 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,5 @@ lex.cy.cpp cycript Trampoline.t.hpp Bridge.hpp -Struct.hpp package aclocal.m4 diff --git a/Makefile.am b/Makefile.am index fc22872..205c1c8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 $@ endif if CY_MACH diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index f4a72d7..f0e6b20 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -19,10 +19,6 @@ **/ /* }}} */ -#ifdef __APPLE__ -#include "Struct.hpp" -#endif - #include #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 || -- 2.47.2