Let header-abi-linker filter llndk, apex, and systemapi symbols
This commit adds --include-symbol-tag and --symbol-tag-policy to
header-abi-linker commands. The arguments make header-abi-linker load
the symbols tagged with llndk/apex/systemapi from the version script.
It filters the function declarations by the symbols. The output dumps
will not contain unfinalized ABI.
Test: make findlsdumps
Bug: 333532038
Change-Id: I28234a3749f389b8a5a09ac84341b1fcd1ee88a6
diff --git a/cc/builder.go b/cc/builder.go
index 845176e..e78b8c0 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -855,8 +855,8 @@
// into a single .ldump sAbi dump file
func transformDumpToLinkedDump(ctx android.ModuleContext, sAbiDumps android.Paths, soFile android.Path,
baseName string, exportedIncludeDirs []string, symbolFile android.OptionalPath,
- excludedSymbolVersions, excludedSymbolTags []string,
- api string) android.Path {
+ excludedSymbolVersions, excludedSymbolTags, includedSymbolTags []string,
+ api string, isLlndk bool) android.Path {
outputFile := android.PathForModuleOut(ctx, baseName+".lsdump")
@@ -874,6 +874,12 @@
for _, tag := range excludedSymbolTags {
symbolFilterStr += " --exclude-symbol-tag " + tag
}
+ for _, tag := range includedSymbolTags {
+ symbolFilterStr += " --include-symbol-tag " + tag
+ }
+ if isLlndk {
+ symbolFilterStr += " --symbol-tag-policy MatchTagOnly"
+ }
apiLevelsJson := android.GetApiLevelsJson(ctx)
implicits = append(implicits, apiLevelsJson)
symbolFilterStr += " --api-map " + apiLevelsJson.String()
diff --git a/cc/library.go b/cc/library.go
index 44bbdfc..a436649 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1249,28 +1249,29 @@
func (library *libraryDecorator) linkLlndkSAbiDumpFiles(ctx ModuleContext,
deps PathDeps, sAbiDumpFiles android.Paths, soFile android.Path, libFileName string,
- excludeSymbolVersions, excludeSymbolTags []string) android.Path {
+ excludeSymbolVersions, excludeSymbolTags []string,
+ vendorApiLevel string) android.Path {
// NDK symbols in version 34 are LLNDK symbols. Those in version 35 are not.
- // TODO(b/314010764): Add parameters to read LLNDK symbols from the symbol file.
return transformDumpToLinkedDump(ctx,
sAbiDumpFiles, soFile, libFileName+".llndk",
library.llndkIncludeDirsForAbiCheck(ctx, deps),
android.OptionalPathForModuleSrc(ctx, library.Properties.Llndk.Symbol_file),
append([]string{"*_PLATFORM", "*_PRIVATE"}, excludeSymbolVersions...),
append([]string{"platform-only"}, excludeSymbolTags...),
- "34")
+ []string{"llndk=" + vendorApiLevel}, "34", true /* isLlndk */)
}
func (library *libraryDecorator) linkApexSAbiDumpFiles(ctx ModuleContext,
deps PathDeps, sAbiDumpFiles android.Paths, soFile android.Path, libFileName string,
- excludeSymbolVersions, excludeSymbolTags []string, sdkVersion string) android.Path {
+ excludeSymbolVersions, excludeSymbolTags []string,
+ sdkVersion string) android.Path {
return transformDumpToLinkedDump(ctx,
sAbiDumpFiles, soFile, libFileName+".apex",
library.exportedIncludeDirsForAbiCheck(ctx),
android.OptionalPathForModuleSrc(ctx, library.Properties.Stubs.Symbol_file),
append([]string{"*_PLATFORM", "*_PRIVATE"}, excludeSymbolVersions...),
append([]string{"platform-only"}, excludeSymbolTags...),
- sdkVersion)
+ []string{"apex", "systemapi"}, sdkVersion, false /* isLlndk */)
}
func getRefAbiDumpFile(ctx android.ModuleInstallPathContext,
@@ -1397,18 +1398,19 @@
android.OptionalPathForModuleSrc(ctx, library.symbolFileForAbiCheck(ctx)),
headerAbiChecker.Exclude_symbol_versions,
headerAbiChecker.Exclude_symbol_tags,
- currSdkVersion)
+ []string{} /* includeSymbolTags */, currSdkVersion, false /* isLlndk */)
var llndkDump, apexVariantDump android.Path
tags := classifySourceAbiDump(ctx)
for _, tag := range tags {
- if tag == llndkLsdumpTag {
+ if tag == llndkLsdumpTag && currVendorVersion != "" {
if llndkDump == nil {
// TODO(b/323447559): Evaluate if replacing sAbiDumpFiles with implDump is faster
llndkDump = library.linkLlndkSAbiDumpFiles(ctx,
deps, objs.sAbiDumpFiles, soFile, fileName,
headerAbiChecker.Exclude_symbol_versions,
- headerAbiChecker.Exclude_symbol_tags)
+ headerAbiChecker.Exclude_symbol_tags,
+ currVendorVersion)
}
addLsdumpPath(string(tag) + ":" + llndkDump.String())
} else if tag == apexLsdumpTag {