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",
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_setjmp_aarch64.S",
61 "hwasan_setjmp_riscv64.S",
62 "hwasan_thread.cpp",
63 "hwasan_thread.h",
64 "hwasan_thread_list.cpp",
65 "hwasan_thread_list.h",
66 "hwasan_type_test.cpp",
67 ]
68 }
69
70 source_set("cxx_sources") {
71 configs -= [ "//llvm/utils/gn/build:llvm_code" ]
72 configs += [ "//llvm/utils/gn/build:crt_code" ]
73 defines = [ "HWASAN_WITH_INTERCEPTORS=1" ]
74 deps = [ "//compiler-rt/lib/ubsan:cxx_sources" ]
75 sources = [ "hwasan_new_delete.cpp" ]
76 }
77
78 static_library("hwasan") {
79 output_dir = crt_current_out_dir
80 output_name = "clang_rt.$hwasan_name$crt_current_target_suffix"
81 complete_static_lib = true
82 configs -= [
83 "//llvm/utils/gn/build:llvm_code",
84 "//llvm/utils/gn/build:thin_archive",
85 ]
86 configs += [ "//llvm/utils/gn/build:crt_code" ]
87 deps = [ ":sources" ]
88 }
89
90 static_library("hwasan_cxx") {
91 output_dir = crt_current_out_dir
92 output_name = "clang_rt.${hwasan_name}_cxx$crt_current_target_suffix"
93 complete_static_lib = true
94 configs -= [
95 "//llvm/utils/gn/build:llvm_code",
96 "//llvm/utils/gn/build:thin_archive",
97 ]
98 configs += [ "//llvm/utils/gn/build:crt_code" ]
99 deps = [ ":cxx_sources" ]
100 }
101
102 shared_library("hwasan_shared") {
103 output_dir = crt_current_out_dir
104 output_name = "clang_rt.$hwasan_name$crt_current_target_suffix"
105 configs -= [ "//llvm/utils/gn/build:llvm_code" ]
106 configs += [ "//llvm/utils/gn/build:crt_code" ]
107 deps = [
108 ":cxx_sources",
109 ":sources",
110 ":version_script",
111 ]
112 inputs = [ "$target_gen_dir/hwasan.vers" ]
113 ldflags = [
114 "-Wl,--version-script," + rebase_path(inputs[0], root_build_dir),
115 "-Wl,-z,global",
116 ]
117 }
118
119 static_library("hwasan_preinit") {
120 output_dir = crt_current_out_dir
121 output_name = "clang_rt.${hwasan_name}-preinit$crt_current_target_suffix"
122 complete_static_lib = true
123 configs -= [
124 "//llvm/utils/gn/build:llvm_code",
125 "//llvm/utils/gn/build:thin_archive",
126 ]
127 configs += [ "//llvm/utils/gn/build:crt_code" ]
128 sources = [ "hwasan_preinit.cpp" ]
129 }