From 93248d581b1e4bf18b24092427055a9d3ebe649b Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Fri, 14 Sep 2018 15:32:16 +0100 Subject: [PATCH] Allow double indirection for superclass pointers. --- class_table.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/class_table.c b/class_table.c index 0025920..c3d85de 100644 --- a/class_table.c +++ b/class_table.c @@ -422,6 +422,20 @@ PRIVATE void objc_load_class(struct objc_class *class) return; } +#ifdef _WIN32 + // On Windows, the super_class pointer may point to the local __imp_ + // symbol, rather than to the external symbol. The runtime must remove the + // extra indirection. + if (class->super_class) + { + Class superMeta = class->super_class->isa; + if (!class_isMetaClass(superMeta)) + { + class->super_class = superMeta; + } + } +#endif + // Work around a bug in some versions of GCC that don't initialize the // class structure correctly. class->subclass_list = NULL;