mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-21 06:19:31 +03:00
Updating approach to disable redirect on ARM platforms
This commit is contained in:
parent
d295043ecf
commit
311e8bd74a
2 changed files with 25 additions and 10 deletions
|
@ -22,6 +22,7 @@ option(MI_BUILD_TESTS "Build test executables" ON)
|
||||||
option(MI_DEBUG_TSAN "Build with thread sanitizer (needs clang)" OFF)
|
option(MI_DEBUG_TSAN "Build with thread sanitizer (needs clang)" OFF)
|
||||||
option(MI_DEBUG_UBSAN "Build with undefined-behavior sanitizer (needs clang++)" OFF)
|
option(MI_DEBUG_UBSAN "Build with undefined-behavior sanitizer (needs clang++)" OFF)
|
||||||
option(MI_SKIP_COLLECT_ON_EXIT, "Skip collecting memory on program exit" OFF)
|
option(MI_SKIP_COLLECT_ON_EXIT, "Skip collecting memory on program exit" OFF)
|
||||||
|
option(MI_DISABLE_REDIRECT "Do not use mimalloc-redirect on Windows (for shared libraries)" OFF)
|
||||||
|
|
||||||
# deprecated options
|
# deprecated options
|
||||||
option(MI_CHECK_FULL "Use full internal invariant checking in DEBUG mode (deprecated, use MI_DEBUG_FULL instead)" OFF)
|
option(MI_CHECK_FULL "Use full internal invariant checking in DEBUG mode (deprecated, use MI_DEBUG_FULL instead)" OFF)
|
||||||
|
@ -184,6 +185,22 @@ if(MI_USE_CXX)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT MI_DISABLE_REDIRECT)
|
||||||
|
if(MSVC AND MSVC_C_ARCHITECTURE_ID MATCHES "ARM")
|
||||||
|
set(MI_DISABLE_REDIRECT ON)
|
||||||
|
message(WARNING "Disabling redirection lib is required on ARM (MI_DISABLE_REDIRECT=ON)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (MI_DISABLE_REDIRECT)
|
||||||
|
if (NOT WIN32 OR NOT MI_SHARED_LIB)
|
||||||
|
message(WARNING "Disabling redirect only affects shared libraries on windows")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Disabled mimalloc-redirect (MI_DISABLE_REDIRECT=ON)")
|
||||||
|
list(APPEND mi_defines MI_DISABLE_REDIRECT)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Compiler flags
|
# Compiler flags
|
||||||
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU")
|
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU")
|
||||||
list(APPEND mi_cflags -Wall -Wextra -Wno-unknown-pragmas -fvisibility=hidden)
|
list(APPEND mi_cflags -Wall -Wextra -Wno-unknown-pragmas -fvisibility=hidden)
|
||||||
|
@ -304,9 +321,7 @@ if(MI_BUILD_SHARED)
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
$<INSTALL_INTERFACE:${mi_install_incdir}>
|
$<INSTALL_INTERFACE:${mi_install_incdir}>
|
||||||
)
|
)
|
||||||
if(WIN32)
|
if(WIN32 AND NOT MI_DISABLE_REDIRECT)
|
||||||
# Until the redirect lib has a version for arm don't try to copy it
|
|
||||||
if(NOT MSVC_C_ARCHITECTURE_ID MATCHES "ARM")
|
|
||||||
# On windows copy the mimalloc redirection dll too.
|
# On windows copy the mimalloc redirection dll too.
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||||
set(MIMALLOC_REDIRECT_SUFFIX "32")
|
set(MIMALLOC_REDIRECT_SUFFIX "32")
|
||||||
|
|
|
@ -490,7 +490,7 @@ mi_decl_nodiscard bool mi_is_redirected(void) mi_attr_noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Communicate with the redirection module on Windows
|
// Communicate with the redirection module on Windows
|
||||||
#if defined(_WIN32) && defined(MI_SHARED_LIB) && !(defined(_M_ARM) || defined(_M_ARM64))
|
#if defined(_WIN32) && defined(MI_SHARED_LIB) && !defined(MI_DISABLE_REDIRECT)
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue