[llvm] 73e6f9f - gn: hwasan: fixup hwasan-preinit (#96748)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 23:03:25 PDT 2024


Author: Mitch Phillips
Date: 2024-06-27T08:03:20+02:00
New Revision: 73e6f9f95b51d7be1f93deded219005027f8d270

URL: https://github.com/llvm/llvm-project/commit/73e6f9f95b51d7be1f93deded219005027f8d270
DIFF: https://github.com/llvm/llvm-project/commit/73e6f9f95b51d7be1f93deded219005027f8d270.diff

LOG: gn: hwasan: fixup hwasan-preinit (#96748)

The build rule for hwasan_preinit outputs libclang_rt.hwasan_preinit,
but clang expects hwasan-preinit (with a dash, rather than an
underscore) when selecting the library in the frontend.

Also, we were missing the hwasan-preinit dependency in check-hwasan.

For posterity, this now passes hwasan unit tests on Android with:
 $ cat args.gn
clang_base_path = "/usr/local"
llvm_enable_assertions = true
llvm_targets_to_build = "all"
android_ndk_path = "/path/to/Android.sdk/ndk/25.2.9519653"
 $ /path/to/llvm/utils/gn/gn.py gen build
 $ ANDROID_SERIAL=xxx ninja -C build check-hwasan

Added: 
    

Modified: 
    llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
    llvm/utils/gn/secondary/compiler-rt/test/hwasan/BUILD.gn

Removed: 
    


################################################################################
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 e9ba76d2a517d..25ea55e768b9f 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
@@ -120,7 +120,7 @@ shared_library("hwasan_shared") {
 
 static_library("hwasan_preinit") {
   output_dir = crt_current_out_dir
-  output_name = "clang_rt.${hwasan_name}_preinit$crt_current_target_suffix"
+  output_name = "clang_rt.${hwasan_name}-preinit$crt_current_target_suffix"
   complete_static_lib = true
   configs -= [
     "//llvm/utils/gn/build:llvm_code",

diff  --git a/llvm/utils/gn/secondary/compiler-rt/test/hwasan/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/test/hwasan/BUILD.gn
index cb1969ede6526..59ed1d1480967 100644
--- a/llvm/utils/gn/secondary/compiler-rt/test/hwasan/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/test/hwasan/BUILD.gn
@@ -38,6 +38,7 @@ if (current_toolchain != host_toolchain) {
       "//compiler-rt/include($host_toolchain)",
       "//compiler-rt/lib/cfi:ignorelist($host_toolchain)",
       "//compiler-rt/lib/hwasan:hwasan_shared",
+      "//compiler-rt/lib/hwasan:hwasan_preinit",
       "//compiler-rt/test:lit_common_configured",
       "//llvm/utils/FileCheck($host_toolchain)",
       "//llvm/utils/llvm-lit($host_toolchain)",


        


More information about the llvm-commits mailing list