From 010ae1d2c90bfb03b5d3acf2fb91bd105d20e24a Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 28 Aug 2019 08:05:38 -0700 Subject: [PATCH] [runtime] Fix usage of objc_msgSend[Super] according to modified headers. (#6865) It's now required to cast objc_msgSend[Super] to a function of the correct signature, so let's do that. Also remove the define that allowed us to use the previous behavior. --- mk/rules.mk | 4 ++-- runtime/Makefile | 4 ++-- runtime/monotouch-support.h | 4 ++-- runtime/trampolines.m | 3 ++- runtime/xamarin-support.m | 8 ++++---- tools/mmp/Makefile | 2 +- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/mk/rules.mk b/mk/rules.mk index 6ff84812a5..0138c516e2 100644 --- a/mk/rules.mk +++ b/mk/rules.mk @@ -162,8 +162,8 @@ define NativeCompilationTemplate $$(call Q_2,LD, [tvos]) $(DEVICE_CC) $(DEVICETV_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -F$(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/Frameworks -fapplication-extension endef -$(eval $(call NativeCompilationTemplate,,-O2 -DOBJC_OLD_DISPATCH_PROTOTYPES=1)) -$(eval $(call NativeCompilationTemplate,-debug,-DDEBUG -DOBJC_OLD_DISPATCH_PROTOTYPES=1)) +$(eval $(call NativeCompilationTemplate,,-O2)) +$(eval $(call NativeCompilationTemplate,-debug,-DDEBUG)) .libs/ios .libs/watchos .libs/tvos: $(Q) mkdir -p $@ diff --git a/runtime/Makefile b/runtime/Makefile index a2caabe1de..eeb049355a 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -482,8 +482,8 @@ SYSTEM_LAUNCHER$(2)_OBJECTS = $$(foreach src,$$(MAC_SOURCES),.libs/mac/$$(basena endef -$(eval $(call ObjTemplate,x86_64,64,,-DOBJC_OLD_DISPATCH_PROTOTYPES=1,64)) -$(eval $(call ObjTemplate,x86_64,DEBUG64,-debug,-DDEBUG -DOBJC_OLD_DISPATCH_PROTOTYPES=1,64)) +$(eval $(call ObjTemplate,x86_64,64,,,64)) +$(eval $(call ObjTemplate,x86_64,DEBUG64,-debug,-DDEBUG,64)) $(foreach arch,$(MAC_ARCHITECTURES),.libs/mac/extension-main.$(arch).o): EXTRA_DEFINES=-DEXTENSION diff --git a/runtime/monotouch-support.h b/runtime/monotouch-support.h index 44c58a6338..845bebcc00 100644 --- a/runtime/monotouch-support.h +++ b/runtime/monotouch-support.h @@ -16,8 +16,8 @@ const char * xamarin_GetFolderPath (int folder); #endif #if defined (__arm64__) -void objc_msgSend_stret (id self, SEL op, ...); -void objc_msgSendSuper_stret (struct objc_super *super, SEL op, ...); +void objc_msgSend_stret (void); +void objc_msgSendSuper_stret (void); #endif #ifdef __cplusplus diff --git a/runtime/trampolines.m b/runtime/trampolines.m index b5dd3622e7..7a61b90d90 100644 --- a/runtime/trampolines.m +++ b/runtime/trampolines.m @@ -383,7 +383,8 @@ xamarin_invoke_objc_method_implementation (id self, SEL sel, IMP xamarin_impl) // COOP: does not access managed memory: any mode struct objc_super sup; find_objc_method_implementation (&sup, self, sel, xamarin_impl); - return objc_msgSendSuper (&sup, sel); + typedef id (*func_objc_msgSendSuper) (struct objc_super *sup, SEL sel); + return ((func_objc_msgSendSuper) objc_msgSendSuper) (&sup, sel); } #if MONOMAC diff --git a/runtime/xamarin-support.m b/runtime/xamarin-support.m index dcce6463fe..72dc38e7ae 100644 --- a/runtime/xamarin-support.m +++ b/runtime/xamarin-support.m @@ -158,15 +158,15 @@ xamarin_GetFolderPath (int folder) // it impossible to disable dlsym and, for example, run dontlink on devices // https://bugzilla.xamarin.com/show_bug.cgi?id=36569#c4 -void objc_msgSend_stret (id self, SEL op, ...) +void objc_msgSend_stret (void) { - PRINT ("Unimplemented objc_msgSend_stret %s", sel_getName (op)); + PRINT ("Unimplemented objc_msgSend_stret"); abort (); } -void objc_msgSendSuper_stret (struct objc_super *super, SEL op, ...) +void objc_msgSendSuper_stret (void) { - PRINT ("Unimplemented objc_msgSendSuper_stret %s", sel_getName (op)); + PRINT ("Unimplemented objc_msgSendSuper_stret"); abort (); } diff --git a/tools/mmp/Makefile b/tools/mmp/Makefile index c93672401b..75adf6cfa5 100644 --- a/tools/mmp/Makefile +++ b/tools/mmp/Makefile @@ -60,7 +60,7 @@ Xamarin.Mac.registrar.full.x86_64.m: $(TOP)/src/build/mac/full-64/Xamarin.Mac. $(Q) touch Xamarin.Mac.registrar.full.x86_64.m Xamarin.Mac.registrar.full.x86_64.h Xamarin.Mac.registrar.%.x86_64.a: Xamarin.Mac.registrar.%.x86_64.m - $(Q_CC) xcrun -sdk macosx clang -DDEBUG -DOBJC_OLD_DISPATCH_PROTOTYPES=1 -g -gdwarf-2 -x objective-c++ -stdlib=libc++ -o $@ -c -arch x86_64 $< -Wall -Wno-unguarded-availability-new -I$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/include -mmacosx-version-min=$(MIN_OSX_SDK_VERSION) -fobjc-runtime=macosx + $(Q_CC) xcrun -sdk macosx clang -DDEBUG -g -gdwarf-2 -x objective-c++ -stdlib=libc++ -o $@ -c -arch x86_64 $< -Wall -Wno-unguarded-availability-new -I$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/include -mmacosx-version-min=$(MIN_OSX_SDK_VERSION) -fobjc-runtime=macosx Xamarin.Mac.registrar.%.a: Xamarin.Mac.registrar.%.x86_64.a $(Q_LIPO) $(DEVICE_BIN_PATH)/lipo -create -output $@ $^