Force tensorflow to use _FORTIFY_SOURCE=2 since it uses malloc_usable_size
We plan to make _FORTIFY_SOURCE=3 global on device but tensorflow uses
malloc_usable_size which cannot be used with _FORTIFY_SOURCE=3. We force
it to use _FORTIFY_SOURCE=2.
Bug: 291762537
Test: presubmit
Change-Id: I0be0b264551ab29ca73a07b5725879561fb69449
diff --git a/Android.bp b/Android.bp
index dfe58a6..414d7a8 100644
--- a/Android.bp
+++ b/Android.bp
@@ -205,6 +205,10 @@
"-DTF_ANDROID_ENABLE_LOG_EVERY_N_SECONDS",
// Used to support int64, string type in //tensorflow/core/framework/register_types.h.
"-D__ANDROID_TYPES_FULL__",
+ // This code uses malloc_usable_size(),
+ // and thus can't be built with _FORTIFY_SOURCE=3.
+ "-U_FORTIFY_SOURCE",
+ "-D_FORTIFY_SOURCE=2",
"-Wno-defaulted-function-deleted",
"-Wno-deprecated-builtins",
"-Wno-deprecated-declarations",