Debian Codegraph @

llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn

raw
1 import("//compiler-rt/gen_version_script.gni")
2 import("//compiler-rt/target.gni")
3
4 if (current_cpu == "x64") {
5 hwasan_name = "hwasan_aliases"
6 } else {
7 hwasan_name = "hwasan"
8 }
9
10 gen_version_script("version_script") {
11 extra = "hwasan.syms.extra"
12 output = "$target_gen_dir/hwasan.vers"
13 libs = [
14 ":hwasan_static",
15 ":hwasan_cxx",
16 ]
17 lib_names = [
18 "$hwasan_name",
19 "${hwasan_name}_cxx",
20 ]
21 }
22
23 source_set("sources") {
24 configs -= [ "//llvm/utils/gn/build:llvm_code" ]
25 configs += [ "//llvm/utils/gn/build:crt_code" ]
26 defines = [ "HWASAN_WITH_INTERCEPTORS=1" ]
27 if (current_cpu == "x64") {
28 defines += [ "HWASAN_ALIASING_MODE" ]
29 }
30 deps = [
31 "//compiler-rt/lib/interception:sources",
32 "//compiler-rt/lib/lsan:common_sources",
33 "//compiler-rt/lib/sanitizer_common:sources",
34 "//compiler-rt/lib/ubsan:sources",
35 ]
36 sources = [
37 "hwasan.cpp",
38 "hwasan.h",
39 "hwasan_allocation_functions.cpp",
40 "hwasan_allocator.cpp",
41 "hwasan_allocator.h",
42 "hwasan_dynamic_shadow.cpp",
43 "hwasan_dynamic_shadow.h",
44 "hwasan_exceptions.cpp",
45 "hwasan_flags.h",
46 "hwasan_fuchsia.cpp",
47 "hwasan_globals.cpp",
48 "hwasan_globals.h",
49 "hwasan_interceptors.cpp",
50 "hwasan_interceptors_vfork.S",
51 "hwasan_interface_internal.h",
52 "hwasan_linux.cpp",
53 "hwasan_malloc_bisect.h",
54 "hwasan_mapping.h",
55 "hwasan_memintrinsics.cpp",
56 "hwasan_poisoning.cpp",
57 "hwasan_poisoning.h",
58 "hwasan_report.cpp",
59 "hwasan_report.h",
60 "hwasan_thread.cpp",
61 "hwasan_thread.h",
62 "hwasan_thread_list.cpp",
63 "hwasan_thread_list.h",
64 "hwasan_type_test.cpp",
65 ]
66 if (current_cpu == "arm64") {
67 sources += [
68 "hwasan_setjmp_aarch64.S",
69 "hwasan_tag_mismatch_aarch64.S",
70 ]
71 }
72 if (current_cpu == "riscv64") {
73 sources += [
74 "hwasan_setjmp_riscv64.S",
75 "hwasan_tag_mismatch_riscv64.S",
76 ]
77 }
78 if (current_cpu == "x64") {
79 sources += [ "hwasan_setjmp_x86_64.S" ]
80 }
81 }
82
83 source_set("cxx_sources") {
84 configs -= [ "//llvm/utils/gn/build:llvm_code" ]
85 configs += [ "//llvm/utils/gn/build:crt_code" ]
86 defines = [ "HWASAN_WITH_INTERCEPTORS=1" ]
87 deps = [ "//compiler-rt/lib/ubsan:cxx_sources" ]
88 sources = [ "hwasan_new_delete.cpp" ]
89 }
90
91 source_set("preinit_sources") {
92 configs -= [ "//llvm/utils/gn/build:llvm_code" ]
93 configs += [ "//llvm/utils/gn/build:crt_code" ]
94 defines = [ "HWASAN_WITH_INTERCEPTORS=1" ]
95 sources = [ "hwasan_preinit.cpp" ]
96 }
97
98 static_library("hwasan_static") {
99 output_dir = crt_current_out_dir
100 output_name = "clang_rt.$hwasan_name$crt_current_target_suffix"
101 complete_static_lib = true
102 configs -= [
103 "//llvm/utils/gn/build:llvm_code",
104 "//llvm/utils/gn/build:thin_archive",
105 ]
106 configs += [ "//llvm/utils/gn/build:crt_code" ]
107 deps = [
108 ":preinit_sources",
109 ":sources",
110 ]
111 }
112
113 static_library("hwasan_cxx") {
114 output_dir = crt_current_out_dir
115 output_name = "clang_rt.${hwasan_name}_cxx$crt_current_target_suffix"
116 complete_static_lib = true
117 configs -= [
118 "//llvm/utils/gn/build:llvm_code",
119 "//llvm/utils/gn/build:thin_archive",
120 ]
121 configs += [ "//llvm/utils/gn/build:crt_code" ]
122 deps = [ ":cxx_sources" ]
123 }
124
125 shared_library("hwasan_shared") {
126 output_dir = crt_current_out_dir
127 output_name = "clang_rt.$hwasan_name$crt_current_target_suffix"
128 configs -= [ "//llvm/utils/gn/build:llvm_code" ]
129 configs += [ "//llvm/utils/gn/build:crt_code" ]
130 deps = [
131 ":cxx_sources",
132 ":sources",
133 ":version_script",
134 ]
135 inputs = [ "$target_gen_dir/hwasan.vers" ]
136 ldflags = [
137 "-Wl,--version-script," + rebase_path(inputs[0], root_build_dir),
138 "-Wl,-z,global",
139 ]
140 }
141
142 static_library("hwasan_preinit") {
143 output_dir = crt_current_out_dir
144 output_name = "clang_rt.hwasan-preinit$crt_current_target_suffix"
145 complete_static_lib = true
146 configs -= [
147 "//llvm/utils/gn/build:llvm_code",
148 "//llvm/utils/gn/build:thin_archive",
149 ]
150 configs += [ "//llvm/utils/gn/build:crt_code" ]
151 deps = [ ":preinit_sources" ]
152 }
153
154 group("hwasan") {
155 deps = [
156 ":hwasan_cxx",
157 ":hwasan_preinit",
158 ":hwasan_shared",
159 ":hwasan_static",
160 ":version_script",
161 ]
162 }