From 537c409722aaa6ed9d4ef865fef3177a6b04522c Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Wed, 1 Aug 2018 13:31:10 +0100 Subject: [PATCH] Tweak objc_msgSend to work correctly on win32. --- objc_msgSend.S | 5 ----- objc_msgSend.x86-32.S | 30 ++++++++++++++++++++++++++++++ objc_msgSend.x86-64.S | 4 ++++ 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/objc_msgSend.S b/objc_msgSend.S index 57eb90c..cbce6a0 100644 --- a/objc_msgSend.S +++ b/objc_msgSend.S @@ -15,9 +15,4 @@ #endif #ifdef __ELF__ .section .note.GNU-stack,"",%progbits -#elif defined(_WIN32) -.section .drectve,"yn" -.ascii " /EXPORT:objc_msgSend" -.ascii " /EXPORT:objc_msgSend_fpret" -.ascii " /EXPORT:objc_msgSend_stret" #endif diff --git a/objc_msgSend.x86-32.S b/objc_msgSend.x86-32.S index 7d83a4c..3c3b113 100644 --- a/objc_msgSend.x86-32.S +++ b/objc_msgSend.x86-32.S @@ -78,6 +78,29 @@ jmp 1b .cfi_endproc .endm + +#ifdef _WIN32 +.text +.def @feat.00; +.scl 3; +.type 0; +.endef +.globl @feat.00 +@feat.00 = 1 +.def _objc_msgSend; +.scl 2; +.type 32; +.endef +.def _objc_msgSend_fpret; +.scl 2; +.type 32; +.endef +.def _objc_msgSend_stret; +.scl 2; +.type 32; +.endef +#endif + .globl CDECL(objc_msgSend_fpret) TYPE_DIRECTIVE(CDECL(objc_msgSend_fpret), @function) CDECL(objc_msgSend_fpret): @@ -90,3 +113,10 @@ CDECL(objc_msgSend): TYPE_DIRECTIVE(CDECL(objc_msgSend_stret), @function) CDECL(objc_msgSend_stret): MSGSEND 8, 12, 0 + +#ifdef _WIN32 + .section .drectve,"yn" + .ascii " /EXPORT:_objc_msgSend" + .ascii " /EXPORT:_objc_msgSend_stret" + .ascii " /EXPORT:_objc_msgSend_fpret" +#endif diff --git a/objc_msgSend.x86-64.S b/objc_msgSend.x86-64.S index 2f63d60..cffb42b 100644 --- a/objc_msgSend.x86-64.S +++ b/objc_msgSend.x86-64.S @@ -289,6 +289,10 @@ CDECL(objc_msgSend): TYPE_DIRECTIVE(CDECL(objc_msgSend_stret), @function) CDECL(objc_msgSend_stret): MSGSEND objc_msgSend_stret, %rdx, %r8 +.section .drectve,"yn" +.ascii " /EXPORT:objc_msgSend" +.ascii " /EXPORT:objc_msgSend_fpret" +.ascii " /EXPORT:objc_msgSend_stret" #else .globl CDECL(objc_msgSend) TYPE_DIRECTIVE(CDECL(objc_msgSend), @function)