diff --git a/boot/environ/CMakeLists.txt b/boot/environ/CMakeLists.txt index daa621ac216..9bafea5eef7 100644 --- a/boot/environ/CMakeLists.txt +++ b/boot/environ/CMakeLists.txt @@ -103,9 +103,12 @@ set_entrypoint(bootmgfw EfiEntry) target_link_libraries(bootmgfw bootlib cportlib cmlib rtl libcntpr) +# dynamic analysis switches if(STACK_PROTECTOR) target_link_libraries(bootmgfw gcc_ssp) -elseif(RUNTIME_CHECKS) +endif() + +if(RUNTIME_CHECKS) target_link_libraries(bootmgfw runtmchk) endif() @@ -148,9 +151,12 @@ endif() target_link_libraries(rosload bootlib cportlib cmlib rtl libcntpr) +# dynamic analysis switches if(STACK_PROTECTOR) target_link_libraries(rosload gcc_ssp) -elseif(RUNTIME_CHECKS) +endif() + +if(RUNTIME_CHECKS) target_link_libraries(rosload runtmchk) endif() diff --git a/boot/freeldr/freeldr/CMakeLists.txt b/boot/freeldr/freeldr/CMakeLists.txt index ec6010cb81f..254dfa073ef 100644 --- a/boot/freeldr/freeldr/CMakeLists.txt +++ b/boot/freeldr/freeldr/CMakeLists.txt @@ -265,7 +265,7 @@ endif() add_executable(freeldr_pe ${FREELDR_BASE_SOURCE}) add_executable(freeldr_pe_dbg EXCLUDE_FROM_ALL ${FREELDR_BASE_SOURCE}) -set_target_properties(freeldr_pe freeldr_pe_dbg +set_target_properties(freeldr_pe freeldr_pe_dbg PROPERTIES ENABLE_EXPORTS TRUE DEFINE_SYMBOL "") @@ -308,10 +308,13 @@ endif() target_link_libraries(freeldr_pe freeldr_common cportlib cmlib rtl libcntpr) target_link_libraries(freeldr_pe_dbg freeldr_common cportlib cmlib rtl libcntpr) +# dynamic analysis switches if(STACK_PROTECTOR) target_link_libraries(freeldr_pe gcc_ssp) target_link_libraries(freeldr_pe_dbg gcc_ssp) -elseif(RUNTIME_CHECKS) +endif() + +if(RUNTIME_CHECKS) target_link_libraries(freeldr_pe runtmchk) target_link_libraries(freeldr_pe_dbg runtmchk) add_target_link_flags(freeldr_pe "/MERGE:.rtc=.text") diff --git a/configure.cmd b/configure.cmd index 1cee20afc3f..c0fa3ac00d4 100755 --- a/configure.cmd +++ b/configure.cmd @@ -13,7 +13,7 @@ if /I "%1" == "/?" ( :help echo Help for configure script echo Syntax: path\to\source\configure.cmd [script-options] [Cmake-options] - echo Available script-options: Codeblocks, Eclipse, Makefiles, clang, VSSolution, RTC + echo Available script-options: Codeblocks, Eclipse, Makefiles, clang, VSSolution echo Cmake-options: -DVARIABLE:TYPE=VALUE goto quit ) @@ -62,7 +62,6 @@ if defined ROS_ARCH ( ) set BUILD_ENVIRONMENT=VS set VS_SOLUTION=0 - set VS_RUNTIME_CHECKS=0 echo Detected Visual Studio Environment !BUILD_ENVIRONMENT!!VS_VERSION!-!ARCH! ) else ( echo Error: Unable to detect build environment. Configure script failure. @@ -90,8 +89,6 @@ REM Parse command line parameters echo. && echo Error: Creation of VS Solution files is not supported in a MinGW environment. echo Please run this command in a [Developer] Command Prompt for Visual Studio. goto quit - ) else if /I "%1" == "RTC" ( - echo. && echo Warning: RTC switch is ignored outside of a Visual Studio environment. && echo. ) else if /I "%1" NEQ "" ( echo %1| find /I "-D" > NUL if %ERRORLEVEL% == 0 ( @@ -128,9 +125,6 @@ REM Parse command line parameters ) else if "!ARCH!" == "arm" ( set CMAKE_ARCH=-A ARM ) - ) else if /I "%1" == "RTC" ( - echo Runtime checks enabled - set VS_RUNTIME_CHECKS=1 ) else if /I "%1" NEQ "" ( echo %1| find /I "-D" > NUL if %ERRORLEVEL% == 0 ( @@ -197,9 +191,9 @@ if EXIST CMakeCache.txt ( if "%BUILD_ENVIRONMENT%" == "MinGW" ( cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=%MINGW_TOOCHAIN_FILE% -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% %* "%REACTOS_SOURCE_DIR%" ) else if %USE_CLANG_CL% == 1 ( - cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% -DUSE_CLANG_CL:BOOL=1 -DRUNTIME_CHECKS:BOOL=%VS_RUNTIME_CHECKS% %* "%REACTOS_SOURCE_DIR%" + cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% -DUSE_CLANG_CL:BOOL=1 %* "%REACTOS_SOURCE_DIR%" ) else ( - cmake -G %CMAKE_GENERATOR% %CMAKE_ARCH% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% -DRUNTIME_CHECKS:BOOL=%VS_RUNTIME_CHECKS% %* "%REACTOS_SOURCE_DIR%" + cmake -G %CMAKE_GENERATOR% %CMAKE_ARCH% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% %* "%REACTOS_SOURCE_DIR%" ) if %ERRORLEVEL% NEQ 0 ( diff --git a/dll/keyboard/CMakeLists.txt b/dll/keyboard/CMakeLists.txt index 406e314b78f..088cb6acad3 100644 --- a/dll/keyboard/CMakeLists.txt +++ b/dll/keyboard/CMakeLists.txt @@ -107,6 +107,7 @@ foreach(_keyboard_layout ${_keyboard_layouts}) set_property(TARGET ${_keyboard_layout} PROPERTY C_STANDARD 99) endif() + # dynamic analysis switches if (STACK_PROTECTOR) target_link_libraries(${_keyboard_layout} gcc_ssp) endif() diff --git a/ntoskrnl/ntkrnlmp/CMakeLists.txt b/ntoskrnl/ntkrnlmp/CMakeLists.txt index 5807f794ff8..2853f45fe75 100644 --- a/ntoskrnl/ntkrnlmp/CMakeLists.txt +++ b/ntoskrnl/ntkrnlmp/CMakeLists.txt @@ -34,9 +34,12 @@ else() set_image_base(ntkrnlmp 0x80800000) endif() +# dynamic analysis switches if(STACK_PROTECTOR) target_link_libraries(ntkrnlmp gcc_ssp) -elseif(RUNTIME_CHECKS) +endif() + +if(RUNTIME_CHECKS) target_link_libraries(ntkrnlmp runtmchk) endif() diff --git a/sdk/cmake/config-amd64.cmake b/sdk/cmake/config-amd64.cmake index 76439fbb6d0..058d4518acb 100644 --- a/sdk/cmake/config-amd64.cmake +++ b/sdk/cmake/config-amd64.cmake @@ -44,4 +44,5 @@ set(USERMODE TRUE CACHE BOOL if(MSVC) set(_PREFAST_ FALSE CACHE BOOL "Whether to enable PREFAST while compiling.") + option(RUNTIME_CHECKS "Whether to enable runtime checks on MSVC" ON) endif() diff --git a/sdk/cmake/config-arm.cmake b/sdk/cmake/config-arm.cmake index 7fd6a5d5aef..b9f2e2028f9 100644 --- a/sdk/cmake/config-arm.cmake +++ b/sdk/cmake/config-arm.cmake @@ -43,3 +43,7 @@ set(BUILD_MP TRUE CACHE BOOL set(NEWSPRINTF FALSE CACHE BOOL "Whether to compile the new sprintf.") + +if(MSVC) + option(RUNTIME_CHECKS "Whether to enable runtime checks on MSVC" ON) +endif() diff --git a/sdk/cmake/config.cmake b/sdk/cmake/config.cmake index 4c2305479ac..d9897426bd8 100644 --- a/sdk/cmake/config.cmake +++ b/sdk/cmake/config.cmake @@ -83,9 +83,12 @@ set(_PREFAST_ FALSE CACHE BOOL "Whether to enable PREFAST while compiling.") set(_VS_ANALYZE_ FALSE CACHE BOOL "Whether to enable static analysis while compiling.") -else() -set(STACK_PROTECTOR FALSE CACHE BOOL -"Whether to enbable the GCC stack checker while compiling") + + option(RUNTIME_CHECKS "Whether to enable runtime checks on MSVC" ON) +endif() + +if(GCC) + option(STACK_PROTECTOR "Whether to enable the GCC stack checker while compiling" OFF) endif() set(USE_DUMMY_PSEH FALSE CACHE BOOL diff --git a/sdk/cmake/msvc.cmake b/sdk/cmake/msvc.cmake index d18c42251ea..0662fd24692 100644 --- a/sdk/cmake/msvc.cmake +++ b/sdk/cmake/msvc.cmake @@ -151,10 +151,6 @@ if(MSVC_IDE AND (NOT DEFINED USE_FOLDER_STRUCTURE)) set(USE_FOLDER_STRUCTURE TRUE) endif() -if(NOT DEFINED RUNTIME_CHECKS) - set(RUNTIME_CHECKS FALSE) -endif() - if(RUNTIME_CHECKS) add_definitions(-D__RUNTIME_CHECKS__) add_compile_flags("/RTC1")