From 5b633d64f199047cce3b06fdad280afb52d536c8 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 27 Jan 2025 11:51:21 +0200 Subject: [PATCH] [UCRTBASE] Build without debug exports Windows ships ucrtbase without debug exports and ucrtbased with debug exports. The wine test tests ucrtbase and loads it dynamically in some cases. Compiling it with _DEBUG requires it to be linked to ucrtbased, which causes problems, because it also dynamically loads ucrtbase, which will cause it to crash. --- dll/win32/ucrtbase/CMakeLists.txt | 2 +- sdk/lib/ucrt/CMakeLists.txt | 6 +----- sdk/lib/ucrt/heap/heap.cmake | 11 +++++------ sdk/lib/ucrt/misc/misc.cmake | 13 ++++++------- sdk/lib/ucrt/stdlib/stdlib.cmake | 4 ++-- 5 files changed, 15 insertions(+), 21 deletions(-) diff --git a/dll/win32/ucrtbase/CMakeLists.txt b/dll/win32/ucrtbase/CMakeLists.txt index 51000ef12ec..0cc2d8f34b9 100644 --- a/dll/win32/ucrtbase/CMakeLists.txt +++ b/dll/win32/ucrtbase/CMakeLists.txt @@ -1,5 +1,5 @@ -spec2def(ucrtbase.dll ucrtbase.spec ADD_IMPORTLIB) +spec2def(ucrtbase.dll ucrtbase.spec NO_DBG ADD_IMPORTLIB) # Hack to replace the old CRT include directory with the UCRT include directory get_property(INCLUDE_DIRS DIRECTORY . PROPERTY INCLUDE_DIRECTORIES) diff --git a/sdk/lib/ucrt/CMakeLists.txt b/sdk/lib/ucrt/CMakeLists.txt index f6fdd2b5e2a..526935896f8 100644 --- a/sdk/lib/ucrt/CMakeLists.txt +++ b/sdk/lib/ucrt/CMakeLists.txt @@ -77,11 +77,6 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang") ) endif() -# Hack until we support globally defining _DEBUG -if(DBG) - add_compile_definitions(_DEBUG) -endif() - include(conio/conio.cmake) include(convert/convert.cmake) include(dll/dll.cmake) @@ -103,6 +98,7 @@ include(stdlib/stdlib.cmake) include(string/string.cmake) include(time/time.cmake) +# TODO: build a _DEBUG version add_library(ucrt OBJECT ${UCRT_CONIO_SOURCES} ${UCRT_CONVERT_SOURCES} diff --git a/sdk/lib/ucrt/heap/heap.cmake b/sdk/lib/ucrt/heap/heap.cmake index fb868f61b16..69930cb0f8b 100644 --- a/sdk/lib/ucrt/heap/heap.cmake +++ b/sdk/lib/ucrt/heap/heap.cmake @@ -20,9 +20,8 @@ list(APPEND UCRT_HEAP_SOURCES heap/recalloc.cpp ) -if(DBG) - list(APPEND UCRT_HEAP_SOURCES - heap/debug_heap.cpp - heap/debug_heap_hook.cpp - ) -endif() +# Debug sources +list(APPEND UCRTD_HEAP_SOURCES + heap/debug_heap.cpp + heap/debug_heap_hook.cpp +) diff --git a/sdk/lib/ucrt/misc/misc.cmake b/sdk/lib/ucrt/misc/misc.cmake index e0e94769d1f..2b4cd4b7540 100644 --- a/sdk/lib/ucrt/misc/misc.cmake +++ b/sdk/lib/ucrt/misc/misc.cmake @@ -25,10 +25,9 @@ list(APPEND UCRT_MISC_SOURCES misc/_strerr.cpp ) -if(DBG) - list(APPEND UCRT_MISC_SOURCES - misc/dbgrpt.cpp - misc/dbgrptt.cpp - misc/debug_fill_threshold.cpp - ) -endif() +# Debug sources +list(APPEND UCRTD_MISC_SOURCES + misc/dbgrpt.cpp + misc/dbgrptt.cpp + misc/debug_fill_threshold.cpp +) diff --git a/sdk/lib/ucrt/stdlib/stdlib.cmake b/sdk/lib/ucrt/stdlib/stdlib.cmake index 0558de48ace..5ca9a7b110e 100644 --- a/sdk/lib/ucrt/stdlib/stdlib.cmake +++ b/sdk/lib/ucrt/stdlib/stdlib.cmake @@ -24,8 +24,8 @@ list(APPEND UCRT_STDLIB_SOURCES ) if(CMAKE_C_COMPILER_ID STREQUAL "Clang") - add_asm_files(UCRT_STRING_ASM stdlib/clang-hacks.s) + add_asm_files(UCRT_STDLIB_ASM stdlib/clang-hacks.s) list(APPEND UCRT_STDLIB_SOURCES - ${UCRT_STRING_ASM} + ${UCRT_STDLIB_ASM} ) endif()