From 8b0450555fbb28844a0b3b0f8b205f25df314e4c Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Wed, 5 Dec 2018 01:44:43 -0500 Subject: [PATCH] add initial Android build system support --- Android.bp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Android.bp diff --git a/Android.bp b/Android.bp new file mode 100644 index 0000000..81b0546 --- /dev/null +++ b/Android.bp @@ -0,0 +1,50 @@ +common_cflags = [ + "-std=c11", + "-O3", + //"-flto", + "-fPIC", + "-fvisibility=hidden", + //"-fno-plt", + "-pipe", + "-Wall", + "-Wextra", + "-Wcast-align", + "-Wcast-qual", + "-Wwrite-strings", + "-Wmissing-prototypes", + "-DH_MALLOC_PREFIX", + "-DZERO_ON_FREE=true", + "-DWRITE_AFTER_FREE_CHECK=true", + "-DSLOT_RANDOMIZE=true", + "-DSLAB_CANARY=true", + "-DSLAB_QUARANTINE_RANDOM_SIZE=0", + "-DSLAB_QUARANTINE_QUEUE_SIZE=0", + "-DGUARD_SLABS_INTERVAL=1", + "-DGUARD_SIZE_DIVISOR=2", + "-DREGION_QUARANTINE_RANDOM_SIZE=128", + "-DREGION_QUARANTINE_QUEUE_SIZE=1024", + "-DREGION_QUARANTINE_SKIP_THRESHOLD=33554432", + "-DFREE_SLABS_QUARANTINE_RANDOM_SIZE=32", +] + +cc_defaults { + name: "hardened_malloc_defaults", + defaults: ["linux_bionic_supported"], + cflags: common_cflags, + stl: "none", +} + +lib_src_files = [ + "chacha.c", + "h_malloc.c", + "memory.c", + "pages.c", + "random.c", + "util.c", +] + +cc_library_static { + name: "libhardened_malloc", + defaults: ["hardened_malloc_defaults"], + srcs: lib_src_files, +}