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_cppflags = [
19    "-std=c++11",
20    "-Wall",
21    "-Werror",
22    "-Wno-unused-parameter",
23    "-Wno-non-virtual-dtor",
24    "-fno-rtti",
25    "-fno-builtin",
26]
27
28cc_library_host_static {
29    name: "libtsan",
30
31    include_dirs: ["external/compiler-rt/lib"],
32    cppflags: tsan_rtl_cppflags,
33    srcs: [
34        "rtl/*.cc",
35        "rtl/tsan_rtl_amd64.S",
36    ],
37    stl: "none",
38    sanitize: {
39        never: true,
40    },
41    compile_multilib: "64",
42    whole_static_libs: [
43        "libinterception",
44        "libsan",
45        "libubsan",
46    ],
47    target: {
48        darwin: {
49            enabled: false,
50        },
51    },
52}
53
54cc_library_host_static {
55    name: "libtsan_cxx",
56
57    include_dirs: ["external/compiler-rt/lib"],
58    cppflags: tsan_rtl_cppflags,
59    srcs: ["rtl/tsan_new_delete.cc"],
60    stl: "none",
61    sanitize: {
62        never: true,
63    },
64    compile_multilib: "64",
65    whole_static_libs: ["libubsan_cxx"],
66    target: {
67        darwin: {
68            enabled: false,
69        },
70    },
71}
72
73cc_test_host {
74    name: "libtsan_unit_test",
75
76    include_dirs: ["external/compiler-rt/lib"],
77    local_include_dirs: ["rtl"],
78    cppflags: tsan_rtl_cppflags,
79    srcs: [
80        "tests/unit/tsan_clock_test.cc",
81        "tests/unit/tsan_dense_alloc_test.cc",
82        "tests/unit/tsan_flags_test.cc",
83        "tests/unit/tsan_mman_test.cc",
84        "tests/unit/tsan_mutex_test.cc",
85        "tests/unit/tsan_mutexset_test.cc",
86        "tests/unit/tsan_shadow_test.cc",
87        "tests/unit/tsan_stack_test.cc",
88        "tests/unit/tsan_sync_test.cc",
89        "tests/unit/tsan_unit_test_main.cc",
90        "tests/unit/tsan_vector_test.cc",
91    ],
92    sanitize: {
93        never: true,
94    },
95    compile_multilib: "64",
96    static_libs: [
97        "libtsan",
98        "libubsan",
99    ],
100    host_ldlibs: [
101        "-lrt",
102        "-ldl",
103    ],
104    target: {
105        darwin: {
106            enabled: false,
107        },
108    },
109}
110
111cc_test_host {
112    name: "libtsan_rtl_test",
113
114    include_dirs: ["external/compiler-rt/lib"],
115    local_include_dirs: ["rtl"],
116    cppflags: tsan_rtl_cppflags,
117    srcs: [
118        "tests/rtl/tsan_bench.cc",
119        "tests/rtl/tsan_mop.cc",
120        "tests/rtl/tsan_mutex.cc",
121        "tests/rtl/tsan_posix.cc",
122        "tests/rtl/tsan_string.cc",
123        "tests/rtl/tsan_test_util_posix.cc",
124        "tests/rtl/tsan_test.cc",
125        "tests/rtl/tsan_thread.cc",
126    ],
127    sanitize: {
128        never: true,
129    },
130    compile_multilib: "64",
131    static_libs: [
132        "libtsan",
133        "libubsan",
134    ],
135    host_ldlibs: [
136        "-lrt",
137        "-ldl",
138    ],
139    target: {
140        darwin: {
141            enabled: false,
142        },
143    },
144}
145