aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgenii Stepanov <eugenis@google.com>2016-05-12 13:54:53 -0700
committerEvgenii Stepanov <eugenis@google.com>2016-05-12 13:54:53 -0700
commit0a8a0d09d1f041a155c8090f632b1236f8ab1c0e (patch)
tree16398b315730e0f0391c3cc697b8d15a127a10ac
parentac6697420aebc6e7f98d5a73c8d4c525bf8de419 (diff)
downloadbuild_soong-0a8a0d09d1f041a155c8090f632b1236f8ab1c0e.tar.gz
build_soong-0a8a0d09d1f041a155c8090f632b1236f8ab1c0e.tar.bz2
build_soong-0a8a0d09d1f041a155c8090f632b1236f8ab1c0e.zip
Support SANITIZE_TARGET=safe-stack in soong.
Change-Id: I570a7033ece82c5e76815dc1b81622b481930de4
-rw-r--r--cc/sanitize.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 670443bf..94c56ce6 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -59,6 +59,7 @@ type SanitizeProperties struct {
All_undefined bool `android:"arch_variant"`
Misc_undefined []string `android:"arch_variant"`
Coverage bool `android:"arch_variant"`
+ SafeStack bool `android:"arch_variant"`
// value to pass to -fsantitize-recover=
Recover []string
@@ -127,15 +128,20 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
sanitize.Properties.Sanitize.Coverage = true
}
+ if found, globalSanitizers = removeFromList("safe-stack", globalSanitizers); found {
+ sanitize.Properties.Sanitize.SafeStack = true
+ }
+
if len(globalSanitizers) > 0 {
ctx.ModuleErrorf("unknown global sanitizer option %s", globalSanitizers[0])
}
sanitize.Properties.SanitizerEnabled = true
}
- if !ctx.toolchain().Is64Bit() && sanitize.Properties.Sanitize.Thread {
- // TSAN is not supported on 32-bit architectures
+ if !ctx.toolchain().Is64Bit() {
+ // TSAN and SafeStack are not supported on 32-bit architectures
sanitize.Properties.Sanitize.Thread = false
+ sanitize.Properties.Sanitize.SafeStack = false
// TODO(ccross): error for compile_multilib = "32"?
}
@@ -239,6 +245,10 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
flags.CFlags = append(flags.CFlags, "-fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp")
}
+ if sanitize.Properties.Sanitize.SafeStack {
+ sanitizers = append(sanitizers, "safe-stack")
+ }
+
if sanitize.Properties.Sanitize.Recover != nil {
flags.CFlags = append(flags.CFlags, "-fsanitize-recover="+
strings.Join(sanitize.Properties.Sanitize.Recover, ","))