xref: /llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/scudo/standalone/BUILD.gn (revision 20aed3fd097f8b0cb57181ca7e11e9348ce4c310)
1import("//compiler-rt/target.gni")
2
3scudo_cflags = [
4  "-Werror=conversion",
5  "-nostdinc++",
6]
7
8source_set("sources") {
9  configs -= [ "//llvm/utils/gn/build:llvm_code" ]
10  configs += [ "//llvm/utils/gn/build:crt_code" ]
11  cflags = scudo_cflags
12  sources = [
13    "allocator_common.h",
14    "allocator_config.h",
15    "allocator_config_wrapper.h",
16    "atomic_helpers.h",
17    "bytemap.h",
18    "checksum.cpp",
19    "checksum.h",
20    "chunk.h",
21    "combined.h",
22    "common.cpp",
23    "common.h",
24    "condition_variable.h",
25    "condition_variable_base.h",
26    "condition_variable_linux.cpp",
27    "condition_variable_linux.h",
28    "crc32_hw.cpp",
29    "flags.cpp",
30    "flags.h",
31    "flags_parser.cpp",
32    "flags_parser.h",
33    "fuchsia.cpp",
34    "fuchsia.h",
35    "include/scudo/interface.h",
36    "internal_defs.h",
37    "linux.cpp",
38    "linux.h",
39    "list.h",
40    "local_cache.h",
41    "mem_map.cpp",
42    "mem_map.h",
43    "mem_map_base.h",
44    "mem_map_fuchsia.cpp",
45    "mem_map_fuchsia.h",
46    "mem_map_linux.cpp",
47    "mem_map_linux.h",
48    "memtag.h",
49    "mutex.h",
50    "options.h",
51    "platform.h",
52    "primary32.h",
53    "primary64.h",
54    "quarantine.h",
55    "release.cpp",
56    "release.h",
57    "report.cpp",
58    "report.h",
59    "report_linux.cpp",
60    "report_linux.h",
61    "secondary.h",
62    "size_class_map.h",
63    "stack_depot.h",
64    "stats.h",
65    "string_utils.cpp",
66    "string_utils.h",
67    "timing.cpp",
68    "timing.h",
69    "tsd.h",
70    "tsd_exclusive.h",
71    "tsd_shared.h",
72    "type_traits.h",
73    "vector.h",
74    "wrappers_c.h",
75    "wrappers_c_checks.h",
76  ]
77
78  if (current_cpu == "arm" || current_cpu == "arm64") {
79    cflags += [ "-mcrc" ]
80  }
81  if (current_cpu == "x64") {
82    cflags += [ "-msse4.2" ]
83  }
84
85  public_configs = [ ":scudo_config" ]
86}
87
88source_set("c_wrapper_sources") {
89  configs -= [ "//llvm/utils/gn/build:llvm_code" ]
90  configs += [ "//llvm/utils/gn/build:crt_code" ]
91  cflags = scudo_cflags
92  sources = [ "wrappers_c.cpp" ]
93
94  public_configs = [ ":scudo_config" ]
95}
96
97source_set("cxx_wrapper_sources") {
98  configs -= [ "//llvm/utils/gn/build:llvm_code" ]
99  configs += [ "//llvm/utils/gn/build:crt_code" ]
100  cflags = scudo_cflags
101  sources = [ "wrappers_cpp.cpp" ]
102
103  public_configs = [ ":scudo_config" ]
104}
105
106config("scudo_config") {
107  include_dirs = [
108    ".",
109    "include",
110  ]
111  if (current_os == "android") {
112    cflags = [ "-fno-emulated-tls" ]
113  }
114}
115