1//
2// Copyright (C) 2015 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16//
17
18tsan_rtl_cflags = [
19    "-Wall",
20    "-Werror",
21]
22
23tsan_rtl_cppflags = [
24    "-std=c++11",
25    "-Wno-unused-parameter",
26    "-Wno-non-virtual-dtor",
27    "-fno-rtti",
28    "-fno-builtin",
29]
30
31cc_library_host_static {
32    name: "libtsan",
33
34    include_dirs: ["external/compiler-rt/lib"],
35    cflags: tsan_rtl_cflags,
36    cppflags: tsan_rtl_cppflags,
37    srcs: [
38        "rtl/*.cc",
39        "rtl/tsan_rtl_amd64.S",
40    ],
41    stl: "none",
42    sanitize: {
43        never: true,
44    },
45    compile_multilib: "64",
46    whole_static_libs: [
47        "libinterception",
48        "libsan",
49        "libubsan",
50    ],
51    target: {
52        darwin: {
53            enabled: false,
54        },
55    },
56}
57
58cc_library_host_static {
59    name: "libtsan_cxx",
60
61    include_dirs: ["external/compiler-rt/lib"],
62    cflags: tsan_rtl_cflags,
63    cppflags: tsan_rtl_cppflags,
64    srcs: ["rtl/tsan_new_delete.cc"],
65    stl: "none",
66    sanitize: {
67        never: true,
68    },
69    compile_multilib: "64",
70    whole_static_libs: ["libubsan_cxx"],
71    target: {
72        darwin: {
73            enabled: false,
74        },
75    },
76}
77
78cc_test_host {
79    name: "libtsan_unit_test",
80
81    include_dirs: ["external/compiler-rt/lib"],
82    local_include_dirs: ["rtl"],
83    cflags: tsan_rtl_cflags,
84    cppflags: tsan_rtl_cppflags,
85    srcs: [
86        "tests/unit/tsan_clock_test.cc",
87        "tests/unit/tsan_dense_alloc_test.cc",
88        "tests/unit/tsan_flags_test.cc",
89        "tests/unit/tsan_mman_test.cc",
90        "tests/unit/tsan_mutex_test.cc",
91        "tests/unit/tsan_mutexset_test.cc",
92        "tests/unit/tsan_shadow_test.cc",
93        "tests/unit/tsan_stack_test.cc",
94        "tests/unit/tsan_sync_test.cc",
95        "tests/unit/tsan_unit_test_main.cc",
96        "tests/unit/tsan_vector_test.cc",
97    ],
98    sanitize: {
99        never: true,
100    },
101    compile_multilib: "64",
102    static_libs: [
103        "libtsan",
104        "libubsan",
105    ],
106    target: {
107        darwin: {
108            enabled: false,
109        },
110    },
111}
112
113cc_test_host {
114    name: "libtsan_rtl_test",
115
116    include_dirs: ["external/compiler-rt/lib"],
117    local_include_dirs: ["rtl"],
118    cflags: tsan_rtl_cflags,
119    cppflags: tsan_rtl_cppflags,
120    srcs: [
121        "tests/rtl/tsan_bench.cc",
122        "tests/rtl/tsan_mop.cc",
123        "tests/rtl/tsan_mutex.cc",
124        "tests/rtl/tsan_posix.cc",
125        "tests/rtl/tsan_string.cc",
126        "tests/rtl/tsan_test_util_posix.cc",
127        "tests/rtl/tsan_test.cc",
128        "tests/rtl/tsan_thread.cc",
129    ],
130    sanitize: {
131        never: true,
132    },
133    compile_multilib: "64",
134    static_libs: [
135        "libtsan",
136        "libubsan",
137    ],
138    target: {
139        darwin: {
140            enabled: false,
141        },
142    },
143}
144