From: Peter Collingbourne Date: Mon, 17 May 2021 18:44:06 +0000 (-0700) Subject: gn build: Only build the hwasan runtime in aliasing mode on x86. X-Git-Tag: llvmorg-14-init~6386 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c870e36be1b21c1f306927fc9eb983390e434278;p=platform%2Fupstream%2Fllvm.git gn build: Only build the hwasan runtime in aliasing mode on x86. The LAM mode is currently untested by check-hwasan, so we only need to build the runtime in aliasing mode. Because LAM mode will always need to be conditional (because only certain hardware will support it) we can always just disable the LAM lit tests if it ever starts being tested. --- diff --git a/llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn index 919d2347..1008935 100644 --- a/llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn +++ b/llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn @@ -1,5 +1,11 @@ import("//compiler-rt/target.gni") +if (current_cpu == "x64") { + hwasan_name = "hwasan_aliases" +} else { + hwasan_name = "hwasan" +} + action("version_script") { script = "//compiler-rt/lib/sanitizer_common/scripts/gen_dynamic_list.py" sources = [ "hwasan.syms.extra" ] @@ -13,10 +19,10 @@ action("version_script") { "--extra", rebase_path(sources[0], root_build_dir), rebase_path( - "$crt_current_out_dir/libclang_rt.hwasan$crt_current_target_suffix.a", + "$crt_current_out_dir/libclang_rt.$hwasan_name$crt_current_target_suffix.a", root_build_dir), rebase_path( - "$crt_current_out_dir/libclang_rt.hwasan_cxx$crt_current_target_suffix.a", + "$crt_current_out_dir/libclang_rt.${hwasan_name}_cxx$crt_current_target_suffix.a", root_build_dir), "--nm-executable", "nm", @@ -29,6 +35,9 @@ source_set("sources") { configs -= [ "//llvm/utils/gn/build:llvm_code" ] configs += [ "//llvm/utils/gn/build:crt_code" ] defines = [ "HWASAN_WITH_INTERCEPTORS=1" ] + if (current_cpu == "x64") { + defines += [ "HWASAN_ALIASING_MODE" ] + } deps = [ "//compiler-rt/lib/interception:sources", "//compiler-rt/lib/sanitizer_common:sources", @@ -76,7 +85,7 @@ source_set("cxx_sources") { static_library("hwasan") { output_dir = crt_current_out_dir - output_name = "clang_rt.hwasan$crt_current_target_suffix" + output_name = "clang_rt.$hwasan_name$crt_current_target_suffix" complete_static_lib = true configs -= [ "//llvm/utils/gn/build:llvm_code", @@ -88,7 +97,7 @@ static_library("hwasan") { static_library("hwasan_cxx") { output_dir = crt_current_out_dir - output_name = "clang_rt.hwasan_cxx$crt_current_target_suffix" + output_name = "clang_rt.${hwasan_name}_cxx$crt_current_target_suffix" complete_static_lib = true configs -= [ "//llvm/utils/gn/build:llvm_code", @@ -100,7 +109,7 @@ static_library("hwasan_cxx") { shared_library("hwasan_shared") { output_dir = crt_current_out_dir - output_name = "clang_rt.hwasan$crt_current_target_suffix" + output_name = "clang_rt.$hwasan_name$crt_current_target_suffix" configs -= [ "//llvm/utils/gn/build:llvm_code" ] configs += [ "//llvm/utils/gn/build:crt_code" ] deps = [