mirror of
https://github.com/reactos/reactos.git
synced 2025-06-15 12:49:14 +00:00
[VCRUNTIME][VCSTARTUP] Add separate vcruntime and vcstartup lib
vcruntime contains the code that is linked into ucrtbase (in VS it is also provided as vcruntime140.dll) vcstartup contains the code that is statically linked into executables that link to ucrtbase.dll. In Visual Studio this is part of msvcrt.lib (the import library for msvcrt), similar to our current msvcrtex, and it gets linked when you link to ucrtbase as well. The name is based on the folder name in the library. Both libraries share some code, but each file is only compiled once.
This commit is contained in:
parent
2b2bdabe72
commit
9186b861a6
21 changed files with 79 additions and 26 deletions
|
@ -21,9 +21,13 @@ set_entrypoint(ucrtbase __acrt_DllMain 12)
|
|||
target_link_libraries(ucrtbase
|
||||
ucrt
|
||||
ucrtsupport
|
||||
vcruntime
|
||||
wine
|
||||
)
|
||||
|
||||
# Implicitly link to vcstartup
|
||||
target_link_libraries(libucrtbase vcstartup)
|
||||
|
||||
if(MSVC)
|
||||
target_link_libraries(ucrtbase runtmchk)
|
||||
else()
|
||||
|
|
|
@ -55,6 +55,7 @@ add_subdirectory(tzlib)
|
|||
add_subdirectory(ucrt)
|
||||
add_subdirectory(udmihelp)
|
||||
add_subdirectory(uuid)
|
||||
add_subdirectory(vcruntime)
|
||||
add_subdirectory(wdmguid)
|
||||
|
||||
else()
|
||||
|
|
|
@ -102,7 +102,6 @@ include(stdio/stdio.cmake)
|
|||
include(stdlib/stdlib.cmake)
|
||||
include(string/string.cmake)
|
||||
include(time/time.cmake)
|
||||
include(vcruntime/vcruntime.cmake)
|
||||
|
||||
add_library(ucrt OBJECT
|
||||
${UCRT_CONIO_SOURCES}
|
||||
|
@ -128,5 +127,5 @@ add_library(ucrt OBJECT
|
|||
${UCRT_VCRUNTIME_SOURCES}
|
||||
)
|
||||
|
||||
#target_link_libraries(ucrt pseh)
|
||||
target_link_libraries(ucrt vcruntime)
|
||||
add_dependencies(ucrt psdk asm)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
list(APPEND UCRT_FLOAT_SOURCES
|
||||
float/_fltused.c
|
||||
# TBD
|
||||
)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
list(APPEND UCRT_STARTUP_SOURCES
|
||||
startup/__scrt_uninitialize_crt.cpp
|
||||
startup/abort.cpp
|
||||
startup/argv_data.cpp
|
||||
startup/argv_parsing.cpp
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
|
||||
list(APPEND UCRT_VCRUNTIME_SOURCES
|
||||
vcruntime/__report_gsfailure.c
|
||||
vcruntime/__report_rangecheckfailure.c
|
||||
vcruntime/__security_init_cookie.c
|
||||
vcruntime/__vcrt_init.c
|
||||
vcruntime/initializers.cpp
|
||||
vcruntime/isa_available.cpp
|
||||
)
|
||||
|
||||
if(${ARCH} STREQUAL "i386")
|
||||
list(APPEND UCRT_VCRUNTIME_SOURCES
|
||||
vcruntime/i386/__security_check_cookie.s
|
||||
)
|
||||
elseif(${ARCH} STREQUAL "amd64")
|
||||
list(APPEND UCRT_VCRUNTIME_SOURCES
|
||||
vcruntime/amd64/__security_check_cookie.s
|
||||
)
|
||||
endif()
|
71
sdk/lib/vcruntime/CMakeLists.txt
Normal file
71
sdk/lib/vcruntime/CMakeLists.txt
Normal file
|
@ -0,0 +1,71 @@
|
|||
|
||||
# Replace the old CRT include directory with the UCRT include directory
|
||||
get_property(INCLUDE_DIRS DIRECTORY . PROPERTY INCLUDE_DIRECTORIES)
|
||||
list(REMOVE_ITEM INCLUDE_DIRS "${REACTOS_SOURCE_DIR}/sdk/include/crt")
|
||||
set_property(DIRECTORY . PROPERTY INCLUDE_DIRECTORIES ${INCLUDE_DIRS})
|
||||
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/ucrt)
|
||||
|
||||
include_directories(inc)
|
||||
|
||||
# Silence GCC/Clang warnings
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
|
||||
CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
add_compile_options(
|
||||
-Wno-builtin-declaration-mismatch
|
||||
-Wno-unused-function
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND VCRT_COMMON_SOURCES
|
||||
__report_gsfailure.c
|
||||
__report_rangecheckfailure.c
|
||||
__security_init_cookie.c
|
||||
__vcrt_init.c
|
||||
_fltused.c
|
||||
initializers.cpp
|
||||
isa_available.cpp
|
||||
)
|
||||
|
||||
list(APPEND VCRT_RUNTIME_SOURCES
|
||||
# TBD
|
||||
)
|
||||
|
||||
list(APPEND VCRT_STARTUP_SOURCES
|
||||
__scrt_uninitialize_crt.cpp
|
||||
)
|
||||
|
||||
if(${ARCH} STREQUAL "i386")
|
||||
list(APPEND VCRT_COMMON_SOURCES
|
||||
i386/__security_check_cookie.s
|
||||
)
|
||||
elseif(${ARCH} STREQUAL "amd64")
|
||||
list(APPEND VCRT_COMMON_SOURCES
|
||||
amd64/__security_check_cookie.s
|
||||
)
|
||||
endif()
|
||||
|
||||
# Common between vcstartup and vcruntime
|
||||
add_library(vcrt_common ${VCRT_COMMON_SOURCES})
|
||||
target_compile_definitions(vcrt_common PRIVATE
|
||||
_CORECRT_BUILD
|
||||
_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY
|
||||
)
|
||||
target_link_libraries(vcrt_common ${PSEH_LIB})
|
||||
add_dependencies(vcrt_common psdk)
|
||||
|
||||
# Runtime library (linked into ucrtbase)
|
||||
add_library(vcruntime ${VCRT_RUNTIME_SOURCES} $<TARGET_OBJECTS:vcrt_common>)
|
||||
target_compile_definitions(vcruntime PRIVATE
|
||||
_CORECRT_BUILD
|
||||
_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY
|
||||
)
|
||||
target_link_libraries(vcruntime ${PSEH_LIB})
|
||||
target_include_directories(vcruntime INTERFACE inc)
|
||||
|
||||
# Startup library (inked into executables, linking to ucrtbase)
|
||||
add_library(vcstartup ${VCRT_STARTUP_SOURCES} $<TARGET_OBJECTS:vcrt_common>)
|
||||
target_compile_definitions(vcstartup PRIVATE
|
||||
_CORECRT_BUILD
|
||||
_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY
|
||||
)
|
||||
target_link_libraries(vcstartup ${PSEH_LIB} libucrtbase libkernel32)
|
|
@ -8,9 +8,7 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <intrin.h>
|
||||
#include <corecrt_internal.h>
|
||||
#include <internal_shared.h>
|
||||
|
||||
#ifdef _WIN64
|
||||
#define DEFAULT_SECURITY_COOKIE 0x00002B992DDFA232ull
|
Loading…
Add table
Add a link
Reference in a new issue