blob: 9f4c697cc01157db92472ccba53680161a413c1c [file] [log] [blame]
import("//clang/resource_dir.gni")
# FIXME: Make this support more platforms.
assert(current_os == "android")
runtime_output_dir = "$clang_resource_dir/lib/linux"
runtime_target = "aarch64-android"
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("$runtime_output_dir/libclang_rt.hwasan-$runtime_target.a",
root_build_dir),
rebase_path("$runtime_output_dir/libclang_rt.hwasan_cxx-$runtime_target.a",
root_build_dir),
"-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.cc",
"hwasan_allocator.cc",
"hwasan_dynamic_shadow.cc",
"hwasan_interceptors.cc",
"hwasan_linux.cc",
"hwasan_memintrinsics.cc",
"hwasan_poisoning.cc",
"hwasan_report.cc",
"hwasan_thread.cc",
"hwasan_thread_list.cc",
]
}
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.cc",
]
}
static_library("hwasan") {
output_dir = runtime_output_dir
output_name = "clang_rt.hwasan-$runtime_target"
complete_static_lib = true
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
configs += [ "//llvm/utils/gn/build:crt_code" ]
deps = [
":sources",
]
}
static_library("hwasan_cxx") {
output_dir = runtime_output_dir
output_name = "clang_rt.hwasan_cxx-$runtime_target"
complete_static_lib = true
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
configs += [ "//llvm/utils/gn/build:crt_code" ]
deps = [
":cxx_sources",
]
}
shared_library("hwasan_shared") {
output_dir = runtime_output_dir
output_name = "clang_rt.hwasan-$runtime_target"
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",
]
}