Add support for sanitizer property
Add a new feature to cc modules that adds the cflags and libraries
necessary to implement AddressSanitizer, ThreadSanitizer, and
UndefinedBehaviorSanitizer.
Change-Id: Ibe5ffadc7ece56080a2521f2c7c00da9ef712584
diff --git a/cc/builder.go b/cc/builder.go
index 38bb141..f67f9bd 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -133,6 +133,7 @@
conlyFlags string
cppFlags string
ldFlags string
+ libFlags string
yaccFlags string
nocrt bool
toolchain Toolchain
@@ -190,7 +191,7 @@
panic("unrecoginzied ccCmd")
}
- ccCmd = "${clangPath}/" + ccCmd
+ ccCmd = "${clangBin}/" + ccCmd
} else {
ccCmd = gccCmd(flags.toolchain, ccCmd)
}
@@ -288,7 +289,7 @@
var ldCmd string
if flags.clang {
- ldCmd = "${clangPath}/clang++"
+ ldCmd = "${clangBin}/clang++"
} else {
ldCmd = gccCmd(flags.toolchain, "g++")
}
@@ -296,6 +297,10 @@
var ldDirs []string
var libFlagsList []string
+ if len(flags.libFlags) > 0 {
+ libFlagsList = append(libFlagsList, flags.libFlags)
+ }
+
if len(wholeStaticLibs) > 0 {
if ctx.Host() && ctx.Darwin() {
libFlagsList = append(libFlagsList, common.JoinWithPrefix(wholeStaticLibs.Strings(), "-force_load "))
@@ -359,7 +364,7 @@
var ldCmd string
if flags.clang {
- ldCmd = "${clangPath}clang++"
+ ldCmd = "${clangBin}clang++"
} else {
ldCmd = gccCmd(flags.toolchain, "g++")
}