ndkstubgen: use llndk=<version> for new llndk stub

We want LLNDK symbols to be explicitly marked with llndk tag to
handle LLNDK freezing which happens before SDK freezing. If symbols
need to be frozen as LLNDK, those symbols must be marked explicitly with
correct vFRC version.

In the following example,

LIBFOO { # introduced=35
  foo;
  bar;
  bar; # llndk=202404
  baz; # llndk=202404
  qux; # llndk=202505
};

NDK libfoo will have foo and bar while LLNDK libfoo stub will have bar
and baz for 202404.

Bug: 329012338
Test: test_ndkstubgen test_symbolfile
Change-Id: I384f589b240fa047e8871964bf9550f426024dfc
This commit is contained in:
Jooyung Han
2024-03-11 15:46:48 +09:00
parent eb0f771676
commit 33eb615eb0
5 changed files with 222 additions and 17 deletions

View File

@@ -677,18 +677,16 @@ func (library *libraryDecorator) getHeaderAbiCheckerProperties(ctx android.BaseM
func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
if ctx.IsLlndk() {
vendorApiLevel := ctx.Config().VendorApiLevel()
if vendorApiLevel == "" {
// TODO(b/321892570): Some tests relying on old fixtures which
// doesn't set vendorApiLevel. Needs to fix them.
vendorApiLevel = ctx.Config().PlatformSdkVersion().String()
}
// This is the vendor variant of an LLNDK library, build the LLNDK stubs.
vndkVer := ctx.Module().(*Module).VndkVersion()
if !inList(vndkVer, ctx.Config().PlatformVersionActiveCodenames()) || vndkVer == "" {
// For non-enforcing devices, vndkVer is empty. Use "current" in that case, too.
vndkVer = "current"
}
if library.stubsVersion() != "" {
vndkVer = library.stubsVersion()
}
nativeAbiResult := parseNativeAbiDefinition(ctx,
String(library.Properties.Llndk.Symbol_file),
android.ApiLevelOrPanic(ctx, vndkVer), "--llndk")
android.ApiLevelOrPanic(ctx, vendorApiLevel), "--llndk")
objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc)
if !Bool(library.Properties.Llndk.Unversioned) {
library.versionScriptPath = android.OptionalPathForPath(