Add LLNDK support for the VNDK

Instead of using the NDK headers and libraries, add LL-NDK specific
headers and library stubs for VNDK users. This allows us to provide an
expanded liblog interface.

Test: aosp_arm; m -j
Test: Enable BOARD_VNDK_VERSION on aosp_arm; m -j
Test: Inspect out/soong/build.ninja before/after (w/o vndk)
Change-Id: Ic85f07fa10c695b5baab10c41f5e0ad38700bf3d
This commit is contained in:
Dan Willemsen
2017-03-19 13:44:32 -07:00
parent 86a1c7dd15
commit b916b80bf3
9 changed files with 233 additions and 23 deletions

View File

@@ -30,10 +30,10 @@ var (
genStubSrc = pctx.AndroidStaticRule("genStubSrc",
blueprint.RuleParams{
Command: "$toolPath --arch $arch --api $apiLevel $in $out",
Command: "$toolPath --arch $arch --api $apiLevel $vndk $in $out",
Description: "genStubSrc $out",
CommandDeps: []string{"$toolPath"},
}, "arch", "apiLevel")
}, "arch", "apiLevel", "vndk")
ndkLibrarySuffix = ".ndk"
@@ -241,28 +241,20 @@ func (c *stubDecorator) compilerInit(ctx BaseModuleContext) {
ndkMigratedLibs = append(ndkMigratedLibs, name)
}
func (c *stubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
func compileStubLibrary(ctx ModuleContext, flags Flags, symbolFile, apiLevel, vndk string) (Objects, android.ModuleGenPath) {
arch := ctx.Arch().ArchType.String()
if !strings.HasSuffix(ctx.ModuleName(), ndkLibrarySuffix) {
ctx.ModuleErrorf("ndk_library modules names must be suffixed with %q\n",
ndkLibrarySuffix)
}
libName := strings.TrimSuffix(ctx.ModuleName(), ndkLibrarySuffix)
fileBase := fmt.Sprintf("%s.%s.%s", libName, arch, c.properties.ApiLevel)
stubSrcName := fileBase + ".c"
stubSrcPath := android.PathForModuleGen(ctx, stubSrcName)
versionScriptName := fileBase + ".map"
versionScriptPath := android.PathForModuleGen(ctx, versionScriptName)
c.versionScriptPath = versionScriptPath
symbolFilePath := android.PathForModuleSrc(ctx, c.properties.Symbol_file)
stubSrcPath := android.PathForModuleGen(ctx, "stub.c")
versionScriptPath := android.PathForModuleGen(ctx, "stub.map")
symbolFilePath := android.PathForModuleSrc(ctx, symbolFile)
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
Rule: genStubSrc,
Outputs: []android.WritablePath{stubSrcPath, versionScriptPath},
Input: symbolFilePath,
Args: map[string]string{
"arch": arch,
"apiLevel": c.properties.ApiLevel,
"apiLevel": apiLevel,
"vndk": vndk,
},
})
@@ -280,7 +272,17 @@ func (c *stubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) O
subdir := ""
srcs := []android.Path{stubSrcPath}
return compileObjs(ctx, flagsToBuilderFlags(flags), subdir, srcs, nil)
return compileObjs(ctx, flagsToBuilderFlags(flags), subdir, srcs, nil), versionScriptPath
}
func (c *stubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
if !strings.HasSuffix(ctx.ModuleName(), ndkLibrarySuffix) {
ctx.ModuleErrorf("ndk_library modules names must be suffixed with %q\n",
ndkLibrarySuffix)
}
objs, versionScript := compileStubLibrary(ctx, flags, c.properties.Symbol_file, c.properties.ApiLevel, "")
c.versionScriptPath = versionScript
return objs
}
func (linker *stubDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {