// // NOTE: This file is outdated. None of the AFL++ team uses Android hence // we need users to keep this updated. // In the current state it will likely fail, please send fixes! // Also, this should build frida_mode. // cc_defaults { name: "afl-defaults", local_include_dirs: [ "include", "instrumentation", ], cflags: [ "-flto=full", "-funroll-loops", "-Wno-pointer-sign", "-Wno-pointer-arith", "-Wno-sign-compare", "-Wno-unused-parameter", "-Wno-unused-function", "-Wno-format", "-Wno-user-defined-warnings", "-DAFL_LLVM_USE_TRACE_PC=1", "-DBIN_PATH=\"out/host/linux-x86/bin\"", "-DDOC_PATH=\"out/host/linux-x86/shared/doc/afl\"", "-D__USE_GNU", "-DDEBUG_BUILD", "-U_FORTIFY_SOURCE", "-ggdb3", "-g", "-O0", "-fno-omit-frame-pointer", "-fPIC", ], target: { android_arm64: { cflags: [ "-D__ANDROID__", ], }, android_arm: { cflags: [ "-D__ANDROID__", ], }, android_x86_64: { cflags: [ "-D__ANDROID__", ], }, android_x86: { cflags: [ "-D__ANDROID__", ], }, }, } cc_binary { name: "afl-fuzz", sanitize: { never: true, }, host_supported: true, compile_multilib: "64", defaults: [ "afl-defaults", ], srcs: [ "src/afl-fuzz*.c", "src/afl-common.c", "src/afl-forkserver.c", "src/afl-sharedmem.c", "src/afl-forkserver.c", "src/afl-performance.c", ], } cc_binary { name: "afl-showmap", static_executable: true, host_supported: true, defaults: [ "afl-defaults", ], srcs: [ "src/afl-showmap.c", "src/afl-common.c", "src/afl-sharedmem.c", "src/afl-forkserver.c", "src/afl-performance.c", ], } cc_binary { name: "afl-tmin", static_executable: true, host_supported: true, defaults: [ "afl-defaults", ], srcs: [ "src/afl-tmin.c", "src/afl-common.c", "src/afl-sharedmem.c", "src/afl-forkserver.c", "src/afl-performance.c", ], } cc_binary { name: "afl-analyze", static_executable: true, host_supported: true, defaults: [ "afl-defaults", ], srcs: [ "src/afl-analyze.c", "src/afl-common.c", "src/afl-sharedmem.c", "src/afl-performance.c", ], } cc_binary { name: "afl-gotcpu", static_executable: true, host_supported: true, defaults: [ "afl-defaults", ], srcs: [ "src/afl-gotcpu.c", "src/afl-common.c", ], } cc_binary_host { name: "afl-cc", static_executable: true, defaults: [ "afl-defaults", ], cflags: [ "-DAFL_PATH=\"out/host/linux-x86/lib64\"", "-DAFL_CLANG_FLTO=\"-flto=full\"", "-DUSE_BINDIR=1", "-DLLVM_BINDIR=\"prebuilts/clang/host/linux-x86/clang-r383902b/bin\"", "-DLLVM_LIBDIR=\"prebuilts/clang/host/linux-x86/clang-r383902b/lib64\"", "-DCLANGPP_BIN=\"prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang++\"", "-DAFL_REAL_LD=\"prebuilts/clang/host/linux-x86/clang-r383902b/bin/ld.lld\"", "-DLLVM_LTO=1", "-DLLVM_MAJOR=11", "-DLLVM_MINOR=2", ], srcs: [ "src/afl-cc.c", "src/afl-common.c", ], symlinks: [ "afl-clang-fast", "afl-clang-fast++", ], } cc_library_static { name: "afl-compiler-rt", compile_multilib: "64", vendor_available: true, host_supported: true, recovery_available: true, sdk_version: "9", apex_available: [ "com.android.adbd", "com.android.appsearch", "com.android.art", "com.android.bluetooth.updatable", "com.android.cellbroadcast", "com.android.conscrypt", "com.android.extservices", "com.android.cronet", "com.android.neuralnetworks", "com.android.media", "com.android.media.swcodec", "com.android.mediaprovider", "com.android.permission", "com.android.runtime", "com.android.resolv", "com.android.tethering", "com.android.wifi", "com.android.sdkext", "com.android.os.statsd", "//any", ], defaults: [ "afl-defaults", ], srcs: [ "instrumentation/afl-compiler-rt.o.c", ], } cc_library_headers { name: "libafl_headers", vendor_available: true, host_supported: true, export_include_dirs: [ "include", "instrumentation", ], } /* cc_prebuilt_library_static { name: "libfrida-gum", compile_multilib: "64", strip: { none: true, }, srcs: [ "utils/afl_frida/android/libfrida-gum.a", ], export_include_dirs: [ "utils/afl_frida/android", ], } cc_library_shared { name: "libtestinstr", srcs: [ "utils/afl_frida/libtestinstr.c", ], cflags: [ "-O0", "-fPIC", ], } cc_binary { name: "afl-frida", compile_multilib: "64", defaults: [ "afl-defaults", ], cflags: [ "-g", "-O0", "-Wno-format", "-Wno-pointer-sign", "-fpermissive", "-fPIC", ], static_libs: [ "afl-compiler-rt", "libfrida-gum", ], shared_libs: [ "libdl", "liblog", ], srcs: [ "utils/afl_frida/afl-frida.c", ], local_include_dirs: [ "utils/afl_frida", "utils/afl_frida/android", ], } */ cc_binary { name: "afl-fuzz-32", sanitize: { never: true, }, host_supported: true, compile_multilib: "32", defaults: [ "afl-defaults", ], srcs: [ "src/afl-fuzz*.c", "src/afl-common.c", "src/afl-sharedmem.c", "src/afl-forkserver.c", "src/afl-performance.c", ], } cc_binary_host { name: "afl-cc-32", compile_multilib: "32", static_executable: true, defaults: [ "afl-defaults", ], cflags: [ "-DAFL_PATH=\"out/host/linux-x86/lib64\"", "-DAFL_CLANG_FLTO=\"-flto=full\"", "-DUSE_BINDIR=1", "-DLLVM_BINDIR=\"prebuilts/clang/host/linux-x86/clang-r383902b/bin\"", "-DLLVM_LIBDIR=\"prebuilts/clang/host/linux-x86/clang-r383902b/lib64\"", "-DCLANGPP_BIN=\"prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang++\"", "-DAFL_REAL_LD=\"prebuilts/clang/host/linux-x86/clang-r383902b/bin/ld.lld\"", "-DLLVM_LTO=1", "-DLLVM_MAJOR=11", "-DLLVM_MINOR=2", ], srcs: [ "src/afl-cc.c", "src/afl-common.c", ], symlinks: [ "afl-clang-fast-32", "afl-clang-fast++-32", ], } cc_library_static { name: "afl-compiler-rt-32", compile_multilib: "32", vendor_available: true, host_supported: true, recovery_available: true, sdk_version: "9", apex_available: [ "com.android.adbd", "com.android.appsearch", "com.android.art", "com.android.bluetooth.updatable", "com.android.cellbroadcast", "com.android.conscrypt", "com.android.extservices", "com.android.cronet", "com.android.neuralnetworks", "com.android.media", "com.android.media.swcodec", "com.android.mediaprovider", "com.android.permission", "com.android.runtime", "com.android.resolv", "com.android.tethering", "com.android.wifi", "com.android.sdkext", "com.android.os.statsd", "//any", ], defaults: [ "afl-defaults", ], srcs: [ "instrumentation/afl-compiler-rt.o.c", ], } /* cc_prebuilt_library_static { name: "libfrida-gum-32", compile_multilib: "32", strip: { none: true, }, srcs: [ "utils/afl_frida/android/arm/libfrida-gum.a", ], export_include_dirs: [ "utils/afl_frida/android/arm", ], } */ subdirs = [ "custom_mutators", ]