mimalloc.h uses __attribute__((visibility("default")) or __declspec() to export public mimalloc symbols. For embedding and vendoring of mimalloc it would be very helpful to be able to hide all symbols. In the CPython case, we don't want to export mimalloc symbols to consumers of libpython3.x.so. Compiler flags like -fvisibility=hidden don't hide the symbols. It seems like the __attribute__ takes precedence and overrides the compiler flag.
As a quick hack we came up with this solution in python/cpython#29123
#if defined(MIMALLOC_VENDOR)
// hide symbols when vendoring mimalloc
#undef mi_decl_export
#define mi_decl_export mi_decl_restrict
#endif
mimalloc.huses__attribute__((visibility("default"))or__declspec()to export public mimalloc symbols. For embedding and vendoring of mimalloc it would be very helpful to be able to hide all symbols. In the CPython case, we don't want to export mimalloc symbols to consumers oflibpython3.x.so. Compiler flags like-fvisibility=hiddendon't hide the symbols. It seems like the__attribute__takes precedence and overrides the compiler flag.As a quick hack we came up with this solution in python/cpython#29123