Merge "Add check_all_apis option for header ABI checker" am: 9105fa385a
Change-Id: I1f854ad5f30c2f1f2d01e5bed6a83945eff05f7a
This commit is contained in:
@@ -37,13 +37,6 @@ const (
|
|||||||
staticLibraryExtension = ".a"
|
staticLibraryExtension = ".a"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
abiCheckAllowFlags = []string{
|
|
||||||
"-allow-unreferenced-changes",
|
|
||||||
"-allow-unreferenced-elf-symbol-changes",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
pctx = android.NewPackageContext("android/soong/cc")
|
pctx = android.NewPackageContext("android/soong/cc")
|
||||||
|
|
||||||
@@ -221,8 +214,7 @@ var (
|
|||||||
|
|
||||||
sAbiDiff = pctx.RuleFunc("sAbiDiff",
|
sAbiDiff = pctx.RuleFunc("sAbiDiff",
|
||||||
func(ctx android.PackageRuleContext) blueprint.RuleParams {
|
func(ctx android.PackageRuleContext) blueprint.RuleParams {
|
||||||
// TODO(b/78139997): Add -check-all-apis back
|
commandStr := "($sAbiDiffer ${extraFlags} -lib ${libName} -arch ${arch} -o ${out} -new ${in} -old ${referenceDump})"
|
||||||
commandStr := "($sAbiDiffer ${allowFlags} -lib ${libName} -arch ${arch} -o ${out} -new ${in} -old ${referenceDump})"
|
|
||||||
commandStr += "|| (echo 'error: Please update ABI references with: $$ANDROID_BUILD_TOP/development/vndk/tools/header-checker/utils/create_reference_dumps.py ${createReferenceDumpFlags} -l ${libName}'"
|
commandStr += "|| (echo 'error: Please update ABI references with: $$ANDROID_BUILD_TOP/development/vndk/tools/header-checker/utils/create_reference_dumps.py ${createReferenceDumpFlags} -l ${libName}'"
|
||||||
commandStr += " && (mkdir -p $$DIST_DIR/abidiffs && cp ${out} $$DIST_DIR/abidiffs/)"
|
commandStr += " && (mkdir -p $$DIST_DIR/abidiffs && cp ${out} $$DIST_DIR/abidiffs/)"
|
||||||
commandStr += " && exit 1)"
|
commandStr += " && exit 1)"
|
||||||
@@ -231,7 +223,7 @@ var (
|
|||||||
CommandDeps: []string{"$sAbiDiffer"},
|
CommandDeps: []string{"$sAbiDiffer"},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"allowFlags", "referenceDump", "libName", "arch", "createReferenceDumpFlags")
|
"extraFlags", "referenceDump", "libName", "arch", "createReferenceDumpFlags")
|
||||||
|
|
||||||
unzipRefSAbiDump = pctx.AndroidStaticRule("unzipRefSAbiDump",
|
unzipRefSAbiDump = pctx.AndroidStaticRule("unzipRefSAbiDump",
|
||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
@@ -742,27 +734,36 @@ func UnzipRefDump(ctx android.ModuleContext, zippedRefDump android.Path, baseNam
|
|||||||
}
|
}
|
||||||
|
|
||||||
func SourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceDump android.Path,
|
func SourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceDump android.Path,
|
||||||
baseName, exportedHeaderFlags string, isLlndk, isNdk, isVndkExt bool) android.OptionalPath {
|
baseName, exportedHeaderFlags string, checkAllApis, isLlndk, isNdk, isVndkExt bool) android.OptionalPath {
|
||||||
|
|
||||||
outputFile := android.PathForModuleOut(ctx, baseName+".abidiff")
|
outputFile := android.PathForModuleOut(ctx, baseName+".abidiff")
|
||||||
libName := strings.TrimSuffix(baseName, filepath.Ext(baseName))
|
libName := strings.TrimSuffix(baseName, filepath.Ext(baseName))
|
||||||
createReferenceDumpFlags := ""
|
createReferenceDumpFlags := ""
|
||||||
|
|
||||||
localAbiCheckAllowFlags := append([]string(nil), abiCheckAllowFlags...)
|
var extraFlags []string
|
||||||
if exportedHeaderFlags == "" {
|
if checkAllApis {
|
||||||
localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-advice-only")
|
extraFlags = append(extraFlags, "-check-all-apis")
|
||||||
|
} else {
|
||||||
|
extraFlags = append(extraFlags,
|
||||||
|
"-allow-unreferenced-changes",
|
||||||
|
"-allow-unreferenced-elf-symbol-changes")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if exportedHeaderFlags == "" {
|
||||||
|
extraFlags = append(extraFlags, "-advice-only")
|
||||||
|
}
|
||||||
|
|
||||||
if isLlndk || isNdk {
|
if isLlndk || isNdk {
|
||||||
createReferenceDumpFlags = "--llndk"
|
createReferenceDumpFlags = "--llndk"
|
||||||
if isLlndk {
|
if isLlndk {
|
||||||
// TODO(b/130324828): "-consider-opaque-types-different" should apply to
|
// TODO(b/130324828): "-consider-opaque-types-different" should apply to
|
||||||
// both LLNDK and NDK shared libs. However, a known issue in header-abi-diff
|
// both LLNDK and NDK shared libs. However, a known issue in header-abi-diff
|
||||||
// breaks libaaudio. Remove the if-guard after the issue is fixed.
|
// breaks libaaudio. Remove the if-guard after the issue is fixed.
|
||||||
localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-consider-opaque-types-different")
|
extraFlags = append(extraFlags, "-consider-opaque-types-different")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if isVndkExt {
|
if isVndkExt {
|
||||||
localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-allow-extensions")
|
extraFlags = append(extraFlags, "-allow-extensions")
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
@@ -775,7 +776,7 @@ func SourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceD
|
|||||||
"referenceDump": referenceDump.String(),
|
"referenceDump": referenceDump.String(),
|
||||||
"libName": libName,
|
"libName": libName,
|
||||||
"arch": ctx.Arch().ArchType.Name,
|
"arch": ctx.Arch().ArchType.Name,
|
||||||
"allowFlags": strings.Join(localAbiCheckAllowFlags, " "),
|
"extraFlags": strings.Join(extraFlags, " "),
|
||||||
"createReferenceDumpFlags": createReferenceDumpFlags,
|
"createReferenceDumpFlags": createReferenceDumpFlags,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@@ -102,6 +102,10 @@ type LibraryProperties struct {
|
|||||||
|
|
||||||
// Symbol tags that should be ignored from the symbol file
|
// Symbol tags that should be ignored from the symbol file
|
||||||
Exclude_symbol_tags []string
|
Exclude_symbol_tags []string
|
||||||
|
|
||||||
|
// Run checks on all APIs (in addition to the ones referred by
|
||||||
|
// one of exported ELF symbols.)
|
||||||
|
Check_all_apis *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Order symbols in .bss section by their sizes. Only useful for shared libraries.
|
// Order symbols in .bss section by their sizes. Only useful for shared libraries.
|
||||||
@@ -1072,7 +1076,9 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec
|
|||||||
refAbiDumpFile := getRefAbiDumpFile(ctx, vndkVersion, fileName)
|
refAbiDumpFile := getRefAbiDumpFile(ctx, vndkVersion, fileName)
|
||||||
if refAbiDumpFile != nil {
|
if refAbiDumpFile != nil {
|
||||||
library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(),
|
library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(),
|
||||||
refAbiDumpFile, fileName, exportedHeaderFlags, ctx.isLlndk(ctx.Config()), ctx.isNdk(), ctx.isVndkExt())
|
refAbiDumpFile, fileName, exportedHeaderFlags,
|
||||||
|
Bool(library.Properties.Header_abi_checker.Check_all_apis),
|
||||||
|
ctx.isLlndk(ctx.Config()), ctx.isNdk(), ctx.isVndkExt())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user