Propagate sanitize.never flag in SDK snapshots.
This is necessary to not get dependencies on libclang_rt sanitizer libs
for the CRT objects which lead to cyclic dependencies in sanitizer
builds.
Test: `lunch aosp_blueline_hwasan-userdebug && m nothing`
in a tree that has the prebuilts created and unzipped from
`build/soong/scripts/build-aml-prebuilts.sh runtime-module-{sdk,host-exports}`
Bug: 151303681
Change-Id: I3f848a084280bdc3ade4b74df03e981d8cc61222
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go
index cff00b6..9328a25 100644
--- a/cc/library_sdk_member.go
+++ b/cc/library_sdk_member.go
@@ -212,6 +212,11 @@
// Add properties that may, or may not, be arch specific.
func addPossiblyArchSpecificProperties(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, libInfo *nativeLibInfoProperties, outputProperties android.BpPropertySet) {
+ if libInfo.SanitizeNever {
+ sanitizeSet := outputProperties.AddPropertySet("sanitize")
+ sanitizeSet.AddProperty("never", true)
+ }
+
// Copy the generated library to the snapshot and add a reference to it in the .bp module.
if libInfo.outputFile != nil {
nativeLibraryPath := nativeLibraryPathFor(libInfo)
@@ -359,6 +364,9 @@
// not vary by arch so cannot be android specific.
StubsVersion string `sdk:"ignored-on-host"`
+ // Value of SanitizeProperties.Sanitize.Never. Needs to be propagated for CRT objects.
+ SanitizeNever bool `android:"arch_variant"`
+
// outputFile is not exported as it is always arch specific.
outputFile android.Path
}
@@ -405,6 +413,10 @@
if ccModule.HasStubsVariants() {
p.StubsVersion = ccModule.StubsVersion()
}
+
+ if ccModule.sanitize != nil && proptools.Bool(ccModule.sanitize.Properties.Sanitize.Never) {
+ p.SanitizeNever = true
+ }
}
func getRequiredMemberOutputFile(ctx android.SdkMemberContext, ccModule *Module) android.Path {