diff options
Diffstat (limited to 'cc/library.go')
| -rw-r--r-- | cc/library.go | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/cc/library.go b/cc/library.go index 4ce506e90..ea8794644 100644 --- a/cc/library.go +++ b/cc/library.go @@ -566,10 +566,16 @@ func (library *libraryDecorator) getHeaderAbiCheckerProperties(m *Module) header func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects { if ctx.IsLlndk() { - futureVendorApiLevel := android.ApiLevelOrPanic(ctx, "999999") + // Get the matching SDK version for the vendor API level. + version, err := android.GetSdkVersionForVendorApiLevel(ctx.Config().VendorApiLevel()) + if err != nil { + panic(err) + } + + // This is the vendor variant of an LLNDK library, build the LLNDK stubs. nativeAbiResult := parseNativeAbiDefinition(ctx, String(library.Properties.Llndk.Symbol_file), - futureVendorApiLevel, "--llndk") + nativeClampedApiLevel(ctx, version), "--llndk") objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc) if !Bool(library.Properties.Llndk.Unversioned) { library.versionScriptPath = android.OptionalPathForPath( @@ -656,7 +662,7 @@ func (library *libraryDecorator) compileModuleLibApiStubs(ctx ModuleContext, fla // However, having this distinction helps guard accidental // promotion or demotion of API and also helps the API review process b/191371676 var flag string - if ctx.Module().(android.ApexModule).NotInPlatform() { + if ctx.notInPlatform() { flag = "--apex" } else { flag = "--systemapi" @@ -740,6 +746,7 @@ type versionedInterface interface { hasLLNDKStubs() bool hasLLNDKHeaders() bool hasVendorPublicLibrary() bool + isLLNDKMovedToApex() bool } var _ libraryInterface = (*libraryDecorator)(nil) @@ -1284,15 +1291,14 @@ func (library *libraryDecorator) llndkIncludeDirsForAbiCheck(ctx ModuleContext, func (library *libraryDecorator) linkLlndkSAbiDumpFiles(ctx ModuleContext, deps PathDeps, sAbiDumpFiles android.Paths, soFile android.Path, libFileName string, excludeSymbolVersions, excludeSymbolTags []string, - vendorApiLevel string) android.Path { - // NDK symbols in version 34 are LLNDK symbols. Those in version 35 are not. + sdkVersionForVendorApiLevel string) android.Path { 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...), - []string{"llndk=" + vendorApiLevel}, "34", true /* isLlndk */) + []string{"llndk"}, sdkVersionForVendorApiLevel) } func (library *libraryDecorator) linkApexSAbiDumpFiles(ctx ModuleContext, @@ -1305,7 +1311,7 @@ func (library *libraryDecorator) linkApexSAbiDumpFiles(ctx ModuleContext, android.OptionalPathForModuleSrc(ctx, library.Properties.Stubs.Symbol_file), append([]string{"*_PLATFORM", "*_PRIVATE"}, excludeSymbolVersions...), append([]string{"platform-only"}, excludeSymbolTags...), - []string{"apex", "systemapi"}, sdkVersion, false /* isLlndk */) + []string{"apex", "systemapi"}, sdkVersion) } func getRefAbiDumpFile(ctx android.ModuleInstallPathContext, @@ -1443,7 +1449,7 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, deps PathD android.OptionalPathForModuleSrc(ctx, library.symbolFileForAbiCheck(ctx)), headerAbiChecker.Exclude_symbol_versions, headerAbiChecker.Exclude_symbol_tags, - []string{} /* includeSymbolTags */, currSdkVersion, false /* isLlndk */) + []string{} /* includeSymbolTags */, currSdkVersion) var llndkDump, apexVariantDump android.Path tags := classifySourceAbiDump(ctx.Module().(*Module)) @@ -1451,12 +1457,17 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, deps PathD for _, tag := range tags { if tag == llndkLsdumpTag && currVendorVersion != "" { if llndkDump == nil { + sdkVersion, err := android.GetSdkVersionForVendorApiLevel(currVendorVersion) + if err != nil { + ctx.ModuleErrorf("Cannot create %s llndk dump: %s", fileName, err) + return + } // 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, - currVendorVersion) + nativeClampedApiLevel(ctx, sdkVersion).String()) } addLsdumpPath(ctx.Config(), string(tag)+":"+llndkDump.String()) } else if tag == apexLsdumpTag { @@ -1750,21 +1761,17 @@ func (library *libraryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext, func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) { if library.shared() { - if library.hasStubsVariants() && !ctx.Host() && ctx.directlyInAnyApex() { + translatedArch := ctx.Target().NativeBridge == android.NativeBridgeEnabled + if library.hasStubsVariants() && !ctx.Host() && !ctx.isSdkVariant() && + InstallToBootstrap(ctx.baseModuleName(), ctx.Config()) && !library.buildStubs() && + !translatedArch && !ctx.inRamdisk() && !ctx.inVendorRamdisk() && !ctx.inRecovery() { // Bionic libraries (e.g. libc.so) is installed to the bootstrap subdirectory. // The original path becomes a symlink to the corresponding file in the // runtime APEX. - translatedArch := ctx.Target().NativeBridge == android.NativeBridgeEnabled - if InstallToBootstrap(ctx.baseModuleName(), ctx.Config()) && !library.buildStubs() && - !translatedArch && !ctx.inRamdisk() && !ctx.inVendorRamdisk() && !ctx.inRecovery() { - if ctx.Device() { - library.installSymlinkToRuntimeApex(ctx, file) - } - library.baseInstaller.subDir = "bootstrap" + if ctx.Device() { + library.installSymlinkToRuntimeApex(ctx, file) } - } else if ctx.directlyInAnyApex() && ctx.IsLlndk() && !isBionic(ctx.baseModuleName()) { - // Skip installing LLNDK (non-bionic) libraries moved to APEX. - ctx.Module().HideFromMake() + library.baseInstaller.subDir = "bootstrap" } library.baseInstaller.install(ctx, file) @@ -1848,6 +1855,11 @@ func (library *libraryDecorator) hasLLNDKHeaders() bool { return Bool(library.Properties.Llndk.Llndk_headers) } +// isLLNDKMovedToApex returns true if this cc_library module sets the llndk.moved_to_apex property. +func (library *libraryDecorator) isLLNDKMovedToApex() bool { + return Bool(library.Properties.Llndk.Moved_to_apex) +} + // hasVendorPublicLibrary returns true if this cc_library module has a variant that will build // vendor public library stubs. func (library *libraryDecorator) hasVendorPublicLibrary() bool { |