Skip to content

Commit

Permalink
fix objc_msgSend.*.S for win32/win64
Browse files Browse the repository at this point in the history
  • Loading branch information
DHowett committed Jan 22, 2018
1 parent 54c0c83 commit acd3fcc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion common.S
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if defined(__WIN32__) || defined(__APPLE__)
#if (defined(_WIN32) && defined(__i386__)) || defined(__APPLE__)
#define CDECL(symbol) _##symbol
#else
#define CDECL(symbol) symbol
Expand Down
8 changes: 7 additions & 1 deletion objc_msgSend.x86-32.S
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
push %ecx # _cmd
push %eax # &self
.cfi_def_cfa_offset 12
call slowMsgLookup@PLT
call CDECL(slowMsgLookup)@PLT
add $8, %esp # restore the stack


Expand All @@ -65,8 +65,14 @@
7:
popl %ebx;
8:
#if __ELF__
# ELF can support GOT-relative addressing;
# PE/COFF and Mach-O need a text relocation.
addl $_GLOBAL_OFFSET_TABLE_+(8b-7b), %ebx
leal SmallObjectClasses@GOTOFF(%ebx), %eax
#else
leal CDECL(SmallObjectClasses), %eax
#endif
mov (%eax), %eax
popl %ebx
jmp 1b
Expand Down
15 changes: 13 additions & 2 deletions objc_msgSend.x86-64.S
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,25 @@
jmp 1b
.cfi_endproc
.endm

#if !defined(_WIN32)
#define REG_ARG0 %rdi
#define REG_ARG1 %rsi
#define REG_ARG2 %rdx
#else
#define REG_ARG0 %rcx
#define REG_ARG1 %rdx
#define REG_ARG2 %r8
#endif

.globl CDECL(objc_msgSend)
TYPE_DIRECTIVE(CDECL(objc_msgSend), @function)
.globl CDECL(objc_msgSend_fpret)
TYPE_DIRECTIVE(CDECL(objc_msgSend_fpret), @function)
CDECL(objc_msgSend_fpret):
CDECL(objc_msgSend):
MSGSEND %rdi, %rsi
MSGSEND REG_ARG0, REG_ARG1
.globl CDECL(objc_msgSend_stret)
TYPE_DIRECTIVE(CDECL(objc_msgSend_stret), @function)
CDECL(objc_msgSend_stret):
MSGSEND %rsi, %rdx
MSGSEND REG_ARG1, REG_ARG2

0 comments on commit acd3fcc

Please sign in to comment.