Export sanitizer paths to Make
system/core/rootdir/Android.mk writes a list of sanitizer libraries to sanitizer.libraries.txt, and assumes that they are installed with the same name as the module. The next patch renames the module to be the same for all architectures while keeping the installed name as is. Collect the output file names of the libraries to export to make. Bug: 220019988 Test: m out/target/produuct/coral/system/etc/sanitizer.libraries.txt Change-Id: Idc51c2ad6f914977a286fe4e2fcb457bc1229339
This commit is contained in:
@@ -259,14 +259,43 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
|
|||||||
}, " "))
|
}, " "))
|
||||||
|
|
||||||
if target.Os.Class == android.Device {
|
if target.Os.Class == android.Device {
|
||||||
ctx.Strict(secondPrefix+"ADDRESS_SANITIZER_RUNTIME_LIBRARY", strings.TrimSuffix(config.AddressSanitizerRuntimeLibrary(toolchain), ".so"))
|
sanitizerVariables := map[string]string{
|
||||||
ctx.Strict(secondPrefix+"HWADDRESS_SANITIZER_RUNTIME_LIBRARY", strings.TrimSuffix(config.HWAddressSanitizerRuntimeLibrary(toolchain), ".so"))
|
"ADDRESS_SANITIZER_RUNTIME_LIBRARY": config.AddressSanitizerRuntimeLibrary(toolchain),
|
||||||
ctx.Strict(secondPrefix+"HWADDRESS_SANITIZER_STATIC_LIBRARY", strings.TrimSuffix(config.HWAddressSanitizerStaticLibrary(toolchain), ".a"))
|
"HWADDRESS_SANITIZER_RUNTIME_LIBRARY": config.HWAddressSanitizerRuntimeLibrary(toolchain),
|
||||||
ctx.Strict(secondPrefix+"UBSAN_RUNTIME_LIBRARY", strings.TrimSuffix(config.UndefinedBehaviorSanitizerRuntimeLibrary(toolchain), ".so"))
|
"HWADDRESS_SANITIZER_STATIC_LIBRARY": config.HWAddressSanitizerStaticLibrary(toolchain),
|
||||||
ctx.Strict(secondPrefix+"UBSAN_MINIMAL_RUNTIME_LIBRARY", strings.TrimSuffix(config.UndefinedBehaviorSanitizerMinimalRuntimeLibrary(toolchain), ".a"))
|
"UBSAN_RUNTIME_LIBRARY": config.UndefinedBehaviorSanitizerRuntimeLibrary(toolchain),
|
||||||
ctx.Strict(secondPrefix+"TSAN_RUNTIME_LIBRARY", strings.TrimSuffix(config.ThreadSanitizerRuntimeLibrary(toolchain), ".so"))
|
"UBSAN_MINIMAL_RUNTIME_LIBRARY": config.UndefinedBehaviorSanitizerMinimalRuntimeLibrary(toolchain),
|
||||||
ctx.Strict(secondPrefix+"SCUDO_RUNTIME_LIBRARY", strings.TrimSuffix(config.ScudoRuntimeLibrary(toolchain), ".so"))
|
"TSAN_RUNTIME_LIBRARY": config.ThreadSanitizerRuntimeLibrary(toolchain),
|
||||||
ctx.Strict(secondPrefix+"SCUDO_MINIMAL_RUNTIME_LIBRARY", strings.TrimSuffix(config.ScudoMinimalRuntimeLibrary(toolchain), ".so"))
|
"SCUDO_RUNTIME_LIBRARY": config.ScudoRuntimeLibrary(toolchain),
|
||||||
|
"SCUDO_MINIMAL_RUNTIME_LIBRARY": config.ScudoMinimalRuntimeLibrary(toolchain),
|
||||||
|
}
|
||||||
|
|
||||||
|
for variable, value := range sanitizerVariables {
|
||||||
|
ctx.Strict(secondPrefix+variable, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
sanitizerLibs := android.SortedStringValues(sanitizerVariables)
|
||||||
|
var sanitizerLibStems []string
|
||||||
|
ctx.VisitAllModules(func(m android.Module) {
|
||||||
|
if !m.Enabled() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ccModule, _ := m.(*Module)
|
||||||
|
if ccModule == nil || ccModule.library == nil || !ccModule.library.shared() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if android.InList(strings.TrimPrefix(ctx.ModuleName(m), "prebuilt_"), sanitizerLibs) &&
|
||||||
|
m.Target().Os == target.Os && m.Target().Arch.ArchType == target.Arch.ArchType {
|
||||||
|
outputFile := ccModule.outputFile
|
||||||
|
if outputFile.Valid() {
|
||||||
|
sanitizerLibStems = append(sanitizerLibStems, outputFile.Path().Base())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
sanitizerLibStems = android.SortedUniqueStrings(sanitizerLibStems)
|
||||||
|
ctx.Strict(secondPrefix+"SANITIZER_STEMS", strings.Join(sanitizerLibStems, " "))
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is used by external/gentoo/...
|
// This is used by external/gentoo/...
|
||||||
|
Reference in New Issue
Block a user