Create a lib that uses scudo instead of jemalloc.
The media processes already use scudo as their allocator. However, it
doesn't really correctly replace the normal allocation functions, so create
a set of wrappers that allow us to use scudo closer to how jemalloc is used.
This is only a temporary change, and should be removed for the next
release of Android. In that version, we will be using standalone
scudo which won't require this wrapper code.
Bug: 123689570
Test: Ran new bionic unit tests. There are failures, but only with
Test: extensions that scudo does not support.
Change-Id: I0516c23d654a9b6c69b157c5501245d2e0b3d264
diff --git a/libc/bionic/scudo/Android.bp b/libc/bionic/scudo/Android.bp
new file mode 100644
index 0000000..8b518bb
--- /dev/null
+++ b/libc/bionic/scudo/Android.bp
@@ -0,0 +1,60 @@
+//
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_shared {
+ name: "libscudo_wrapper",
+ vendor_available: true,
+ srcs: ["scudo.cpp"],
+
+ stl: "none",
+ system_shared_libs: [],
+ host_supported: false,
+
+ header_libs: ["libc_headers"],
+ include_dirs: [
+ "bionic/libc",
+ "bionic/libc/bionic",
+ ],
+
+ whole_static_libs: ["libasync_safe"],
+
+ arch: {
+ arm: {
+ whole_static_libs: ["libclang_rt.scudo_minimal-arm-android.static"],
+ },
+ arm64: {
+ whole_static_libs: ["libclang_rt.scudo_minimal-aarch64-android.static"],
+ },
+ x86: {
+ whole_static_libs: ["libclang_rt.scudo_minimal-i686-android.static"],
+ },
+ x86_64: {
+ whole_static_libs: ["libclang_rt.scudo_minimal-x86_64-android.static"],
+ },
+ },
+
+ // Will be referencing other libc code that won't be defined here.
+ allow_undefined_symbols: true,
+
+ multilib: {
+ lib32: {
+ version_script: "exported32.map",
+ },
+ lib64: {
+ version_script: "exported64.map",
+ },
+ },
+}