Define weak r?allocm symbols in Malloc.h
authorPeter Griess <pgriess@fb.com>
Tue, 26 Nov 2013 20:11:40 +0000 (12:11 -0800)
committerJordan DeLong <jdelong@fb.com>
Fri, 20 Dec 2013 21:07:49 +0000 (13:07 -0800)
Summary:
- This fixes a bug introduced in D1002959 that broke -fb platform
compilation: there was noone to forward-declare these symbols.

Test Plan:
- Built the gcc-4.8.1-glibc-2.17-fb platform
- fbconfig -r folly && fbmake runtests
- configure/make check on Mac OS X

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D1074720

Blame Revision: D1002959

folly/Malloc.h

index e65ce226e16bf0c375a758f71f70e1ef171c31bb..72c0fb1077734b3539700637b54c1ca5e06ebf95 100644 (file)
@@ -43,6 +43,17 @@ namespace folly {
 
 #ifdef _LIBSTDCXX_FBSTRING
 #pragma GCC system_header
+
+/**
+ * Declare rallocm() and allocm() as weak symbols. These will be provided by
+ * jemalloc if we are using jemalloc, or will be NULL if we are using another
+ * malloc implementation.
+ */
+extern "C" int rallocm(void**, size_t*, size_t, size_t, int)
+__attribute__((weak));
+extern "C" int allocm(void**, size_t*, size_t, int)
+__attribute__((weak));
+
 #define FOLLY_HAVE_MALLOC_H 1
 #else
 #include "folly/detail/Malloc.h"