[PATCH] D60722: gn build: Add a `use_asan` build arg that can be used to build asanified clangs and llds
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 15 10:11:29 PDT 2019
thakis created this revision.
thakis added a reviewer: pcc.
Herald added a project: LLVM.
As-is, this also builds an asanified hwasan runtime. Not sure if that's good or not.
https://reviews.llvm.org/D60722
Files:
llvm/utils/gn/build/BUILD.gn
Index: llvm/utils/gn/build/BUILD.gn
===================================================================
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -3,6 +3,11 @@
import("//llvm/utils/gn/build/toolchain/compiler.gni")
import("//llvm/utils/gn/build/toolchain/target_flags.gni")
+declare_args() {
+ # Build all targets with -fsanitize=address.
+ use_asan = false
+}
+
config("compiler_defaults") {
defines = []
@@ -33,7 +38,13 @@
"-std=c++11",
"-fvisibility-inlines-hidden",
]
+
+ if (use_asan) {
+ cflags += [ "-fsanitize=address" ]
+ ldflags += [ "-fsanitize=address" ]
+ }
} else {
+ assert(!use_asan, "use_asan=true not yet implemented for Windows")
if (is_debug) {
cflags += [
"/Zi",
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60722.195215.patch
Type: text/x-patch
Size: 785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190415/2c4de352/attachment-0001.bin>
More information about the llvm-commits
mailing list