Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gn build: Add build files for compiler-rt/lib/{hwasan,interception,sa…
…nitizer_common,ubsan}. This allows the hwasan runtime to be built for Android aarch64. Differential Revision: https://reviews.llvm.org/D56628 llvm-svn: 351246
- Loading branch information
Showing
6 changed files
with
235 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import("//llvm/version.gni") | ||
|
||
# FIXME: Make this support more platforms. | ||
assert(current_os == "android") | ||
|
||
runtime_output_dir = "$root_build_dir/lib/clang/$llvm_version/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", | ||
] | ||
} |
13 changes: 13 additions & 0 deletions
13
llvm/utils/gn/secondary/compiler-rt/lib/interception/BUILD.gn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
source_set("sources") { | ||
configs -= [ "//llvm/utils/gn/build:llvm_code" ] | ||
configs += [ "//llvm/utils/gn/build:crt_code" ] | ||
deps = [ | ||
"//compiler-rt/lib/sanitizer_common:sources", | ||
] | ||
sources = [ | ||
"interception_linux.cc", | ||
"interception_mac.cc", | ||
"interception_type_test.cc", | ||
"interception_win.cc", | ||
] | ||
} |
70 changes: 70 additions & 0 deletions
70
llvm/utils/gn/secondary/compiler-rt/lib/sanitizer_common/BUILD.gn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
source_set("sources") { | ||
configs -= [ "//llvm/utils/gn/build:llvm_code" ] | ||
configs += [ "//llvm/utils/gn/build:crt_code" ] | ||
sources = [ | ||
"sancov_flags.cc", | ||
"sanitizer_allocator.cc", | ||
"sanitizer_allocator_checks.cc", | ||
"sanitizer_allocator_report.cc", | ||
"sanitizer_common.cc", | ||
"sanitizer_common_libcdep.cc", | ||
"sanitizer_coverage_fuchsia.cc", | ||
"sanitizer_coverage_libcdep_new.cc", | ||
"sanitizer_coverage_win_sections.cc", | ||
"sanitizer_deadlock_detector1.cc", | ||
"sanitizer_deadlock_detector2.cc", | ||
"sanitizer_errno.cc", | ||
"sanitizer_file.cc", | ||
"sanitizer_flag_parser.cc", | ||
"sanitizer_flags.cc", | ||
"sanitizer_fuchsia.cc", | ||
"sanitizer_libc.cc", | ||
"sanitizer_libignore.cc", | ||
"sanitizer_linux.cc", | ||
"sanitizer_linux_libcdep.cc", | ||
"sanitizer_linux_s390.cc", | ||
"sanitizer_mac.cc", | ||
"sanitizer_mac_libcdep.cc", | ||
"sanitizer_netbsd.cc", | ||
"sanitizer_openbsd.cc", | ||
"sanitizer_persistent_allocator.cc", | ||
"sanitizer_platform_limits_freebsd.cc", | ||
"sanitizer_platform_limits_linux.cc", | ||
"sanitizer_platform_limits_netbsd.cc", | ||
"sanitizer_platform_limits_openbsd.cc", | ||
"sanitizer_platform_limits_posix.cc", | ||
"sanitizer_platform_limits_solaris.cc", | ||
"sanitizer_posix.cc", | ||
"sanitizer_posix_libcdep.cc", | ||
"sanitizer_printf.cc", | ||
"sanitizer_procmaps_bsd.cc", | ||
"sanitizer_procmaps_common.cc", | ||
"sanitizer_procmaps_linux.cc", | ||
"sanitizer_procmaps_mac.cc", | ||
"sanitizer_procmaps_solaris.cc", | ||
"sanitizer_rtems.cc", | ||
"sanitizer_solaris.cc", | ||
"sanitizer_stackdepot.cc", | ||
"sanitizer_stacktrace.cc", | ||
"sanitizer_stacktrace_libcdep.cc", | ||
"sanitizer_stacktrace_printer.cc", | ||
"sanitizer_stacktrace_sparc.cc", | ||
"sanitizer_stoptheworld_linux_libcdep.cc", | ||
"sanitizer_stoptheworld_mac.cc", | ||
"sanitizer_suppressions.cc", | ||
"sanitizer_symbolizer.cc", | ||
"sanitizer_symbolizer_libbacktrace.cc", | ||
"sanitizer_symbolizer_libcdep.cc", | ||
"sanitizer_symbolizer_mac.cc", | ||
"sanitizer_symbolizer_markup.cc", | ||
"sanitizer_symbolizer_posix_libcdep.cc", | ||
"sanitizer_symbolizer_report.cc", | ||
"sanitizer_symbolizer_win.cc", | ||
"sanitizer_termination.cc", | ||
"sanitizer_thread_registry.cc", | ||
"sanitizer_tls_get_addr.cc", | ||
"sanitizer_unwind_linux_libcdep.cc", | ||
"sanitizer_unwind_win.cc", | ||
"sanitizer_win.cc", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
source_set("sources") { | ||
configs -= [ "//llvm/utils/gn/build:llvm_code" ] | ||
configs += [ "//llvm/utils/gn/build:crt_code" ] | ||
defines = [ "UBSAN_CAN_USE_CXXABI" ] | ||
deps = [ | ||
"//compiler-rt/lib/interception:sources", | ||
"//compiler-rt/lib/sanitizer_common:sources", | ||
] | ||
sources = [ | ||
"ubsan_diag.cc", | ||
"ubsan_flags.cc", | ||
"ubsan_handlers.cc", | ||
"ubsan_init.cc", | ||
"ubsan_monitor.cc", | ||
"ubsan_value.cc", | ||
] | ||
} | ||
|
||
source_set("cxx_sources") { | ||
configs -= [ "//llvm/utils/gn/build:llvm_code" ] | ||
configs -= [ "//llvm/utils/gn/build:no_rtti" ] | ||
configs += [ "//llvm/utils/gn/build:crt_code" ] | ||
defines = [ "UBSAN_CAN_USE_CXXABI" ] | ||
sources = [ | ||
"ubsan_handlers_cxx.cc", | ||
"ubsan_type_hash.cc", | ||
"ubsan_type_hash_itanium.cc", | ||
"ubsan_type_hash_win.cc", | ||
] | ||
} |