blob: b98797a7a89722d3120d57b143d02ec4fa91dc0b [file] [log] [blame]
Colin Cross16b23492016-01-06 14:41:07 -08001// Copyright 2016 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package cc
16
17import (
18 "fmt"
19 "strings"
20
21 "github.com/google/blueprint"
22
Colin Cross635c3b02016-05-18 15:37:25 -070023 "android/soong/android"
Evgenii Stepanovaf36db12016-08-15 14:18:24 -070024 "android/soong/cc/config"
Colin Cross16b23492016-01-06 14:41:07 -080025)
26
Dan Willemsencbceaab2016-10-13 16:44:07 -070027const (
Dan Willemsen78ffeea2016-10-20 18:46:48 -070028 asanCflags = "-fno-omit-frame-pointer"
Dan Willemsencbceaab2016-10-13 16:44:07 -070029 asanLdflags = "-Wl,-u,__asan_preinit"
Dan Willemsen78ffeea2016-10-20 18:46:48 -070030 asanLibs = "libasan"
Dan Willemsencbceaab2016-10-13 16:44:07 -070031)
32
Colin Cross16b23492016-01-06 14:41:07 -080033type sanitizerType int
34
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -070035func boolPtr(v bool) *bool {
36 if v {
37 return &v
38 } else {
39 return nil
40 }
41}
42
Colin Cross16b23492016-01-06 14:41:07 -080043const (
44 asan sanitizerType = iota + 1
45 tsan
46)
47
48func (t sanitizerType) String() string {
49 switch t {
50 case asan:
51 return "asan"
52 case tsan:
53 return "tsan"
54 default:
55 panic(fmt.Errorf("unknown sanitizerType %d", t))
56 }
57}
58
59type SanitizeProperties struct {
60 // enable AddressSanitizer, ThreadSanitizer, or UndefinedBehaviorSanitizer
61 Sanitize struct {
62 Never bool `android:"arch_variant"`
63
64 // main sanitizers
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -070065 Address *bool `android:"arch_variant"`
66 Thread *bool `android:"arch_variant"`
Colin Cross16b23492016-01-06 14:41:07 -080067
68 // local sanitizers
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -070069 Undefined *bool `android:"arch_variant"`
70 All_undefined *bool `android:"arch_variant"`
Colin Cross16b23492016-01-06 14:41:07 -080071 Misc_undefined []string `android:"arch_variant"`
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -070072 Coverage *bool `android:"arch_variant"`
73 Safestack *bool `android:"arch_variant"`
Evgenii Stepanov1e405e12016-08-16 15:39:54 -070074 Cfi *bool `android:"arch_variant"`
Colin Cross16b23492016-01-06 14:41:07 -080075
Evgenii Stepanov1e405e12016-08-16 15:39:54 -070076 // Sanitizers to run in the diagnostic mode (as opposed to the release mode).
77 // Replaces abort() on error with a human-readable error message.
78 // Address and Thread sanitizers always run in diagnostic mode.
79 Diag struct {
80 Undefined *bool `android:"arch_variant"`
81 Cfi *bool `android:"arch_variant"`
82 }
83
84 // value to pass to -fsanitize-recover=
Colin Cross16b23492016-01-06 14:41:07 -080085 Recover []string
86
87 // value to pass to -fsanitize-blacklist
88 Blacklist *string
89 } `android:"arch_variant"`
90
91 SanitizerEnabled bool `blueprint:"mutated"`
92 SanitizeDep bool `blueprint:"mutated"`
Colin Cross30d5f512016-05-03 18:02:42 -070093 InData bool `blueprint:"mutated"`
Colin Cross16b23492016-01-06 14:41:07 -080094}
95
96type sanitize struct {
97 Properties SanitizeProperties
98}
99
100func (sanitize *sanitize) props() []interface{} {
101 return []interface{}{&sanitize.Properties}
102}
103
104func (sanitize *sanitize) begin(ctx BaseModuleContext) {
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700105 s := &sanitize.Properties.Sanitize
106
Colin Cross16b23492016-01-06 14:41:07 -0800107 // Don't apply sanitizers to NDK code.
108 if ctx.sdk() {
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700109 s.Never = true
Colin Cross16b23492016-01-06 14:41:07 -0800110 }
111
112 // Never always wins.
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700113 if s.Never {
Colin Cross16b23492016-01-06 14:41:07 -0800114 return
115 }
116
Colin Cross16b23492016-01-06 14:41:07 -0800117 var globalSanitizers []string
118 if ctx.clang() {
119 if ctx.Host() {
120 globalSanitizers = ctx.AConfig().SanitizeHost()
121 } else {
Colin Cross23ae82a2016-11-02 14:34:39 -0700122 arches := ctx.AConfig().SanitizeDeviceArch()
123 if len(arches) == 0 || inList(ctx.Arch().ArchType.Name, arches) {
124 globalSanitizers = ctx.AConfig().SanitizeDevice()
125 }
Colin Cross16b23492016-01-06 14:41:07 -0800126 }
127 }
128
Colin Cross16b23492016-01-06 14:41:07 -0800129 if len(globalSanitizers) > 0 {
Evgenii Stepanov05bafd32016-07-07 17:38:41 +0000130 var found bool
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700131 if found, globalSanitizers = removeFromList("undefined", globalSanitizers); found && s.All_undefined == nil {
132 s.All_undefined = boolPtr(true)
Evgenii Stepanov05bafd32016-07-07 17:38:41 +0000133 }
Colin Cross16b23492016-01-06 14:41:07 -0800134
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700135 if found, globalSanitizers = removeFromList("default-ub", globalSanitizers); found && s.Undefined == nil {
136 s.Undefined = boolPtr(true)
Evgenii Stepanov05bafd32016-07-07 17:38:41 +0000137 }
138
Evgenii Stepanov774cb812016-12-28 15:52:54 -0800139 if found, globalSanitizers = removeFromList("address", globalSanitizers); found {
140 if s.Address == nil {
141 s.Address = boolPtr(true)
142 } else if *s.Address == false {
143 // Coverage w/o address is an error. If globalSanitizers includes both, and the module
144 // disables address, then disable coverage as well.
145 _, globalSanitizers = removeFromList("coverage", globalSanitizers)
146 }
Evgenii Stepanov05bafd32016-07-07 17:38:41 +0000147 }
148
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700149 if found, globalSanitizers = removeFromList("thread", globalSanitizers); found && s.Thread == nil {
150 s.Thread = boolPtr(true)
Evgenii Stepanov05bafd32016-07-07 17:38:41 +0000151 }
152
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700153 if found, globalSanitizers = removeFromList("coverage", globalSanitizers); found && s.Coverage == nil {
154 s.Coverage = boolPtr(true)
155 }
156
157 if found, globalSanitizers = removeFromList("safe-stack", globalSanitizers); found && s.Safestack == nil {
158 s.Safestack = boolPtr(true)
Evgenii Stepanov05bafd32016-07-07 17:38:41 +0000159 }
160
Evgenii Stepanov1e405e12016-08-16 15:39:54 -0700161 if found, globalSanitizers = removeFromList("cfi", globalSanitizers); found && s.Cfi == nil {
162 s.Cfi = boolPtr(true)
163 }
164
Evgenii Stepanov05bafd32016-07-07 17:38:41 +0000165 if len(globalSanitizers) > 0 {
166 ctx.ModuleErrorf("unknown global sanitizer option %s", globalSanitizers[0])
167 }
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700168 }
Colin Cross3c344ef2016-07-18 15:44:56 -0700169
Evgenii Stepanova83fdac2017-01-31 18:37:30 -0800170 // CFI needs gold linker, and mips toolchain does not have one.
171 if !ctx.AConfig().EnableCFI() || ctx.Arch().ArchType == android.Mips || ctx.Arch().ArchType == android.Mips64 {
Vishwath Mohan1b017a72017-01-19 13:54:55 -0800172 s.Cfi = nil
173 s.Diag.Cfi = nil
174 }
175
Colin Cross3c344ef2016-07-18 15:44:56 -0700176 if ctx.staticBinary() {
177 s.Address = nil
Colin Cross91169fe2016-08-11 15:54:20 -0700178 s.Coverage = nil
Colin Cross3c344ef2016-07-18 15:44:56 -0700179 s.Thread = nil
Colin Cross16b23492016-01-06 14:41:07 -0800180 }
181
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700182 if Bool(s.All_undefined) {
183 s.Undefined = nil
184 }
185
Evgenii Stepanov0a8a0d02016-05-12 13:54:53 -0700186 if !ctx.toolchain().Is64Bit() {
187 // TSAN and SafeStack are not supported on 32-bit architectures
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700188 s.Thread = nil
189 s.Safestack = nil
Colin Cross16b23492016-01-06 14:41:07 -0800190 // TODO(ccross): error for compile_multilib = "32"?
191 }
192
Colin Cross3c344ef2016-07-18 15:44:56 -0700193 if Bool(s.All_undefined) || Bool(s.Undefined) || Bool(s.Address) ||
Evgenii Stepanov1e405e12016-08-16 15:39:54 -0700194 Bool(s.Thread) || Bool(s.Coverage) || Bool(s.Safestack) || Bool(s.Cfi) {
Colin Cross3c344ef2016-07-18 15:44:56 -0700195 sanitize.Properties.SanitizerEnabled = true
196 }
197
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700198 if Bool(s.Coverage) {
199 if !Bool(s.Address) {
Colin Cross16b23492016-01-06 14:41:07 -0800200 ctx.ModuleErrorf(`Use of "coverage" also requires "address"`)
201 }
202 }
203}
204
205func (sanitize *sanitize) deps(ctx BaseModuleContext, deps Deps) Deps {
206 if !sanitize.Properties.SanitizerEnabled { // || c.static() {
207 return deps
208 }
209
210 if ctx.Device() {
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700211 if Bool(sanitize.Properties.Sanitize.Address) {
Dan Willemsencbceaab2016-10-13 16:44:07 -0700212 deps.StaticLibs = append(deps.StaticLibs, asanLibs)
Colin Cross16b23492016-01-06 14:41:07 -0800213 }
Colin Cross263abbd2016-07-15 13:10:48 -0700214 if Bool(sanitize.Properties.Sanitize.Address) || Bool(sanitize.Properties.Sanitize.Thread) {
215 deps.SharedLibs = append(deps.SharedLibs, "libdl")
216 }
Colin Cross16b23492016-01-06 14:41:07 -0800217 }
218
219 return deps
220}
221
222func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
223 if !sanitize.Properties.SanitizerEnabled {
224 return flags
225 }
226
227 if !ctx.clang() {
228 ctx.ModuleErrorf("Use of sanitizers requires clang")
229 }
230
231 var sanitizers []string
Evgenii Stepanov1e405e12016-08-16 15:39:54 -0700232 var diagSanitizers []string
Colin Cross16b23492016-01-06 14:41:07 -0800233
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700234 if Bool(sanitize.Properties.Sanitize.All_undefined) {
Colin Cross16b23492016-01-06 14:41:07 -0800235 sanitizers = append(sanitizers, "undefined")
236 if ctx.Device() {
237 ctx.ModuleErrorf("ubsan is not yet supported on the device")
238 }
239 } else {
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700240 if Bool(sanitize.Properties.Sanitize.Undefined) {
Colin Cross16b23492016-01-06 14:41:07 -0800241 sanitizers = append(sanitizers,
242 "bool",
243 "integer-divide-by-zero",
244 "return",
245 "returns-nonnull-attribute",
246 "shift-exponent",
247 "unreachable",
248 "vla-bound",
249 // TODO(danalbert): The following checks currently have compiler performance issues.
250 //"alignment",
251 //"bounds",
252 //"enum",
253 //"float-cast-overflow",
254 //"float-divide-by-zero",
255 //"nonnull-attribute",
256 //"null",
257 //"shift-base",
258 //"signed-integer-overflow",
259 // TODO(danalbert): Fix UB in libc++'s __tree so we can turn this on.
260 // https://llvm.org/PR19302
261 // http://reviews.llvm.org/D6974
262 // "object-size",
263 )
264 }
265 sanitizers = append(sanitizers, sanitize.Properties.Sanitize.Misc_undefined...)
266 }
267
Evgenii Stepanov1e405e12016-08-16 15:39:54 -0700268 if Bool(sanitize.Properties.Sanitize.Diag.Undefined) &&
269 (Bool(sanitize.Properties.Sanitize.All_undefined) ||
270 Bool(sanitize.Properties.Sanitize.Undefined) ||
271 len(sanitize.Properties.Sanitize.Misc_undefined) > 0) {
272 diagSanitizers = append(diagSanitizers, "undefined")
273 }
274
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700275 if Bool(sanitize.Properties.Sanitize.Address) {
Colin Cross635c3b02016-05-18 15:37:25 -0700276 if ctx.Arch().ArchType == android.Arm {
Colin Cross16b23492016-01-06 14:41:07 -0800277 // Frame pointer based unwinder in ASan requires ARM frame setup.
278 // TODO: put in flags?
279 flags.RequiredInstructionSet = "arm"
280 }
Dan Willemsencbceaab2016-10-13 16:44:07 -0700281 flags.CFlags = append(flags.CFlags, asanCflags)
282 flags.LdFlags = append(flags.LdFlags, asanLdflags)
Colin Cross16b23492016-01-06 14:41:07 -0800283
Colin Cross16b23492016-01-06 14:41:07 -0800284 if ctx.Host() {
285 // -nodefaultlibs (provided with libc++) prevents the driver from linking
286 // libraries needed with -fsanitize=address. http://b/18650275 (WAI)
287 flags.LdFlags = append(flags.LdFlags, "-lm", "-lpthread")
288 flags.LdFlags = append(flags.LdFlags, "-Wl,--no-as-needed")
Colin Cross46974e22016-10-20 12:41:14 -0700289 // Host ASAN only links symbols in the final executable, so
290 // there will always be undefined symbols in intermediate libraries.
291 _, flags.LdFlags = removeFromList("-Wl,--no-undefined", flags.LdFlags)
Colin Cross16b23492016-01-06 14:41:07 -0800292 } else {
293 flags.CFlags = append(flags.CFlags, "-mllvm", "-asan-globals=0")
294 flags.DynamicLinker = "/system/bin/linker_asan"
295 if flags.Toolchain.Is64Bit() {
296 flags.DynamicLinker += "64"
297 }
298 }
299 sanitizers = append(sanitizers, "address")
Evgenii Stepanov1e405e12016-08-16 15:39:54 -0700300 diagSanitizers = append(diagSanitizers, "address")
Colin Cross16b23492016-01-06 14:41:07 -0800301 }
302
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700303 if Bool(sanitize.Properties.Sanitize.Coverage) {
Colin Cross16b23492016-01-06 14:41:07 -0800304 flags.CFlags = append(flags.CFlags, "-fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp")
305 }
306
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700307 if Bool(sanitize.Properties.Sanitize.Safestack) {
Evgenii Stepanov0a8a0d02016-05-12 13:54:53 -0700308 sanitizers = append(sanitizers, "safe-stack")
309 }
310
Evgenii Stepanov1e405e12016-08-16 15:39:54 -0700311 if Bool(sanitize.Properties.Sanitize.Cfi) {
Evgenii Stepanov7ebf9fa2017-01-20 14:13:06 -0800312 if ctx.Arch().ArchType == android.Arm {
313 // __cfi_check needs to be built as Thumb (see the code in linker_cfi.cpp). LLVM is not set up
314 // to do this on a function basis, so force Thumb on the entire module.
315 flags.RequiredInstructionSet = "thumb"
Evgenii Stepanova83fdac2017-01-31 18:37:30 -0800316 // Workaround for b/33678192. CFI jumptables need Thumb2 codegen. Revert when
317 // Clang is updated past r290384.
318 flags.LdFlags = append(flags.LdFlags, "-march=armv7-a")
Evgenii Stepanov7ebf9fa2017-01-20 14:13:06 -0800319 }
Evgenii Stepanov1e405e12016-08-16 15:39:54 -0700320 sanitizers = append(sanitizers, "cfi")
321 cfiFlags := []string{"-flto", "-fsanitize=cfi", "-fsanitize-cfi-cross-dso"}
322 flags.CFlags = append(flags.CFlags, cfiFlags...)
323 flags.CFlags = append(flags.CFlags, "-fvisibility=default")
324 flags.LdFlags = append(flags.LdFlags, cfiFlags...)
325 // FIXME: revert the __cfi_check flag when clang is updated to r280031.
326 flags.LdFlags = append(flags.LdFlags, "-Wl,-plugin-opt,O1", "-Wl,-export-dynamic-symbol=__cfi_check")
327 if Bool(sanitize.Properties.Sanitize.Diag.Cfi) {
328 diagSanitizers = append(diagSanitizers, "cfi")
329 }
330 }
331
Colin Cross16b23492016-01-06 14:41:07 -0800332 if sanitize.Properties.Sanitize.Recover != nil {
333 flags.CFlags = append(flags.CFlags, "-fsanitize-recover="+
334 strings.Join(sanitize.Properties.Sanitize.Recover, ","))
335 }
336
337 if len(sanitizers) > 0 {
338 sanitizeArg := "-fsanitize=" + strings.Join(sanitizers, ",")
339 flags.CFlags = append(flags.CFlags, sanitizeArg)
340 if ctx.Host() {
341 flags.CFlags = append(flags.CFlags, "-fno-sanitize-recover=all")
342 flags.LdFlags = append(flags.LdFlags, sanitizeArg)
343 flags.LdFlags = append(flags.LdFlags, "-lrt", "-ldl")
344 } else {
Colin Cross263abbd2016-07-15 13:10:48 -0700345 flags.CFlags = append(flags.CFlags, "-fsanitize-trap=all", "-ftrap-function=abort")
Colin Cross16b23492016-01-06 14:41:07 -0800346 }
347 }
348
Evgenii Stepanov1e405e12016-08-16 15:39:54 -0700349 if len(diagSanitizers) > 0 {
350 flags.CFlags = append(flags.CFlags, "-fno-sanitize-trap="+strings.Join(diagSanitizers, ","))
351 }
352 // FIXME: enable RTTI if diag + (cfi or vptr)
353
354 // Link a runtime library if needed.
355 runtimeLibrary := ""
356 if Bool(sanitize.Properties.Sanitize.Address) {
357 runtimeLibrary = config.AddressSanitizerRuntimeLibrary(ctx.toolchain())
358 } else if len(diagSanitizers) > 0 {
359 runtimeLibrary = config.UndefinedBehaviorSanitizerRuntimeLibrary(ctx.toolchain())
360 }
361
362 // ASan runtime library must be the first in the link order.
363 if runtimeLibrary != "" {
364 flags.libFlags = append([]string{"${config.ClangAsanLibDir}/" + runtimeLibrary}, flags.libFlags...)
365 }
366
Colin Cross635c3b02016-05-18 15:37:25 -0700367 blacklist := android.OptionalPathForModuleSrc(ctx, sanitize.Properties.Sanitize.Blacklist)
Colin Cross16b23492016-01-06 14:41:07 -0800368 if blacklist.Valid() {
369 flags.CFlags = append(flags.CFlags, "-fsanitize-blacklist="+blacklist.String())
370 flags.CFlagsDeps = append(flags.CFlagsDeps, blacklist.Path())
371 }
372
373 return flags
374}
375
Colin Cross30d5f512016-05-03 18:02:42 -0700376func (sanitize *sanitize) inData() bool {
377 return sanitize.Properties.InData
378}
379
Colin Cross16b23492016-01-06 14:41:07 -0800380func (sanitize *sanitize) Sanitizer(t sanitizerType) bool {
381 if sanitize == nil {
382 return false
383 }
384
385 switch t {
386 case asan:
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700387 return Bool(sanitize.Properties.Sanitize.Address)
Colin Cross16b23492016-01-06 14:41:07 -0800388 case tsan:
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700389 return Bool(sanitize.Properties.Sanitize.Thread)
Colin Cross16b23492016-01-06 14:41:07 -0800390 default:
391 panic(fmt.Errorf("unknown sanitizerType %d", t))
392 }
393}
394
395func (sanitize *sanitize) SetSanitizer(t sanitizerType, b bool) {
396 switch t {
397 case asan:
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700398 sanitize.Properties.Sanitize.Address = boolPtr(b)
Colin Cross91169fe2016-08-11 15:54:20 -0700399 if !b {
400 sanitize.Properties.Sanitize.Coverage = nil
401 }
Colin Cross16b23492016-01-06 14:41:07 -0800402 case tsan:
Evgenii Stepanovfcfe56d2016-07-07 10:54:07 -0700403 sanitize.Properties.Sanitize.Thread = boolPtr(b)
Colin Cross16b23492016-01-06 14:41:07 -0800404 default:
405 panic(fmt.Errorf("unknown sanitizerType %d", t))
406 }
407 if b {
408 sanitize.Properties.SanitizerEnabled = true
409 }
410}
411
412// Propagate asan requirements down from binaries
Colin Cross635c3b02016-05-18 15:37:25 -0700413func sanitizerDepsMutator(t sanitizerType) func(android.TopDownMutatorContext) {
414 return func(mctx android.TopDownMutatorContext) {
Colin Cross16b23492016-01-06 14:41:07 -0800415 if c, ok := mctx.Module().(*Module); ok && c.sanitize.Sanitizer(t) {
416 mctx.VisitDepsDepthFirst(func(module blueprint.Module) {
417 if d, ok := mctx.Module().(*Module); ok && c.sanitize != nil &&
418 !c.sanitize.Properties.Sanitize.Never {
419 d.sanitize.Properties.SanitizeDep = true
420 }
421 })
422 }
423 }
424}
425
426// Create asan variants for modules that need them
Colin Cross635c3b02016-05-18 15:37:25 -0700427func sanitizerMutator(t sanitizerType) func(android.BottomUpMutatorContext) {
428 return func(mctx android.BottomUpMutatorContext) {
Colin Cross16b23492016-01-06 14:41:07 -0800429 if c, ok := mctx.Module().(*Module); ok && c.sanitize != nil {
Colin Crossb916a382016-07-29 17:28:03 -0700430 if c.isDependencyRoot() && c.sanitize.Sanitizer(t) {
Colin Cross30d5f512016-05-03 18:02:42 -0700431 modules := mctx.CreateVariations(t.String())
432 modules[0].(*Module).sanitize.SetSanitizer(t, true)
Colin Cross16b23492016-01-06 14:41:07 -0800433 } else if c.sanitize.Properties.SanitizeDep {
Colin Crossb0f28952016-09-19 16:46:53 -0700434 modules := mctx.CreateVariations("", t.String())
435 modules[0].(*Module).sanitize.SetSanitizer(t, false)
436 modules[1].(*Module).sanitize.SetSanitizer(t, true)
437 modules[0].(*Module).sanitize.Properties.SanitizeDep = false
438 modules[1].(*Module).sanitize.Properties.SanitizeDep = false
439 if mctx.Device() {
Colin Crossb36ab1a2016-05-25 12:35:53 -0700440 modules[1].(*Module).sanitize.Properties.InData = true
Colin Crossb0f28952016-09-19 16:46:53 -0700441 } else {
442 modules[0].(*Module).Properties.PreventInstall = true
443 }
444 if mctx.AConfig().EmbeddedInMake() {
445 modules[0].(*Module).Properties.HideFromMake = true
Colin Cross30d5f512016-05-03 18:02:42 -0700446 }
Colin Cross16b23492016-01-06 14:41:07 -0800447 }
448 c.sanitize.Properties.SanitizeDep = false
449 }
450 }
451}