From 652e1985a9e40ff40320e8318e75fb1c04b0f05a Mon Sep 17 00:00:00 2001 From: svenbarth Date: Sun, 18 Aug 2019 18:30:42 +0000 Subject: [PATCH] * implement thunking for x86_64 SysV ABI targets git-svn-id: trunk@42734 - --- packages/rtl-objpas/src/inc/rtti.pp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/rtl-objpas/src/inc/rtti.pp b/packages/rtl-objpas/src/inc/rtti.pp index c34dee1979..7436f63b3d 100644 --- a/packages/rtl-objpas/src/inc/rtti.pp +++ b/packages/rtl-objpas/src/inc/rtti.pp @@ -863,7 +863,7 @@ asm jmp %eax RawThunkEnd: end; -{$elseif defined(cpux86_64) and defined(win64)} +{$elseif defined(cpux86_64)} const RawThunkPlaceholderProc = PtrUInt($8765876587658765); RawThunkPlaceholderContext = PtrUInt($4321432143214321); @@ -872,6 +872,7 @@ type TRawThunkProc = PtrUInt; TRawThunkContext = PtrUInt; +{$ifdef win64} procedure RawThunk; assembler; nostackframe; asm { Self is always in register RCX } @@ -880,6 +881,16 @@ asm jmp %rax RawThunkEnd: end; +{$else} +procedure RawThunk; assembler; nostackframe; +asm + { Self is always in register RDI } + movl RawThunkPlaceholderContext, %rdi + movl RawThunkPlaceholderProc, %rax + jmp %rax +RawThunkEnd: +end; +{$endif} {$endif} {$if declared(RawThunk)}