Iterate over sanitizers
Test: go test soong tests Change-Id: If89b7d0b04cad79b42a08504d4fcff36e914b7a4
This commit is contained in:
22
cc/cc.go
22
cc/cc.go
@@ -53,25 +53,9 @@ func RegisterCCBuildComponents(ctx android.RegistrationContext) {
|
||||
})
|
||||
|
||||
ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||
ctx.TopDown("asan_deps", sanitizerDepsMutator(Asan))
|
||||
ctx.BottomUp("asan", sanitizerMutator(Asan)).Parallel()
|
||||
|
||||
ctx.TopDown("hwasan_deps", sanitizerDepsMutator(Hwasan))
|
||||
ctx.BottomUp("hwasan", sanitizerMutator(Hwasan)).Parallel()
|
||||
|
||||
ctx.TopDown("fuzzer_deps", sanitizerDepsMutator(Fuzzer))
|
||||
ctx.BottomUp("fuzzer", sanitizerMutator(Fuzzer)).Parallel()
|
||||
|
||||
// cfi mutator shouldn't run before sanitizers that return true for
|
||||
// incompatibleWithCfi()
|
||||
ctx.TopDown("cfi_deps", sanitizerDepsMutator(cfi))
|
||||
ctx.BottomUp("cfi", sanitizerMutator(cfi)).Parallel()
|
||||
|
||||
ctx.TopDown("scs_deps", sanitizerDepsMutator(scs))
|
||||
ctx.BottomUp("scs", sanitizerMutator(scs)).Parallel()
|
||||
|
||||
ctx.TopDown("tsan_deps", sanitizerDepsMutator(tsan))
|
||||
ctx.BottomUp("tsan", sanitizerMutator(tsan)).Parallel()
|
||||
for _, san := range Sanitizers {
|
||||
san.registerMutators(ctx)
|
||||
}
|
||||
|
||||
ctx.TopDown("sanitize_runtime_deps", sanitizerRuntimeDepsMutator).Parallel()
|
||||
ctx.BottomUp("sanitize_runtime", sanitizerRuntimeMutator).Parallel()
|
||||
|
@@ -79,12 +79,23 @@ const (
|
||||
Hwasan
|
||||
tsan
|
||||
intOverflow
|
||||
cfi
|
||||
scs
|
||||
Fuzzer
|
||||
memtag_heap
|
||||
cfi // cfi is last to prevent it running before incompatible mutators
|
||||
)
|
||||
|
||||
var Sanitizers = []SanitizerType{
|
||||
Asan,
|
||||
Hwasan,
|
||||
tsan,
|
||||
intOverflow,
|
||||
scs,
|
||||
Fuzzer,
|
||||
memtag_heap,
|
||||
cfi, // cfi is last to prevent it running before incompatible mutators
|
||||
}
|
||||
|
||||
// Name of the sanitizer variation for this sanitizer type
|
||||
func (t SanitizerType) variationName() string {
|
||||
switch t {
|
||||
@@ -133,6 +144,18 @@ func (t SanitizerType) name() string {
|
||||
}
|
||||
}
|
||||
|
||||
func (t SanitizerType) registerMutators(ctx android.RegisterMutatorsContext) {
|
||||
switch t {
|
||||
case Asan, Hwasan, Fuzzer, scs, tsan, cfi:
|
||||
ctx.TopDown(t.variationName()+"_deps", sanitizerDepsMutator(t))
|
||||
ctx.BottomUp(t.variationName(), sanitizerMutator(t))
|
||||
case memtag_heap, intOverflow:
|
||||
// do nothing
|
||||
default:
|
||||
panic(fmt.Errorf("unknown SanitizerType %d", t))
|
||||
}
|
||||
}
|
||||
|
||||
func (*Module) SanitizerSupported(t SanitizerType) bool {
|
||||
switch t {
|
||||
case Asan:
|
||||
|
Reference in New Issue
Block a user