From 34cc5c8fd9e84fbfdfa45ed5db5b09f74a448a3b Mon Sep 17 00:00:00 2001 From: Peiyuan Song Date: Mon, 24 Mar 2025 09:39:42 +0800 Subject: [PATCH 1/3] remove the `lib` prefix when enabling mimalloc-redirect for mingw --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7154b20..283af66d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -594,6 +594,9 @@ if(MI_BUILD_SHARED) # install(FILES "$/${mi_libname}.dll.pdb" DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() if(WIN32 AND MI_WIN_REDIRECT) + if(MINGW) + set_property(TARGET mimalloc PROPERTY PREFIX "") + endif() # On windows, link and copy the mimalloc redirection dll too. if(CMAKE_GENERATOR_PLATFORM STREQUAL "arm64ec") set(MIMALLOC_REDIRECT_SUFFIX "-arm64ec") From 797ca19ba93bb92f9c7c97923aa3e43485cbb3de Mon Sep 17 00:00:00 2001 From: Maksim Bondarenkov <119937608+ognevny@users.noreply.github.com> Date: Mon, 24 Mar 2025 08:35:15 +0300 Subject: [PATCH 2/3] cmake: don't change properties of import lib on Windows/MinGW CMake handles import lib for it automatically, and using `.dll.lib` extension is MSVC-specific hack --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7154b20..46435eca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -584,7 +584,7 @@ if(MI_BUILD_SHARED) install(TARGETS mimalloc EXPORT mimalloc ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) - if(WIN32) + if(WIN32 AND NOT MINGW) # On windows, the import library name for the dll would clash with the static mimalloc.lib library # so we postfix the dll import library with `.dll.lib` (and also the .pdb debug file) set_property(TARGET mimalloc PROPERTY ARCHIVE_OUTPUT_NAME "${mi_libname}.dll" ) From 632eab958bb91fb8bd273efe58995023e5087aaa Mon Sep 17 00:00:00 2001 From: Daan Date: Tue, 25 Mar 2025 16:02:29 -0700 Subject: [PATCH 3/3] fix for atomic_yield on arm 32-bit, issue #1046 --- include/mimalloc/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mimalloc/atomic.h b/include/mimalloc/atomic.h index 2984f50f..c0425f67 100644 --- a/include/mimalloc/atomic.h +++ b/include/mimalloc/atomic.h @@ -380,7 +380,7 @@ static inline void mi_atomic_yield(void) { static inline void mi_atomic_yield(void) { __asm__ volatile("wfe"); } -#elif (defined(__arm__) && __ARM_ARCH__ >= 7) +#elif (defined(__arm__) && __ARM_ARCH >= 7) static inline void mi_atomic_yield(void) { __asm__ volatile("yield" ::: "memory"); }