https://git.reactos.org/?p=reactos.git;a=commitdiff;h=81b8d07acd653c2a14a13…
commit 81b8d07acd653c2a14a13cd8e1aac3dcf4ec20c6
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sat Oct 19 13:57:29 2024 +0300
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Thu Oct 24 18:39:50 2024 +0300
[CPPRT] Add cpprt for GCC, tool
- Link it to libsup++
- Add __cxa_pure_virtual
---
sdk/cmake/gcc.cmake | 1 -
sdk/lib/CMakeLists.txt | 2 +-
sdk/lib/cpprt/CMakeLists.txt | 34 ++++++++++++++++++++++------------
sdk/lib/cpprt/__cxa_pure_virtual.cpp | 13 +++++++++++++
4 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/sdk/cmake/gcc.cmake b/sdk/cmake/gcc.cmake
index cecbd895cd4..1cac600cf6f 100644
--- a/sdk/cmake/gcc.cmake
+++ b/sdk/cmake/gcc.cmake
@@ -601,5 +601,4 @@ target_compile_definitions(libstdc++ INTERFACE
"$<$<COMPILE_LANGUAGE:CXX>:PAL_ST
# Create our alias libraries
add_library(cppstl ALIAS libstdc++)
-add_library(cpprt ALIAS libsupc++)
diff --git a/sdk/lib/CMakeLists.txt b/sdk/lib/CMakeLists.txt
index 7c751ab8976..34dc04870fd 100644
--- a/sdk/lib/CMakeLists.txt
+++ b/sdk/lib/CMakeLists.txt
@@ -13,9 +13,9 @@ add_subdirectory(conutils)
add_subdirectory(cportlib)
add_subdirectory(crt)
add_subdirectory(cryptlib)
+add_subdirectory(cpprt)
if(MSVC)
- add_subdirectory(cpprt)
add_subdirectory(RunTmChk)
else()
add_subdirectory(gcc-compat)
diff --git a/sdk/lib/cpprt/CMakeLists.txt b/sdk/lib/cpprt/CMakeLists.txt
index 94632d39ea5..ab3a0251338 100644
--- a/sdk/lib/cpprt/CMakeLists.txt
+++ b/sdk/lib/cpprt/CMakeLists.txt
@@ -3,20 +3,30 @@ include_directories(
${REACTOS_SOURCE_DIR}/sdk/lib/crt/include
${REACTOS_SOURCE_DIR}/sdk/include/c++)
-list(APPEND SOURCE
- ehvec.cpp
- new_nothrow.cpp
- terminate.cpp
- typeinfo.cpp)
-
-if(ARCH STREQUAL "i386")
- add_asm_files(cpprt_asm i386/cpprt.s)
-elseif(ARCH STREQUAL "amd64")
- add_asm_files(cpprt_asm amd64/cpprt.s)
-elseif(ARCH STREQUAL "arm")
- add_asm_files(cpprt_asm arm/cpprt.s)
+# We need different things, depending on the compiler
+if(MSVC)
+ list(APPEND SOURCE
+ ehvec.cpp
+ new_nothrow.cpp
+ terminate.cpp
+ typeinfo.cpp)
+ if(ARCH STREQUAL "i386")
+ add_asm_files(cpprt_asm i386/cpprt.s)
+ elseif(ARCH STREQUAL "amd64")
+ add_asm_files(cpprt_asm amd64/cpprt.s)
+ elseif(ARCH STREQUAL "arm")
+ add_asm_files(cpprt_asm arm/cpprt.s)
+ endif()
+else()
+ list(APPEND SOURCE
+ __cxa_pure_virtual.cpp)
endif()
add_library(cpprt ${SOURCE} ${cpprt_asm})
set_target_cpp_properties(cpprt WITH_EXCEPTIONS)
add_dependencies(cpprt xdk)
+
+# On GCC builds, we need to link against libsupc++
+if(NOT MSVC)
+ target_link_libraries(cpprt libsupc++)
+endif()
diff --git a/sdk/lib/cpprt/__cxa_pure_virtual.cpp b/sdk/lib/cpprt/__cxa_pure_virtual.cpp
new file mode 100644
index 00000000000..229690d9431
--- /dev/null
+++ b/sdk/lib/cpprt/__cxa_pure_virtual.cpp
@@ -0,0 +1,13 @@
+/*
+ * PROJECT: ReactOS C++ runtime library
+ * LICENSE: MIT (
https://spdx.org/licenses/MIT)
+ * PURPOSE: __cxa_pure_virtual implementation
+ * COPYRIGHT: Copyright 2024 Timo Kreuzer <timo.kreuzer(a)reactos.org>
+ */
+
+#include <intrin.h>
+
+extern "C" void __cxa_pure_virtual(void)
+{
+ __debugbreak();
+}