https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d74ab36324f78d37548e4bdc06ab7549527d73ea

commit d74ab36324f78d37548e4bdc06ab7549527d73ea
Author:     Timo Kreuzer <timo.kreu...@reactos.org>
AuthorDate: Tue Oct 22 00:07:12 2024 +0300
Commit:     Timo Kreuzer <timo.kreu...@reactos.org>
CommitDate: Sun Jan 26 18:08:55 2025 +0200

    [UCRTSUPPORT] Add ucrtsupport library
    
    This library is compiled from our old CRT sources to supplement missing 
UCRT code.
---
 sdk/lib/crt/CMakeLists.txt        |  1 +
 sdk/lib/crt/math/libm_sse2/exp2.c |  4 +---
 sdk/lib/crt/math/math.cmake       |  7 ++++++-
 sdk/lib/crt/ucrtsupport.cmake     | 29 +++++++++++++++++++++++++++++
 4 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/sdk/lib/crt/CMakeLists.txt b/sdk/lib/crt/CMakeLists.txt
index 740b9aec154..634be636c18 100644
--- a/sdk/lib/crt/CMakeLists.txt
+++ b/sdk/lib/crt/CMakeLists.txt
@@ -28,6 +28,7 @@ include(crt.cmake)
 include(libcntpr.cmake)
 include(msvcrtex.cmake)
 include(oldnames.cmake)
+include(ucrtsupport.cmake)
 
 add_library(user32_wsprintf
     printf/streamout.c
diff --git a/sdk/lib/crt/math/libm_sse2/exp2.c 
b/sdk/lib/crt/math/libm_sse2/exp2.c
index 470be6f4bf8..a5998791c9c 100644
--- a/sdk/lib/crt/math/libm_sse2/exp2.c
+++ b/sdk/lib/crt/math/libm_sse2/exp2.c
@@ -44,9 +44,7 @@ THE SOFTWARE.
 
 #include "libm_errno.h"
 
-/* exp2 is only provided for use by powf under Windows, so give
-   it a leading underscore. */
-double FN_PROTOTYPE(_exp2)(double x)
+double FN_PROTOTYPE(exp2)(double x)
 {
   static const double
     max_exp2_arg = 1024.0,  /* 0x4090000000000000 */
diff --git a/sdk/lib/crt/math/math.cmake b/sdk/lib/crt/math/math.cmake
index 3a6c69995b5..e46243f1841 100644
--- a/sdk/lib/crt/math/math.cmake
+++ b/sdk/lib/crt/math/math.cmake
@@ -2,9 +2,11 @@
 include_directories(libm_sse2)
 
 list(APPEND LIBCNTPR_MATH_SOURCE
+    math/_chgsignf.c
     math/_invoke_matherr.c
     math/abs.c
     math/div.c
+    math/exp2f.c
     math/labs.c
     math/sincos.c
 )
@@ -55,6 +57,9 @@ if(ARCH STREQUAL "i386")
         math/i386/fmod_asm.s
         math/i386/fmodf_asm.s
     )
+    list(APPEND CRT_MATH_SOURCE
+        math/_hypotf.c
+    )
 elseif(ARCH STREQUAL "amd64")
     list(APPEND LIBCNTPR_MATH_SOURCE
         math/amd64/_set_statfp.c
@@ -204,7 +209,6 @@ endif()
 
 if(NOT ARCH STREQUAL "i386")
     list(APPEND CRT_MATH_SOURCE
-        math/_chgsignf.c
         math/_copysignf.c
         math/log10f.c
         math/stubs.c
@@ -217,6 +221,7 @@ if(NOT ARCH STREQUAL "amd64")
         math/asin.c
         math/cosh.c
         math/cosf.c
+        math/exp2.c
         math/hypot.c
         math/modf.c
         math/s_modf.c
diff --git a/sdk/lib/crt/ucrtsupport.cmake b/sdk/lib/crt/ucrtsupport.cmake
new file mode 100644
index 00000000000..18216a5483f
--- /dev/null
+++ b/sdk/lib/crt/ucrtsupport.cmake
@@ -0,0 +1,29 @@
+
+list(APPEND UCRTSUPP_SOURCE
+    ${CRT_FLOAT_SOURCE}
+    ${CRT_MATH_SOURCE}
+    wine/undname.c
+)
+
+list(APPEND UCRTSUPP_ASM_SOURCE
+    ${CRT_EXCEPT_ASM_SOURCE}
+    ${CRT_FLOAT_ASM_SOURCE}
+    ${CRT_MATH_ASM_SOURCE}
+    ${CRT_SETJMP_ASM_SOURCE}
+)
+
+add_asm_files(ucrtsupp_asm ${UCRTSUPP_ASM_SOURCE})
+
+add_library(ucrtsupport ${UCRTSUPP_SOURCE} ${ucrtsupp_asm})
+target_link_libraries(ucrtsupport chkstk ${PSEH_LIB})
+target_compile_definitions(ucrtsupport PRIVATE
+    CRTDLL
+    _MSVCRT_LIB_
+    _MSVCRT_
+    _MT
+    USE_MSVCRT_PREFIX
+    __MINGW_IMPORT=extern
+    __fma3_lib_init=__acrt_initialize_fma3
+)
+#add_pch(crt precomp.h)
+add_dependencies(ucrtsupport psdk asm)

Reply via email to