https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ce848e5c11f435f045b67…
commit ce848e5c11f435f045b6709dac39de496e6e434d
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Thu Sep 24 07:49:16 2020 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Wed Aug 23 20:43:53 2023 +0300
[CPPRT][CRT][MSVCRT] Move __CxxFrameHandler3 to crt and export it on NT6
Previously it was in cpprt, which is a support library for C++, containing functions
that are not exported by msvcrt. But since Vista __CxxFrameHandler3 is exported by msvcrt.
Therefore move it to crt, and to satisfy pre-Vista configurations, also add it to
msvcrtex.
---
dll/win32/msvcrt/msvcrt.spec | 3 ++-
sdk/lib/cpprt/CMakeLists.txt | 1 -
sdk/lib/cpprt/amd64/cpprt.s | 3 ---
sdk/lib/cpprt/i386/cpprt.s | 17 --------------
sdk/lib/crt/except/amd64/__CxxFrameHandler3.s | 15 +++++++++++++
sdk/lib/crt/except/except.cmake | 4 ++++
.../except/i386/CxxHandleV8Frame.c} | 0
sdk/lib/crt/except/i386/__CxxFrameHandler3.s | 26 ++++++++++++++++++++++
sdk/lib/crt/msvcrtex.cmake | 11 +++++++++
9 files changed, 58 insertions(+), 22 deletions(-)
diff --git a/dll/win32/msvcrt/msvcrt.spec b/dll/win32/msvcrt/msvcrt.spec
index edff9b16392..0d5ab41eeee 100644
--- a/dll/win32/msvcrt/msvcrt.spec
+++ b/dll/win32/msvcrt/msvcrt.spec
@@ -241,7 +241,8 @@
@ cdecl -arch=i386 -norelay __CxxFrameHandler2(ptr ptr ptr ptr) __CxxFrameHandler
@ cdecl -version=0x600+ -arch=x86_64 -norelay __CxxFrameHandler2(ptr ptr ptr ptr)
__CxxFrameHandler
@ cdecl -arch=arm -norelay __CxxFrameHandler3(ptr ptr ptr ptr)
-#@ cdecl -version=0x600+ -arch=i386,x86_64 -norelay -private __CxxFrameHandler3(ptr ptr
ptr ptr) # Commented out for now, as it causes linker errors
+@ cdecl -version=0x600+ -arch=i386 -norelay __CxxFrameHandler3(ptr ptr ptr ptr)
+@ cdecl -version=0x600+ -arch=x86_64 -norelay __CxxFrameHandler3(ptr ptr ptr ptr)
__CxxFrameHandler
@ stdcall -arch=i386 __CxxLongjmpUnwind(ptr)
@ cdecl -arch=i386 __CxxQueryExceptionSize()
@ cdecl -arch=i386 __CxxRegisterExceptionObject()
diff --git a/sdk/lib/cpprt/CMakeLists.txt b/sdk/lib/cpprt/CMakeLists.txt
index 7db6f5c1ea4..94632d39ea5 100644
--- a/sdk/lib/cpprt/CMakeLists.txt
+++ b/sdk/lib/cpprt/CMakeLists.txt
@@ -11,7 +11,6 @@ list(APPEND SOURCE
if(ARCH STREQUAL "i386")
add_asm_files(cpprt_asm i386/cpprt.s)
- list(APPEND SOURCE i386/framehandler.c)
elseif(ARCH STREQUAL "amd64")
add_asm_files(cpprt_asm amd64/cpprt.s)
elseif(ARCH STREQUAL "arm")
diff --git a/sdk/lib/cpprt/amd64/cpprt.s b/sdk/lib/cpprt/amd64/cpprt.s
index 36c09fb80d8..aaf839ac991 100644
--- a/sdk/lib/cpprt/amd64/cpprt.s
+++ b/sdk/lib/cpprt/amd64/cpprt.s
@@ -19,9 +19,6 @@ DEFINE_ALIAS ??_M@YAXPEAX_K1P6AX0@Z@Z,
?MSVCRTEX_eh_vector_destructor_iterator@@
; void __cdecl `eh vector destructor iterator'(void * __ptr64,unsigned
__int64,int,void (__cdecl*)(void * __ptr64))
DEFINE_ALIAS ??_M@YAXPEAX_KHP6AX0@Z@Z,
?MSVCRTEX_eh_vector_destructor_iterator@@YAXPEAX_KHP6AX0@Z@Z
-; These are the same
-DEFINE_ALIAS __CxxFrameHandler3, __CxxFrameHandler
-
; void __cdecl operator delete(void * __ptr64,struct std::nothrow_t const & __ptr64)
DEFINE_ALIAS ??3@YAXPEAXAEBUnothrow_t@std@@@Z, ??3@YAXPEAX@Z
diff --git a/sdk/lib/cpprt/i386/cpprt.s b/sdk/lib/cpprt/i386/cpprt.s
index eeaf87f5d6a..b2c4832b0da 100644
--- a/sdk/lib/cpprt/i386/cpprt.s
+++ b/sdk/lib/cpprt/i386/cpprt.s
@@ -7,23 +7,6 @@ EXTERN &orig : PROC
ALIAS <&alias> = <&orig>
ENDM
-EXTERN _CxxHandleV8Frame@20 : PROC
-PUBLIC ___CxxFrameHandler3
-___CxxFrameHandler3:
- push eax
- push dword ptr [esp + 20]
- push dword ptr [esp + 20]
- push dword ptr [esp + 20]
- push dword ptr [esp + 20]
- call _CxxHandleV8Frame@20
- ret
-
-EXTERN ___CxxFrameHandler : PROC
-PUBLIC _CallCxxFrameHandler
-_CallCxxFrameHandler:
- mov eax, dword ptr [esp + 20]
- jmp ___CxxFrameHandler
-
; void __stdcall `eh vector constructor iterator'(void *,unsigned int,int,void
(__thiscall*)(void *),void (__thiscall*)(void *))
DEFINE_ALIAS ??_L@YGXPAXIHP6EX0@Z1@Z,
?MSVCRTEX_eh_vector_constructor_iterator@@YGXPAXIHP6EX0@Z1@Z
diff --git a/sdk/lib/crt/except/amd64/__CxxFrameHandler3.s
b/sdk/lib/crt/except/amd64/__CxxFrameHandler3.s
new file mode 100644
index 00000000000..a41cb2b9cdc
--- /dev/null
+++ b/sdk/lib/crt/except/amd64/__CxxFrameHandler3.s
@@ -0,0 +1,15 @@
+
+#include <asm.inc>
+
+.code64
+.align 4
+
+MACRO(DEFINE_ALIAS, alias, orig)
+EXTERN &orig : PROC
+ALIAS <&alias> = <&orig>
+ENDM
+
+; These are the same
+DEFINE_ALIAS __CxxFrameHandler3, __CxxFrameHandler
+
+END
diff --git a/sdk/lib/crt/except/except.cmake b/sdk/lib/crt/except/except.cmake
index 418bbcdeb9b..656853c097c 100644
--- a/sdk/lib/crt/except/except.cmake
+++ b/sdk/lib/crt/except/except.cmake
@@ -4,9 +4,13 @@ if(ARCH STREQUAL "i386")
except/i386/chkstk_asm.s
)
list(APPEND CRT_EXCEPT_ASM_SOURCE
+ except/i386/__CxxFrameHandler3.s
except/i386/chkesp.s
except/i386/prolog.s
)
+ list(APPEND CRT_EXCEPT_SOURCE
+ except/i386/CxxHandleV8Frame.c
+ )
if(MSVC)
list(APPEND CRT_EXCEPT_ASM_SOURCE
except/i386/cpp.s)
diff --git a/sdk/lib/cpprt/i386/framehandler.c
b/sdk/lib/crt/except/i386/CxxHandleV8Frame.c
similarity index 100%
rename from sdk/lib/cpprt/i386/framehandler.c
rename to sdk/lib/crt/except/i386/CxxHandleV8Frame.c
diff --git a/sdk/lib/crt/except/i386/__CxxFrameHandler3.s
b/sdk/lib/crt/except/i386/__CxxFrameHandler3.s
new file mode 100644
index 00000000000..580fae2ad05
--- /dev/null
+++ b/sdk/lib/crt/except/i386/__CxxFrameHandler3.s
@@ -0,0 +1,26 @@
+
+
+#include <asm.inc>
+
+.code
+.align 4
+
+EXTERN _CxxHandleV8Frame@20 : PROC
+PUBLIC ___CxxFrameHandler3
+___CxxFrameHandler3:
+ push eax
+ push dword ptr [esp + 20]
+ push dword ptr [esp + 20]
+ push dword ptr [esp + 20]
+ push dword ptr [esp + 20]
+ call _CxxHandleV8Frame@20
+ ret
+
+EXTERN ___CxxFrameHandler : PROC
+PUBLIC _CallCxxFrameHandler
+_CallCxxFrameHandler:
+ mov eax, dword ptr [esp + 20]
+ jmp ___CxxFrameHandler
+
+END
+
diff --git a/sdk/lib/crt/msvcrtex.cmake b/sdk/lib/crt/msvcrtex.cmake
index d7a513012b4..4ecfd4db6f8 100644
--- a/sdk/lib/crt/msvcrtex.cmake
+++ b/sdk/lib/crt/msvcrtex.cmake
@@ -36,9 +36,20 @@ if(ARCH STREQUAL "i386")
list(APPEND MSVCRTEX_SOURCE
math/i386/sqrtf.c)
endif()
+ if(MSVC AND DLL_EXPORT_VERSION LESS 0x600)
+ list(APPEND MSVCRTEX_ASM_SOURCE
+ except/i386/__CxxFrameHandler3.s)
+ list(APPEND MSVCRTEX_SOURCE
+ except/i386/CxxHandleV8Frame.c)
+ endif()
elseif(ARCH STREQUAL "amd64")
list(APPEND MSVCRTEX_ASM_SOURCE
except/amd64/chkstk_ms.s)
+ if(MSVC AND DLL_EXPORT_VERSION LESS 0x600)
+ list(APPEND MSVCRTEX_ASM_SOURCE
+ except/amd64/__CxxFrameHandler3.s
+ )
+ endif()
elseif(ARCH STREQUAL "arm")
list(APPEND MSVCRTEX_SOURCE
math/arm/__rt_sdiv.c