Add header-abi-checker for Vndk abi checks.
header-abi-dumper: dumps abi exported by source files for Vndk.
header-abi-linker: links abi dumps produced by header-abi-dumper.
header-abi-diff: compares linked dumps.
Test: mm -j64 showcommands > make_log in bionic/libc.
This produced linked dumps in out/soong/.intermediates.
Copied these dumps to
prebuilts/abi-dumps/ndk/current/arm64/source-based/.
Changed the abi and re-ran mm -j64 showcommands > make_log
confirmed that the build reported compatibility breakge without
actually failing (advisory mode).
Change-Id: Iccad6908fe68a80f47230751671d156893b96ead
diff --git a/cc/cc.go b/cc/cc.go
index 63caf3a..6e2f6a5 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -49,6 +49,7 @@
ctx.BottomUp("tsan", sanitizerMutator(tsan)).Parallel()
ctx.BottomUp("coverage", coverageLinkingMutator).Parallel()
+ ctx.TopDown("vndk_deps", sabiDepsMutator)
})
pctx.Import("android/soong/cc/config")
@@ -108,6 +109,7 @@
LdFlags []string // Flags that apply to linker command lines
libFlags []string // Flags to add libraries early to the link order
TidyFlags []string // Flags that apply to clang-tidy
+ SAbiFlags []string // Flags that apply to header-abi-dumper
YasmFlags []string // Flags that apply to yasm assembly source files
// Global include flags that apply to C, C++, and assembly source files
@@ -118,6 +120,7 @@
Clang bool
Tidy bool
Coverage bool
+ SAbiDump bool
RequiredInstructionSet string
DynamicLinker string
@@ -177,6 +180,7 @@
sdk() bool
sdkVersion() string
vndk() bool
+ createVndkSourceAbiDump() bool
selectedStl() string
baseModuleName() string
}
@@ -283,6 +287,7 @@
stl *stl
sanitize *sanitize
coverage *coverage
+ sabi *sabi
androidMkSharedLibDeps []string
@@ -316,6 +321,9 @@
if c.coverage != nil {
props = append(props, c.coverage.props()...)
}
+ if c.sabi != nil {
+ props = append(props, c.sabi.props()...)
+ }
for _, feature := range c.features {
props = append(props, feature.props()...)
}
@@ -418,6 +426,12 @@
return ctx.mod.vndk()
}
+// Create source abi dumps if the module belongs to the list of VndkLibraries.
+func (ctx *moduleContextImpl) createVndkSourceAbiDump() bool {
+ return ctx.ctx.Device() && (inList(ctx.baseModuleName(), config.LLndkLibraries())) ||
+ (inList(ctx.baseModuleName(), config.VndkLibraries()))
+}
+
func (ctx *moduleContextImpl) selectedStl() string {
if stl := ctx.mod.stl; stl != nil {
return stl.Properties.SelectedStl
@@ -444,6 +458,7 @@
module.stl = &stl{}
module.sanitize = &sanitize{}
module.coverage = &coverage{}
+ module.sabi = &sabi{}
return module
}
@@ -492,6 +507,9 @@
if c.coverage != nil {
flags = c.coverage.flags(ctx, flags)
}
+ if c.sabi != nil {
+ flags = c.sabi.flags(ctx, flags)
+ }
for _, feature := range c.features {
flags = feature.flags(ctx, flags)
}
@@ -566,6 +584,9 @@
if c.coverage != nil {
c.coverage.begin(ctx)
}
+ if c.sabi != nil {
+ c.sabi.begin(ctx)
+ }
for _, feature := range c.features {
feature.begin(ctx)
}
@@ -596,6 +617,9 @@
if c.coverage != nil {
deps = c.coverage.deps(ctx, deps)
}
+ if c.sabi != nil {
+ deps = c.sabi.deps(ctx, deps)
+ }
for _, feature := range c.features {
deps = feature.deps(ctx, deps)
}
@@ -999,9 +1023,12 @@
}
// When combining coverage files for shared libraries and executables, coverage files
- // in static libraries act as if they were whole static libraries.
+ // in static libraries act as if they were whole static libraries. The same goes for
+ // source based Abi dump files.
depPaths.StaticLibObjs.coverageFiles = append(depPaths.StaticLibObjs.coverageFiles,
staticLib.objs().coverageFiles...)
+ depPaths.StaticLibObjs.sAbiDumpFiles = append(depPaths.StaticLibObjs.sAbiDumpFiles,
+ staticLib.objs().sAbiDumpFiles...)
}
if ptr != nil {
@@ -1085,6 +1112,7 @@
&InstallerProperties{},
&TidyProperties{},
&CoverageProperties{},
+ &SAbiProperties{},
)
return android.InitDefaultsModule(module, module, props...)