gn2bp: Turn off `allocator_shims` for musl only
* I've investigated turning off `allocator_shims` globally for all of Cronet but
this didn't sound like a good option. allocator_shims are used for security measures,
where sometimes malloc caller forget to check for NULL which happens on oom. allocator_shims would
instantly kill the app instead of depending on the caller to do the validity check.
* The solution here was to manually remove the files and add them to `android` and `glibc` only so allocator_shims
is never compiled for musl.
* Chromium does not support musl so there's no flag for `musl` with allocator_shims.
Test: mma
Change-Id: I2a63b14482a526d06a089647e6f61eea9f1691dc
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index e1ed23e..21482d9 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -995,7 +995,6 @@
"base/allocator/dispatcher/dispatcher.cc",
"base/allocator/dispatcher/internal/dispatch_data.cc",
"base/allocator/dispatcher/reentry_guard.cc",
- "base/allocator/partition_allocator/shim/allocator_shim.cc",
"base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc",
"base/android/android_hardware_buffer_compat.cc",
"base/android/android_image_reader_compat.cc",
@@ -1567,6 +1566,11 @@
"-Wl,-wrap,vasprintf",
],
target: {
+ android: {
+ srcs: [
+ "base/allocator/partition_allocator/shim/allocator_shim.cc",
+ ],
+ },
android_arm: {
srcs: [
"base/android/reached_code_profiler.cc",
@@ -1606,6 +1610,11 @@
"-msse3",
],
},
+ glibc: {
+ srcs: [
+ "base/allocator/partition_allocator/shim/allocator_shim.cc",
+ ],
+ },
},
}
@@ -1666,7 +1675,6 @@
"base/allocator/dispatcher/dispatcher.cc",
"base/allocator/dispatcher/internal/dispatch_data.cc",
"base/allocator/dispatcher/reentry_guard.cc",
- "base/allocator/partition_allocator/shim/allocator_shim.cc",
"base/at_exit.cc",
"base/barrier_closure.cc",
"base/base64.cc",
@@ -2135,6 +2143,9 @@
],
target: {
android: {
+ srcs: [
+ "base/allocator/partition_allocator/shim/allocator_shim.cc",
+ ],
shared_libs: [
"libandroid",
"liblog",
@@ -2615,9 +2626,14 @@
"-Wl,-wrap,vasprintf",
],
},
+ glibc: {
+ srcs: [
+ "base/allocator/partition_allocator/shim/allocator_shim.cc",
+ "base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_glibc.cc",
+ ],
+ },
host: {
srcs: [
- "base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_glibc.cc",
"base/base_paths_posix.cc",
"base/debug/stack_trace_posix.cc",
"base/files/file_util_linux.cc",