CFI include/exclude path support (Soong) am: 1fa3ac552d am: fbfc32ea1b
am: 3caa24c44c
Change-Id: I25301cf069f730dcf32465cdb6dec7be65b3c9b7
This commit is contained in:
@@ -187,7 +187,9 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
|
||||
}
|
||||
|
||||
if found, globalSanitizers = removeFromList("cfi", globalSanitizers); found && s.Cfi == nil {
|
||||
s.Cfi = boolPtr(true)
|
||||
if !ctx.AConfig().CFIDisabledForPath(ctx.ModuleDir()) {
|
||||
s.Cfi = boolPtr(true)
|
||||
}
|
||||
}
|
||||
|
||||
if found, globalSanitizers = removeFromList("integer_overflow", globalSanitizers); found && s.Integer_overflow == nil {
|
||||
@@ -205,11 +207,24 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
|
||||
s.Diag.Integer_overflow = boolPtr(true)
|
||||
}
|
||||
|
||||
if found, globalSanitizersDiag = removeFromList("cfi", globalSanitizersDiag); found &&
|
||||
s.Diag.Cfi == nil && Bool(s.Cfi) {
|
||||
s.Diag.Cfi = boolPtr(true)
|
||||
}
|
||||
|
||||
if len(globalSanitizersDiag) > 0 {
|
||||
ctx.ModuleErrorf("unknown global sanitizer diagnostics option %s", globalSanitizersDiag[0])
|
||||
}
|
||||
}
|
||||
|
||||
// Enable CFI for all components in the include paths
|
||||
if s.Cfi == nil && ctx.AConfig().CFIEnabledForPath(ctx.ModuleDir()) {
|
||||
s.Cfi = boolPtr(true)
|
||||
if inList("cfi", ctx.AConfig().SanitizeDeviceDiag()) {
|
||||
s.Diag.Cfi = boolPtr(true)
|
||||
}
|
||||
}
|
||||
|
||||
// CFI needs gold linker, and mips toolchain does not have one.
|
||||
if !ctx.AConfig().EnableCFI() || ctx.Arch().ArchType == android.Mips || ctx.Arch().ArchType == android.Mips64 {
|
||||
s.Cfi = nil
|
||||
|
||||
Reference in New Issue
Block a user