Skip to content

Commit 81b8d07

Browse files
committed
[CPPRT] Add cpprt for GCC, tool
- Link it to libsup++ - Add __cxa_pure_virtual
1 parent ea87f91 commit 81b8d07

File tree

4 files changed

+36
-14
lines changed

4 files changed

+36
-14
lines changed

sdk/cmake/gcc.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,5 +601,4 @@ target_compile_definitions(libstdc++ INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:PAL_ST
601601

602602
# Create our alias libraries
603603
add_library(cppstl ALIAS libstdc++)
604-
add_library(cpprt ALIAS libsupc++)
605604

sdk/lib/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ add_subdirectory(conutils)
1313
add_subdirectory(cportlib)
1414
add_subdirectory(crt)
1515
add_subdirectory(cryptlib)
16+
add_subdirectory(cpprt)
1617

1718
if(MSVC)
18-
add_subdirectory(cpprt)
1919
add_subdirectory(RunTmChk)
2020
else()
2121
add_subdirectory(gcc-compat)

sdk/lib/cpprt/CMakeLists.txt

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,30 @@ include_directories(
33
${REACTOS_SOURCE_DIR}/sdk/lib/crt/include
44
${REACTOS_SOURCE_DIR}/sdk/include/c++)
55

6-
list(APPEND SOURCE
7-
ehvec.cpp
8-
new_nothrow.cpp
9-
terminate.cpp
10-
typeinfo.cpp)
11-
12-
if(ARCH STREQUAL "i386")
13-
add_asm_files(cpprt_asm i386/cpprt.s)
14-
elseif(ARCH STREQUAL "amd64")
15-
add_asm_files(cpprt_asm amd64/cpprt.s)
16-
elseif(ARCH STREQUAL "arm")
17-
add_asm_files(cpprt_asm arm/cpprt.s)
6+
# We need different things, depending on the compiler
7+
if(MSVC)
8+
list(APPEND SOURCE
9+
ehvec.cpp
10+
new_nothrow.cpp
11+
terminate.cpp
12+
typeinfo.cpp)
13+
if(ARCH STREQUAL "i386")
14+
add_asm_files(cpprt_asm i386/cpprt.s)
15+
elseif(ARCH STREQUAL "amd64")
16+
add_asm_files(cpprt_asm amd64/cpprt.s)
17+
elseif(ARCH STREQUAL "arm")
18+
add_asm_files(cpprt_asm arm/cpprt.s)
19+
endif()
20+
else()
21+
list(APPEND SOURCE
22+
__cxa_pure_virtual.cpp)
1823
endif()
1924

2025
add_library(cpprt ${SOURCE} ${cpprt_asm})
2126
set_target_cpp_properties(cpprt WITH_EXCEPTIONS)
2227
add_dependencies(cpprt xdk)
28+
29+
# On GCC builds, we need to link against libsupc++
30+
if(NOT MSVC)
31+
target_link_libraries(cpprt libsupc++)
32+
endif()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* PROJECT: ReactOS C++ runtime library
3+
* LICENSE: MIT (https://spdx.org/licenses/MIT)
4+
* PURPOSE: __cxa_pure_virtual implementation
5+
* COPYRIGHT: Copyright 2024 Timo Kreuzer <[email protected]>
6+
*/
7+
8+
#include <intrin.h>
9+
10+
extern "C" void __cxa_pure_virtual(void)
11+
{
12+
__debugbreak();
13+
}

0 commit comments

Comments
 (0)