From a3bb1b3e3b95b06fc6d06a641085808151ed8c3f Mon Sep 17 00:00:00 2001 From: Jayant Chowdhary Date: Wed, 1 Nov 2017 11:12:15 -0700 Subject: [PATCH] Convert abi warnings to errors. Convert abi warnings to errors by removing the -advice-only flag from the invocation of header-abi-diff. This will only apply to branches with reference abi dumps checked into prebuilts/abi-dumps/(v)ndk (since abi-diffing will only be triggered on them.) Also allow for: 1) Extensions. 2) Changes to types in exported headers, unreferenced by public symbols still trigger warnings. 3) Any removal of symbols appearing in a shared library's .dynsym table, but not in exported headers is still a warning. Bug: 64267858 Test: make -j64 from ToT. Change-Id: Iadeac8d060cb693d4310afb841dc48d91f38597d --- cc/builder.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cc/builder.go b/cc/builder.go index 6882e9ace..a81dc8944 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -36,6 +36,14 @@ const ( staticLibraryExtension = ".a" ) +var ( + abiCheckAllowFlags = []string{ + "-allow-extensions", + "-allow-unreferenced-changes", + "-allow-unreferenced-elf-symbol-changes", + } +) + var ( pctx = android.NewPackageContext("android/soong/cc") @@ -191,10 +199,10 @@ var ( // Abidiff check turned on in advice-only mode. Builds will not fail on abi incompatibilties / extensions. sAbiDiff = pctx.AndroidStaticRule("sAbiDiff", blueprint.RuleParams{ - Command: "$sAbiDiffer -lib $libName -arch $arch -advice-only -check-all-apis -o ${out} -new $in -old $referenceDump", + Command: "$sAbiDiffer $allowFlags -lib $libName -arch $arch -check-all-apis -o ${out} -new $in -old $referenceDump", CommandDeps: []string{"$sAbiDiffer"}, }, - "referenceDump", "libName", "arch") + "allowFlags", "referenceDump", "libName", "arch") unzipRefSAbiDump = pctx.AndroidStaticRule("unzipRefSAbiDump", blueprint.RuleParams{ @@ -709,6 +717,7 @@ func SourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceD "referenceDump": referenceDump.String(), "libName": baseName, "arch": ctx.Arch().ArchType.Name, + "allowFlags": strings.Join(abiCheckAllowFlags, " "), }, }) return android.OptionalPathForPath(outputFile)