Add a header_abi_checker section
This commit adds a header_abi_checker section so that the library owner
can have a fine-grained control over the ABIs that must be checked.
For example, a library "libexample" may have following configurations:
cc_library {
name: "libexample",
header_abi_checker: {
symbol_file: "libexample.map.txt",
exclude_symbol_versions: ["LIBEXAMPLE_PRIVATE"],
exclude_symbol_tags: ["platform", "apex"],
},
}
Bug: 122845490
Test: Add header_abi_checker to libc to filter out LIBC_PRIVATE
Change-Id: I60cfea868f815afe6213c242ed0ca818161d55c6
diff --git a/cc/builder.go b/cc/builder.go
index b012d6f..645b3c2 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -663,18 +663,33 @@
// Generate a rule to combine .dump sAbi dump files from multiple source files
// into a single .ldump sAbi dump file
func TransformDumpToLinkedDump(ctx android.ModuleContext, sAbiDumps android.Paths, soFile android.Path,
- baseName, exportedHeaderFlags string) android.OptionalPath {
+ baseName, exportedHeaderFlags string, symbolFile android.OptionalPath,
+ excludedSymbolVersions, excludedSymbolTags []string) android.OptionalPath {
+
outputFile := android.PathForModuleOut(ctx, baseName+".lsdump")
sabiLock.Lock()
lsdumpPaths = append(lsdumpPaths, outputFile.String())
sabiLock.Unlock()
+
+ implicits := android.Paths{soFile}
symbolFilterStr := "-so " + soFile.String()
+
+ if symbolFile.Valid() {
+ implicits = append(implicits, symbolFile.Path())
+ symbolFilterStr += " -v " + symbolFile.String()
+ }
+ for _, ver := range excludedSymbolVersions {
+ symbolFilterStr += " --exclude-symbol-version " + ver
+ }
+ for _, tag := range excludedSymbolTags {
+ symbolFilterStr += " --exclude-symbol-tag " + tag
+ }
ctx.Build(pctx, android.BuildParams{
Rule: sAbiLink,
Description: "header-abi-linker " + outputFile.Base(),
Output: outputFile,
Inputs: sAbiDumps,
- Implicit: soFile,
+ Implicits: implicits,
Args: map[string]string{
"symbolFilter": symbolFilterStr,
"arch": ctx.Arch().ArchType.Name,