[llvm] bea2f25 - [gn build] Port win asan runtime rules (#108293)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 12 10:11:44 PDT 2024
Author: Arthur Eubanks
Date: 2024-09-12T10:11:40-07:00
New Revision: bea2f2511b69521dc73766b8e3503f11e378113b
URL: https://github.com/llvm/llvm-project/commit/bea2f2511b69521dc73766b8e3503f11e378113b
DIFF: https://github.com/llvm/llvm-project/commit/bea2f2511b69521dc73766b8e3503f11e378113b.diff
LOG: [gn build] Port win asan runtime rules (#108293)
Windows doesn't have a static runtime after #107899.
Added:
Modified:
llvm/utils/gn/build/toolchain/target_flags.gni
llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
llvm/utils/gn/secondary/compiler-rt/lib/asan/BUILD.gn
Removed:
################################################################################
diff --git a/llvm/utils/gn/build/toolchain/target_flags.gni b/llvm/utils/gn/build/toolchain/target_flags.gni
index af8adcd2738668..cbfa22966b48f4 100644
--- a/llvm/utils/gn/build/toolchain/target_flags.gni
+++ b/llvm/utils/gn/build/toolchain/target_flags.gni
@@ -54,6 +54,6 @@ if (current_os == "android") {
target_flags += [ "--target=$llvm_current_triple" ]
}
-if (current_cpu == "x86") {
+if (current_cpu == "x86" && current_os != "win") {
target_flags += [ "-m32" ]
}
diff --git a/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
index d8c75a01c6945e..02c20483b7a8bd 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
@@ -10,16 +10,16 @@ group("lib") {
if (current_os == "linux" || current_os == "android") {
deps += [ "//compiler-rt/lib/ubsan_minimal" ]
}
- if (current_os != "win" && current_os != "baremetal") {
+ if (current_os != "baremetal") {
deps += [
"//compiler-rt/lib/asan",
- "//compiler-rt/lib/ubsan",
+ "//compiler-rt/lib/profile",
]
+ }
+ if (current_os != "win" && current_os != "baremetal") {
+ deps += [ "//compiler-rt/lib/ubsan" ]
if (current_cpu == "x64" || current_cpu == "arm64") {
deps += [ "//compiler-rt/lib/tsan/rtl" ]
}
}
- if (current_os != "baremetal") {
- deps += [ "//compiler-rt/lib/profile" ]
- }
}
diff --git a/llvm/utils/gn/secondary/compiler-rt/lib/asan/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/asan/BUILD.gn
index cf308753f0c825..42467c21aa24c7 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/asan/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/asan/BUILD.gn
@@ -60,12 +60,12 @@ if (current_toolchain == host_toolchain) {
"asan_thread.h",
"asan_win.cpp",
]
- if (target_os != "mac" && target_os != "win") {
+ if (current_os != "mac" && current_os != "win") {
asan_sources += [ "asan_interceptors_vfork.S" ]
}
config("asan_config") {
cflags = []
- if (target_os != "win") {
+ if (current_os != "win") {
cflags += [ "-ftls-model=initial-exec" ]
} else {
ldflags = [ "/OPT:NOICF" ]
@@ -76,11 +76,11 @@ if (current_toolchain == host_toolchain) {
# FIXME: add_sanitizer_rt_version_list (cf hwasan)
# FIXME: need libclang_rt.asan*.a.syms?
- if (target_os == "android") {
+ if (current_os == "android") {
ldflags = [ "-Wl,-z,global" ]
}
- if (target_os == "mac") {
+ if (current_os == "mac") {
# The -U flags below correspond to the add_weak_symbols() calls in CMake.
ldflags = [
"-lc++",
@@ -145,7 +145,7 @@ if (current_toolchain == host_toolchain) {
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
configs += [ "//llvm/utils/gn/build:crt_code" ]
sources = [ "asan_rtl_static.cpp" ]
- if (target_os != "mac" && target_os != "win") {
+ if (current_os != "mac" && current_os != "win") {
sources += [ "asan_rtl_x86_64.S" ]
}
}
@@ -183,7 +183,7 @@ if (current_toolchain == host_toolchain) {
}
}
- if (current_os != "mac") {
+ if (current_os != "mac" && current_os != "win") {
static_library("asan_static_library") {
output_dir = crt_current_out_dir
output_name = "clang_rt.asan$crt_current_target_suffix"
@@ -232,7 +232,8 @@ if (current_toolchain == host_toolchain) {
if (current_os == "win") {
static_library("asan_static_runtime_thunk") {
output_dir = crt_current_out_dir
- output_name = "clang_rt.asan_static_runtime_thunk$crt_current_target_suffix"
+ output_name =
+ "clang_rt.asan_static_runtime_thunk$crt_current_target_suffix"
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
configs += [ "//llvm/utils/gn/build:crt_code" ]
complete_static_lib = true
@@ -277,11 +278,11 @@ if (current_toolchain == host_toolchain) {
deps = [ ":asan_shared_library" ]
if (current_os == "win") {
deps += [
- ":asan_static_runtime_thunk",
":asan_dynamic_runtime_thunk",
+ ":asan_static_runtime_thunk",
]
}
- if (current_os != "mac") {
+ if (current_os != "mac" && current_os != "win") {
deps += [
":asan_cxx",
":asan_preinit",
More information about the llvm-commits
mailing list