Compare commits

...

3 commits

Author SHA1 Message Date
Eduard Voronkin
750a592213
Merge fd5ab9f1f3 into 951538d469 2025-04-12 04:18:14 +02:00
Daan
951538d469 fix prctl.h includes for alpine linux/musl (hopefully fixes #1065, #1066, #1067) 2025-04-08 13:56:31 -07:00
Eduard Voronkin
fd5ab9f1f3 fix new/delete overrides
apparently, even if MI_USE_CXX is OFF, mimalloc still provides mangled definitions of new/delete operators. It causes inability to statically link mimaloc in our scenario, since we want to have our own overrides of new/delete functions.
2024-11-06 12:02:22 -08:00
2 changed files with 5 additions and 2 deletions

View file

@ -189,9 +189,8 @@ typedef void* mi_nothrow_t;
void* operator new[]( std::size_t n, std::align_val_t al) noexcept(false) { return mi_new_aligned(n, static_cast<size_t>(al)); } void* operator new[]( std::size_t n, std::align_val_t al) noexcept(false) { return mi_new_aligned(n, static_cast<size_t>(al)); }
void* operator new (std::size_t n, std::align_val_t al, const std::nothrow_t&) noexcept { return mi_new_aligned_nothrow(n, static_cast<size_t>(al)); } void* operator new (std::size_t n, std::align_val_t al, const std::nothrow_t&) noexcept { return mi_new_aligned_nothrow(n, static_cast<size_t>(al)); }
void* operator new[](std::size_t n, std::align_val_t al, const std::nothrow_t&) noexcept { return mi_new_aligned_nothrow(n, static_cast<size_t>(al)); } void* operator new[](std::size_t n, std::align_val_t al, const std::nothrow_t&) noexcept { return mi_new_aligned_nothrow(n, static_cast<size_t>(al)); }
#endif
#elif (defined(__GNUC__) || defined(__clang__)) #elif (defined(__GNUC__) || defined(__clang__))
// ------------------------------------------------------ // ------------------------------------------------------
// Override by defining the mangled C++ names of the operators (as // Override by defining the mangled C++ names of the operators (as
// used by GCC and CLang). // used by GCC and CLang).
@ -234,6 +233,7 @@ typedef void* mi_nothrow_t;
#else #else
#error "define overloads for new/delete for this platform (just for performance, can be skipped)" #error "define overloads for new/delete for this platform (just for performance, can be skipped)"
#endif #endif
#endif
#endif // __cplusplus #endif // __cplusplus
// ------------------------------------------------------ // ------------------------------------------------------

View file

@ -32,6 +32,9 @@ terms of the MIT license. A copy of the license can be found in the file
#if defined(__linux__) #if defined(__linux__)
#include <features.h> #include <features.h>
#include <sys/prctl.h> // THP disable, PR_SET_VMA #include <sys/prctl.h> // THP disable, PR_SET_VMA
#if !defined(PR_SET_VMA)
#include <linux/prctl.h>
#endif
#if defined(__GLIBC__) #if defined(__GLIBC__)
#include <linux/mman.h> // linux mmap flags #include <linux/mman.h> // linux mmap flags
#else #else