@@ -31,16 +31,19 @@ terms of the MIT license. A copy of the license can be found in the file
3131#define mi_decl_thread __declspec (thread)
3232#define mi_decl_cache_align __declspec (align(MI_CACHE_LINE))
3333#define mi_decl_weak
34+ #define mi_decl_hidden
3435#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__clang__) // includes clang and icc
3536#define mi_decl_noinline __attribute__ ((noinline))
3637#define mi_decl_thread __thread
3738#define mi_decl_cache_align __attribute__ ((aligned(MI_CACHE_LINE)))
3839#define mi_decl_weak __attribute__ ((weak))
40+ #define mi_decl_hidden __attribute__ ((visibility(" hidden" )))
3941#else
4042#define mi_decl_noinline
4143#define mi_decl_thread __thread // hope for the best :-)
4244#define mi_decl_cache_align
4345#define mi_decl_weak
46+ #define mi_decl_hidden
4447#endif
4548
4649#if defined(__EMSCRIPTEN__) && !defined(__wasi__)
@@ -87,7 +90,7 @@ static inline uintptr_t _mi_random_shuffle(uintptr_t x);
8790
8891// init.c
8992extern mi_decl_cache_align mi_stats_t _mi_stats_main;
90- extern mi_decl_cache_align const mi_page_t _mi_page_empty;
93+ extern mi_decl_hidden mi_decl_cache_align const mi_page_t _mi_page_empty;
9194void _mi_process_load (void );
9295void mi_cdecl _mi_process_done (void );
9396bool _mi_is_redirected (void );
@@ -411,7 +414,7 @@ static inline bool mi_count_size_overflow(size_t count, size_t size, size_t* tot
411414 Heap functions
412415------------------------------------------------------------------------------------------- */
413416
414- extern const mi_heap_t _mi_heap_empty; // read-only empty heap, initial value of the thread local default heap
417+ extern mi_decl_hidden const mi_heap_t _mi_heap_empty; // read-only empty heap, initial value of the thread local default heap
415418
416419static inline bool mi_heap_is_backing (const mi_heap_t * heap) {
417420 return (heap->tld ->heap_backing == heap);
@@ -423,7 +426,7 @@ static inline bool mi_heap_is_initialized(mi_heap_t* heap) {
423426}
424427
425428static inline uintptr_t _mi_ptr_cookie (const void * p) {
426- extern mi_heap_t _mi_heap_main;
429+ extern mi_decl_hidden mi_heap_t _mi_heap_main;
427430 mi_assert_internal (_mi_heap_main.cookie != 0 );
428431 return ((uintptr_t )p ^ _mi_heap_main.cookie );
429432}
@@ -808,7 +811,7 @@ static inline uintptr_t _mi_random_shuffle(uintptr_t x) {
808811int _mi_os_numa_node_get (void );
809812size_t _mi_os_numa_node_count_get (void );
810813
811- extern _Atomic (size_t ) _mi_numa_node_count;
814+ extern mi_decl_hidden _Atomic (size_t ) _mi_numa_node_count;
812815static inline int _mi_os_numa_node (void ) {
813816 if mi_likely (mi_atomic_load_relaxed (&_mi_numa_node_count) == 1 ) { return 0 ; }
814817 else return _mi_os_numa_node_get ();
0 commit comments