[llvm] [gn build] Enable hwasan for aarch64 Android (PR #115219)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 16:15:53 PST 2024


https://github.com/aeubanks updated https://github.com/llvm/llvm-project/pull/115219

>From e449acdfb82b20a5ad59ef5d912c3e972ac9b91b Mon Sep 17 00:00:00 2001
From: Arthur Eubanks <aeubanks at google.com>
Date: Wed, 6 Nov 2024 21:54:41 +0000
Subject: [PATCH 1/2] [gn build] Enable hwasan for aarch64 Android

---
 llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn    |  3 +++
 .../gn/secondary/compiler-rt/lib/hwasan/BUILD.gn    | 13 +++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
index 57b86f53254f57..58f76d3def3db3 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
@@ -10,6 +10,9 @@ group("lib") {
   if (current_os == "linux" || current_os == "android") {
     deps += [ "//compiler-rt/lib/ubsan_minimal" ]
   }
+  if (current_os == "android" && current_cpu == "arm64") {
+    deps += [ "//compiler-rt/lib/hwasan" ]
+  }
   if (current_os != "baremetal") {
     deps += [
       "//compiler-rt/lib/asan",
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 e39d8114d1f473..f0e7330f34f680 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
@@ -11,7 +11,7 @@ gen_version_script("version_script") {
   extra = "hwasan.syms.extra"
   output = "$target_gen_dir/hwasan.vers"
   libs = [
-    ":hwasan",
+    ":hwasan_static",
     ":hwasan_cxx",
   ]
   lib_names = [
@@ -88,7 +88,7 @@ source_set("cxx_sources") {
   sources = [ "hwasan_new_delete.cpp" ]
 }
 
-static_library("hwasan") {
+static_library("hwasan_static") {
   output_dir = crt_current_out_dir
   output_name = "clang_rt.$hwasan_name$crt_current_target_suffix"
   complete_static_lib = true
@@ -140,3 +140,12 @@ static_library("hwasan_preinit") {
   configs += [ "//llvm/utils/gn/build:crt_code" ]
   sources = [ "hwasan_preinit.cpp" ]
 }
+
+group("hwasan") {
+  deps = [
+    ":hwasan_preinit",
+    ":hwasan_shared",
+    ":hwasan_static",
+    ":hwasan_cxx",
+  ]
+}

>From 05b81801fd0ec54aa0d430a79d0193faf9e18628 Mon Sep 17 00:00:00 2001
From: Arthur Eubanks <aeubanks at google.com>
Date: Thu, 7 Nov 2024 00:15:32 +0000
Subject: [PATCH 2/2] add version_script

---
 llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn | 1 +
 1 file changed, 1 insertion(+)

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 f0e7330f34f680..0f1d3d2a50e34c 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
@@ -147,5 +147,6 @@ group("hwasan") {
     ":hwasan_shared",
     ":hwasan_static",
     ":hwasan_cxx",
+    ":version_script",
   ]
 }



More information about the llvm-commits mailing list