Commit aac9d77f authored by Dan Melnic's avatar Dan Melnic Committed by Facebook GitHub Bot

Fix jemalloc folly weak symbol issue

Summary:
Fix jemalloc folly weak symbol issue

(Note: this ignores all push blocking failures!)

Reviewed By: davidtgoldblatt

Differential Revision: D22420581

fbshipit-source-id: 136fa6a8c74d8fea3fc96ba1d205266f2f2fa02c
parent 63cdc1c1
...@@ -33,6 +33,7 @@ const char* mallctlnametomibWeak = nullptr; ...@@ -33,6 +33,7 @@ const char* mallctlnametomibWeak = nullptr;
const char* mallctlbymibWeak = nullptr; const char* mallctlbymibWeak = nullptr;
const char* MallocExtension_Internal_GetNumericPropertyWeak = nullptr; const char* MallocExtension_Internal_GetNumericPropertyWeak = nullptr;
#elif !FOLLY_HAVE_WEAK_SYMBOLS #elif !FOLLY_HAVE_WEAK_SYMBOLS
#if (!defined(USE_JEMALLOC) && !defined(FOLLY_USE_JEMALLOC)) || FOLLY_SANITIZE
void* (*mallocx)(size_t, int) = nullptr; void* (*mallocx)(size_t, int) = nullptr;
void* (*rallocx)(void*, size_t, int) = nullptr; void* (*rallocx)(void*, size_t, int) = nullptr;
size_t (*xallocx)(void*, size_t, size_t, int) = nullptr; size_t (*xallocx)(void*, size_t, size_t, int) = nullptr;
...@@ -44,6 +45,7 @@ int (*mallctl)(const char*, void*, size_t*, void*, size_t) = nullptr; ...@@ -44,6 +45,7 @@ int (*mallctl)(const char*, void*, size_t*, void*, size_t) = nullptr;
int (*mallctlnametomib)(const char*, size_t*, size_t*) = nullptr; int (*mallctlnametomib)(const char*, size_t*, size_t*) = nullptr;
int (*mallctlbymib)(const size_t*, size_t, void*, size_t*, void*, size_t) = int (*mallctlbymib)(const size_t*, size_t, void*, size_t*, void*, size_t) =
nullptr; nullptr;
#endif
bool (*MallocExtension_Internal_GetNumericProperty)( bool (*MallocExtension_Internal_GetNumericProperty)(
const char*, const char*,
size_t, size_t,
......
...@@ -42,6 +42,9 @@ bool MallocExtension_Internal_GetNumericProperty(const char*, size_t, size_t*) ...@@ -42,6 +42,9 @@ bool MallocExtension_Internal_GetNumericProperty(const char*, size_t, size_t*)
__attribute__((__weak__)); __attribute__((__weak__));
#endif #endif
#else #else
#if (!defined(USE_JEMALLOC) && !defined(FOLLY_USE_JEMALLOC)) || FOLLY_SANITIZE
// we do not want to declare these if we have jemalloc support
// to avoid redefinition errors
extern void* (*mallocx)(size_t, int); extern void* (*mallocx)(size_t, int);
extern void* (*rallocx)(void*, size_t, int); extern void* (*rallocx)(void*, size_t, int);
extern size_t (*xallocx)(void*, size_t, size_t, int); extern size_t (*xallocx)(void*, size_t, size_t, int);
...@@ -53,6 +56,7 @@ extern int (*mallctl)(const char*, void*, size_t*, void*, size_t); ...@@ -53,6 +56,7 @@ extern int (*mallctl)(const char*, void*, size_t*, void*, size_t);
extern int (*mallctlnametomib)(const char*, size_t*, size_t*); extern int (*mallctlnametomib)(const char*, size_t*, size_t*);
extern int ( extern int (
*mallctlbymib)(const size_t*, size_t, void*, size_t*, void*, size_t); *mallctlbymib)(const size_t*, size_t, void*, size_t*, void*, size_t);
#endif
extern bool ( extern bool (
*MallocExtension_Internal_GetNumericProperty)(const char*, size_t, size_t*); *MallocExtension_Internal_GetNumericProperty)(const char*, size_t, size_t*);
#ifdef _MSC_VER #ifdef _MSC_VER
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment