Use -advice-only for libraries which do not export headers.
While diffing abi, for libraries which do not export headers, use
-advice-only.
Test: Create reference dump for libdl; mm -j64; header-abi-diff gets
invoked with '-advice-only'.
Test: Create reference dump for libjpeg; mm -j64; header-abi-diff gets
invoked without '-advice-only'.
Bug: 71768219
Change-Id: I678346081f15088388f223f1276d0b0c42d2a8c2
diff --git a/cc/builder.go b/cc/builder.go
index fcc4318..1e1c4f2 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -711,8 +711,12 @@
}
func SourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceDump android.Path,
- baseName string) android.OptionalPath {
+ baseName, exportedHeaderFlags string) android.OptionalPath {
outputFile := android.PathForModuleOut(ctx, baseName+".abidiff")
+ localAbiCheckAllowFlags := append([]string(nil), abiCheckAllowFlags...)
+ if exportedHeaderFlags == "" {
+ localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-advice-only")
+ }
ctx.Build(pctx, android.BuildParams{
Rule: sAbiDiff,
Description: "header-abi-diff " + outputFile.Base(),
@@ -723,7 +727,7 @@
"referenceDump": referenceDump.String(),
"libName": baseName,
"arch": ctx.Arch().ArchType.Name,
- "allowFlags": strings.Join(abiCheckAllowFlags, " "),
+ "allowFlags": strings.Join(localAbiCheckAllowFlags, " "),
},
})
return android.OptionalPathForPath(outputFile)
diff --git a/cc/library.go b/cc/library.go
index adbd6b5..0ed1848 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -632,7 +632,7 @@
library.sAbiOutputFile = TransformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags)
if refSourceDumpFile.Valid() {
unzippedRefDump := UnzipRefDump(ctx, refSourceDumpFile.Path(), fileName)
- library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(), unzippedRefDump, fileName)
+ library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(), unzippedRefDump, fileName, exportedHeaderFlags)
}
}
}