1# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ==============================================================================
15#
16# TFLM Bazel configuration file.
17#
18# Other build options:
19#     asan:             Build with the clang address sanitizer
20#     msan:             Build with the clang memory sanitizer
21#     ubsan:            Build with the clang undefined behavior sanitizer
22#
23
24# Address sanitizer
25# CC=clang bazel build --config asan
26build:asan --strip=never
27build:asan --copt -fsanitize=address
28build:asan --copt -DADDRESS_SANITIZER
29build:asan --copt -g
30build:asan --copt -O3
31build:asan --copt -fno-omit-frame-pointer
32build:asan --linkopt -fsanitize=address
33
34# Memory sanitizer
35# CC=clang bazel build --config msan
36build:msan --strip=never
37build:msan --copt -fsanitize=memory
38build:msan --copt -DADDRESS_SANITIZER
39build:msan --copt -g
40build:msan --copt -O3
41build:msan --copt -fno-omit-frame-pointer
42build:msan --linkopt -fsanitize=memory
43
44# Undefined Behavior Sanitizer
45# CC=clang bazel build --config ubsan
46build:ubsan --strip=never
47build:ubsan --copt -fsanitize=undefined
48build:ubsan --copt -g
49build:ubsan --copt -O3
50build:ubsan --copt -fno-omit-frame-pointer
51build:ubsan --linkopt -fsanitize=undefined
52build:ubsan --linkopt -lubsan
53