Skip to content

Commit 73e6f9f

Browse files
authored
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
1 parent 6b931ab commit 73e6f9f

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ shared_library("hwasan_shared") {
120120

121121
static_library("hwasan_preinit") {
122122
output_dir = crt_current_out_dir
123-
output_name = "clang_rt.${hwasan_name}_preinit$crt_current_target_suffix"
123+
output_name = "clang_rt.${hwasan_name}-preinit$crt_current_target_suffix"
124124
complete_static_lib = true
125125
configs -= [
126126
"//llvm/utils/gn/build:llvm_code",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ if (current_toolchain != host_toolchain) {
3838
"//compiler-rt/include($host_toolchain)",
3939
"//compiler-rt/lib/cfi:ignorelist($host_toolchain)",
4040
"//compiler-rt/lib/hwasan:hwasan_shared",
41+
"//compiler-rt/lib/hwasan:hwasan_preinit",
4142
"//compiler-rt/test:lit_common_configured",
4243
"//llvm/utils/FileCheck($host_toolchain)",
4344
"//llvm/utils/llvm-lit($host_toolchain)",

0 commit comments

Comments
 (0)