aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2021-07-28 19:48:03 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-07-28 19:48:03 +0000
commitff4e3653d8491bdaccbdb7a208d39597621f9c93 (patch)
tree13e1daa1c0ff63f4da7c8d768a1386b38457cbaa
parent517ee63ccd3b2819ca8d6930d837b0ab1f54e3c2 (diff)
parent727713db357d9fb2523698073960f84959bb3fdb (diff)
downloadjemalloc_new-ff4e3653d8491bdaccbdb7a208d39597621f9c93.tar.gz
Support compiling libjemalloc5 against musl am: 7326a7c470 am: 727713db35android-s-v2-preview-2android-s-v2-preview-1android-s-v2-beta-2android-s-v2-preview-1
Original change: https://android-review.googlesource.com/c/platform/external/jemalloc_new/+/1776846 Change-Id: I2d551e55038906c2005fb5596e7b70fc9997dd78
-rw-r--r--Android.bp5
-rw-r--r--include/jemalloc/internal/jemalloc_internal_defs_host.h2
-rw-r--r--src/jemalloc.c2
3 files changed, 8 insertions, 1 deletions
diff --git a/Android.bp b/Android.bp
index 80eede97..15f7d63c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -201,6 +201,11 @@ cc_library {
system_shared_libs: [],
header_libs: ["libc_headers"],
},
+ musl: {
+ // Linking against musl uses libjemalloc5 by default, list only
+ // libc_musl here to avoid a circular dependency.
+ system_shared_libs: ["libc_musl"],
+ },
},
}
diff --git a/include/jemalloc/internal/jemalloc_internal_defs_host.h b/include/jemalloc/internal/jemalloc_internal_defs_host.h
index 38f91bc2..f4c973bf 100644
--- a/include/jemalloc/internal/jemalloc_internal_defs_host.h
+++ b/include/jemalloc/internal/jemalloc_internal_defs_host.h
@@ -376,6 +376,8 @@
/*
* Defined if strerror_r returns char * if _GNU_SOURCE is defined.
*/
+#ifdef __GLIBC__
#define JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE
+#endif
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
diff --git a/src/jemalloc.c b/src/jemalloc.c
index 0584362f..bf5976b3 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -111,7 +111,7 @@ static uint8_t malloc_slow_flags;
#ifdef JEMALLOC_THREADED_INIT
/* Used to let the initializing thread recursively allocate. */
-# define NO_INITIALIZER ((unsigned long)0)
+# define NO_INITIALIZER ((pthread_t)0)
# define INITIALIZER pthread_self()
# define IS_INITIALIZER (malloc_initializer == pthread_self())
static pthread_t malloc_initializer = NO_INITIALIZER;