• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2017 The Android Open Source Project
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
15import("//gn/standalone/android.gni")
16import("//gn/standalone/sanitizers/vars.gni")
17import("//gn/standalone/toolchain/llvm.gni")
18
19_sanitizer_lib_base_name = ""
20if (is_asan || is_tsan || is_ubsan) {
21  if (is_asan) {
22    _sanitizer_lib_base_name = "clang_rt.asan"
23  }
24  if (is_tsan) {
25    _sanitizer_lib_base_name = "clang_rt.tsan"
26  }
27  if (is_ubsan) {
28    _sanitizer_lib_base_name = "clang_rt.ubsan"
29    if (is_android || is_linux) {
30      _sanitizer_lib_base_name += "_standalone"
31    }
32  }
33}
34
35declare_args() {
36  sanitizer_lib_dir = ""
37  sanitizer_lib = ""
38  sanitizer_lib_dir_is_static = false
39  if (_sanitizer_lib_base_name != "") {
40    if (is_mac) {
41      sanitizer_lib = "${_sanitizer_lib_base_name}_osx_dynamic"
42      sanitizer_lib_dir = mac_clangrt_dir
43    }
44    if (is_linux) {
45      sanitizer_lib = "lib${_sanitizer_lib_base_name}-x86_64.a"
46      sanitizer_lib_dir_is_static = true
47
48      # sanitizer_lib_dir is unused on linux. All usages of sanitizer_lib_dir
49      # are gated by an if (!sanitizer_lib_dir_is_static).
50    }
51    if (is_android) {
52      sanitizer_lib = "${_sanitizer_lib_base_name}-${android_llvm_arch}-android"
53      sanitizer_lib_dir = android_clangrt_dir
54    }
55  }
56}
57