1import("//compiler-rt/target.gni")
2
3static_library("msan") {
4  configs -= [ "//llvm/utils/gn/build:llvm_code" ]
5  configs += [ "//llvm/utils/gn/build:crt_code" ]
6
7  output_dir = crt_current_out_dir
8  assert(current_os == "linux", "MSan only works on Linux")
9  output_name = "clang_rt.msan$crt_current_target_suffix"
10
11  deps = [
12    "//compiler-rt/lib/interception:sources",
13    "//compiler-rt/lib/sanitizer_common:sources",
14    "//compiler-rt/lib/ubsan:sources",
15  ]
16
17  complete_static_lib = true
18  configs -= [ "//llvm/utils/gn/build:thin_archive" ]
19  deps += [ ":msan_cxx" ]
20
21  sources = [
22    "msan.cpp",
23    "msan.h",
24    "msan_allocator.cpp",
25    "msan_allocator.h",
26    "msan_chained_origin_depot.cpp",
27    "msan_chained_origin_depot.h",
28    "msan_flags.h",
29    "msan_flags.inc",
30    "msan_interceptors.cpp",
31    "msan_interface_internal.h",
32    "msan_linux.cpp",
33    "msan_origin.h",
34    "msan_poisoning.cpp",
35    "msan_poisoning.h",
36    "msan_report.cpp",
37    "msan_report.h",
38    "msan_thread.cpp",
39    "msan_thread.h",
40  ]
41
42  cflags = [ "-fPIE" ]
43
44  # Prevent clang from generating libc calls.
45  cflags += [ "-ffreestanding" ]
46
47  # FIXME: link rt dl m pthread log
48  # FIXME: need libclang_rt.msan*.a.syms?
49  # FIXME: msan_ignorelist.txt
50}
51
52static_library("msan_cxx") {
53  configs -= [ "//llvm/utils/gn/build:llvm_code" ]
54  configs += [ "//llvm/utils/gn/build:crt_code" ]
55
56  output_dir = crt_current_out_dir
57  assert(current_os == "linux", "MSan only works on Linux")
58  output_name = "clang_rt.msan_cxx$crt_current_target_suffix"
59
60  complete_static_lib = true
61  configs -= [ "//llvm/utils/gn/build:thin_archive" ]
62
63  deps = [ "//compiler-rt/lib/ubsan:cxx_sources" ]
64
65  sources = [ "msan_new_delete.cpp" ]
66}
67