Merge "Let header-abi-linker filter llndk, apex, and systemapi symbols" into main am: d32e3dff8d am: 11f24228db

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3040334

Change-Id: Iaf0c056f833ce08fe9378b3387f6f7c0800dbe6d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Hsin-Yi Chen
2024-04-29 08:31:55 +00:00
committed by Automerger Merge Worker
2 changed files with 18 additions and 10 deletions

View File

@@ -855,8 +855,8 @@ func transformObjToDynamicBinary(ctx android.ModuleContext,
// into a single .ldump sAbi dump file // into a single .ldump sAbi dump file
func transformDumpToLinkedDump(ctx android.ModuleContext, sAbiDumps android.Paths, soFile android.Path, func transformDumpToLinkedDump(ctx android.ModuleContext, sAbiDumps android.Paths, soFile android.Path,
baseName string, exportedIncludeDirs []string, symbolFile android.OptionalPath, baseName string, exportedIncludeDirs []string, symbolFile android.OptionalPath,
excludedSymbolVersions, excludedSymbolTags []string, excludedSymbolVersions, excludedSymbolTags, includedSymbolTags []string,
api string) android.Path { api string, isLlndk bool) android.Path {
outputFile := android.PathForModuleOut(ctx, baseName+".lsdump") outputFile := android.PathForModuleOut(ctx, baseName+".lsdump")
@@ -874,6 +874,12 @@ func transformDumpToLinkedDump(ctx android.ModuleContext, sAbiDumps android.Path
for _, tag := range excludedSymbolTags { for _, tag := range excludedSymbolTags {
symbolFilterStr += " --exclude-symbol-tag " + tag 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) apiLevelsJson := android.GetApiLevelsJson(ctx)
implicits = append(implicits, apiLevelsJson) implicits = append(implicits, apiLevelsJson)
symbolFilterStr += " --api-map " + apiLevelsJson.String() symbolFilterStr += " --api-map " + apiLevelsJson.String()

View File

@@ -1249,28 +1249,29 @@ func (library *libraryDecorator) llndkIncludeDirsForAbiCheck(ctx ModuleContext,
func (library *libraryDecorator) linkLlndkSAbiDumpFiles(ctx ModuleContext, func (library *libraryDecorator) linkLlndkSAbiDumpFiles(ctx ModuleContext,
deps PathDeps, sAbiDumpFiles android.Paths, soFile android.Path, libFileName string, 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. // 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, return transformDumpToLinkedDump(ctx,
sAbiDumpFiles, soFile, libFileName+".llndk", sAbiDumpFiles, soFile, libFileName+".llndk",
library.llndkIncludeDirsForAbiCheck(ctx, deps), library.llndkIncludeDirsForAbiCheck(ctx, deps),
android.OptionalPathForModuleSrc(ctx, library.Properties.Llndk.Symbol_file), android.OptionalPathForModuleSrc(ctx, library.Properties.Llndk.Symbol_file),
append([]string{"*_PLATFORM", "*_PRIVATE"}, excludeSymbolVersions...), append([]string{"*_PLATFORM", "*_PRIVATE"}, excludeSymbolVersions...),
append([]string{"platform-only"}, excludeSymbolTags...), append([]string{"platform-only"}, excludeSymbolTags...),
"34") []string{"llndk=" + vendorApiLevel}, "34", true /* isLlndk */)
} }
func (library *libraryDecorator) linkApexSAbiDumpFiles(ctx ModuleContext, func (library *libraryDecorator) linkApexSAbiDumpFiles(ctx ModuleContext,
deps PathDeps, sAbiDumpFiles android.Paths, soFile android.Path, libFileName string, 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, return transformDumpToLinkedDump(ctx,
sAbiDumpFiles, soFile, libFileName+".apex", sAbiDumpFiles, soFile, libFileName+".apex",
library.exportedIncludeDirsForAbiCheck(ctx), library.exportedIncludeDirsForAbiCheck(ctx),
android.OptionalPathForModuleSrc(ctx, library.Properties.Stubs.Symbol_file), android.OptionalPathForModuleSrc(ctx, library.Properties.Stubs.Symbol_file),
append([]string{"*_PLATFORM", "*_PRIVATE"}, excludeSymbolVersions...), append([]string{"*_PLATFORM", "*_PRIVATE"}, excludeSymbolVersions...),
append([]string{"platform-only"}, excludeSymbolTags...), append([]string{"platform-only"}, excludeSymbolTags...),
sdkVersion) []string{"apex", "systemapi"}, sdkVersion, false /* isLlndk */)
} }
func getRefAbiDumpFile(ctx android.ModuleInstallPathContext, func getRefAbiDumpFile(ctx android.ModuleInstallPathContext,
@@ -1397,18 +1398,19 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, deps PathD
android.OptionalPathForModuleSrc(ctx, library.symbolFileForAbiCheck(ctx)), android.OptionalPathForModuleSrc(ctx, library.symbolFileForAbiCheck(ctx)),
headerAbiChecker.Exclude_symbol_versions, headerAbiChecker.Exclude_symbol_versions,
headerAbiChecker.Exclude_symbol_tags, headerAbiChecker.Exclude_symbol_tags,
currSdkVersion) []string{} /* includeSymbolTags */, currSdkVersion, false /* isLlndk */)
var llndkDump, apexVariantDump android.Path var llndkDump, apexVariantDump android.Path
tags := classifySourceAbiDump(ctx) tags := classifySourceAbiDump(ctx)
for _, tag := range tags { for _, tag := range tags {
if tag == llndkLsdumpTag { if tag == llndkLsdumpTag && currVendorVersion != "" {
if llndkDump == nil { if llndkDump == nil {
// TODO(b/323447559): Evaluate if replacing sAbiDumpFiles with implDump is faster // TODO(b/323447559): Evaluate if replacing sAbiDumpFiles with implDump is faster
llndkDump = library.linkLlndkSAbiDumpFiles(ctx, llndkDump = library.linkLlndkSAbiDumpFiles(ctx,
deps, objs.sAbiDumpFiles, soFile, fileName, deps, objs.sAbiDumpFiles, soFile, fileName,
headerAbiChecker.Exclude_symbol_versions, headerAbiChecker.Exclude_symbol_versions,
headerAbiChecker.Exclude_symbol_tags) headerAbiChecker.Exclude_symbol_tags,
currVendorVersion)
} }
addLsdumpPath(string(tag) + ":" + llndkDump.String()) addLsdumpPath(string(tag) + ":" + llndkDump.String())
} else if tag == apexLsdumpTag { } else if tag == apexLsdumpTag {