1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
import("//compiler-rt/target.gni")
action("version_script") {
script = "//compiler-rt/lib/sanitizer_common/scripts/gen_dynamic_list.py"
sources = [
"hwasan.syms.extra",
]
deps = [
":hwasan",
":hwasan_cxx",
]
outputs = [
"$target_gen_dir/hwasan.vers",
]
args = [
"--version-list",
"--extra",
rebase_path(sources[0], root_build_dir),
rebase_path(
"$crt_current_out_dir/libclang_rt.hwasan$crt_current_target_suffix.a",
root_build_dir),
rebase_path(
"$crt_current_out_dir/libclang_rt.hwasan_cxx$crt_current_target_suffix.a",
root_build_dir),
"--nm-executable",
"nm",
"-o",
rebase_path(outputs[0], root_build_dir),
]
}
source_set("sources") {
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
configs += [ "//llvm/utils/gn/build:crt_code" ]
defines = [ "HWASAN_WITH_INTERCEPTORS=1" ]
deps = [
"//compiler-rt/lib/interception:sources",
"//compiler-rt/lib/sanitizer_common:sources",
"//compiler-rt/lib/ubsan:sources",
]
sources = [
"hwasan.cpp",
"hwasan.h",
"hwasan_allocator.cpp",
"hwasan_allocator.h",
"hwasan_dynamic_shadow.cpp",
"hwasan_dynamic_shadow.h",
"hwasan_flags.h",
"hwasan_interceptors.cpp",
"hwasan_interceptors_vfork.S",
"hwasan_interface_internal.h",
"hwasan_linux.cpp",
"hwasan_malloc_bisect.h",
"hwasan_mapping.h",
"hwasan_memintrinsics.cpp",
"hwasan_poisoning.cpp",
"hwasan_poisoning.h",
"hwasan_report.cpp",
"hwasan_report.h",
"hwasan_tag_mismatch_aarch64.S",
"hwasan_thread.cpp",
"hwasan_thread.h",
"hwasan_thread_list.cpp",
"hwasan_thread_list.h",
]
}
source_set("cxx_sources") {
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
configs += [ "//llvm/utils/gn/build:crt_code" ]
deps = [
"//compiler-rt/lib/ubsan:cxx_sources",
]
sources = [
"hwasan_new_delete.cpp",
]
}
static_library("hwasan") {
output_dir = crt_current_out_dir
output_name = "clang_rt.hwasan$crt_current_target_suffix"
complete_static_lib = true
configs -= [
"//llvm/utils/gn/build:llvm_code",
"//llvm/utils/gn/build:thin_archive",
]
configs += [ "//llvm/utils/gn/build:crt_code" ]
deps = [
":sources",
]
}
static_library("hwasan_cxx") {
output_dir = crt_current_out_dir
output_name = "clang_rt.hwasan_cxx$crt_current_target_suffix"
complete_static_lib = true
configs -= [
"//llvm/utils/gn/build:llvm_code",
"//llvm/utils/gn/build:thin_archive",
]
configs += [ "//llvm/utils/gn/build:crt_code" ]
deps = [
":cxx_sources",
]
}
shared_library("hwasan_shared") {
output_dir = crt_current_out_dir
output_name = "clang_rt.hwasan$crt_current_target_suffix"
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
configs += [ "//llvm/utils/gn/build:crt_code" ]
deps = [
":cxx_sources",
":sources",
":version_script",
]
inputs = [
"$target_gen_dir/hwasan.vers",
]
ldflags = [
"-Wl,--version-script," + rebase_path(inputs[0], root_build_dir),
"-Wl,-z,global",
]
}
|