diff --git a/tensorflow/lite/micro/build_def.bzl b/tensorflow/lite/micro/build_def.bzl index 56029cce4c2..33784857641 100644 --- a/tensorflow/lite/micro/build_def.bzl +++ b/tensorflow/lite/micro/build_def.bzl @@ -9,6 +9,7 @@ def tflm_copts(): """ return [ "-fno-asynchronous-unwind-tables", + "-fno-exceptions", "-Wall", "-Wno-unused-parameter", "-Wnon-virtual-dtor", @@ -31,7 +32,12 @@ def tflm_defines(): this function directly; however, it may be useful when additively overriding the defaults for a particular target. """ - return select({ + defines = [ + # Exclude dynamic memory use in shared TFLite code. + "TF_LITE_STATIC_MEMORY=1", + ] + + defines += select({ # Include code for the compression feature. "//:with_compression_enabled": ["USE_TFLM_COMPRESSION=1"], @@ -39,6 +45,8 @@ def tflm_defines(): "//conditions:default": [], }) + return defines + def tflm_cc_binary(copts = tflm_copts(), defines = tflm_defines(), **kwargs): native.cc_binary( copts = copts,