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  # To be able to include sanitizer_common.
43  include_dirs = [ ".." ]
44
45  # FIXME: have SANITIZER_COMMON_CFLAGS thingy? should fno-builtin be in
46  # crt_code?
47  cflags = [ "-fno-builtin" ]
48
49  cflags += [ "-fPIE" ]
50
51  # Prevent clang from generating libc calls.
52  cflags += [ "-ffreestanding" ]
53
54  # FIXME: link rt dl m pthread log
55  # FIXME: need libclang_rt.msan*.a.syms?
56  # FIXME: msan_ignorelist.txt
57}
58
59static_library("msan_cxx") {
60  configs -= [ "//llvm/utils/gn/build:llvm_code" ]
61  configs += [ "//llvm/utils/gn/build:crt_code" ]
62
63  output_dir = crt_current_out_dir
64  assert(current_os == "linux", "MSan only works on Linux")
65  output_name = "clang_rt.msan_cxx$crt_current_target_suffix"
66
67  complete_static_lib = true
68  configs -= [ "//llvm/utils/gn/build:thin_archive" ]
69
70  deps = [ "//compiler-rt/lib/ubsan:cxx_sources" ]
71
72  sources = [ "msan_new_delete.cpp" ]
73}
74