diff options
author | 2023-07-03 12:25:27 +0100 | |
---|---|---|
committer | 2023-08-01 17:22:47 +0000 | |
commit | 55486f8674a63cd9b9cb8125f2b2a7b3579ee975 (patch) | |
tree | 18db08786c2bdb472841a46de7a9042ea35e8a15 /cc/ndk_library.go | |
parent | 658bb4dad97d1e1fabb51d87d63df9ffed61c50f (diff) |
NDK library: extract ABI representations with STG
Replace the abidw->stg pipeline by just stg for extraction directly from
ELF/DWARF. This is to migrate to STG entirely.
As a migration tooling, keep the existing method active via
`legacy_use_abidw` as a flag on ndk_library.
Bug: 156513478
Change-Id: Ideaa9908b31591f49f9a167cfa3f3d5c95d8b198
Signed-off-by: Matthias Maennich <maennich@google.com>
Diffstat (limited to 'cc/ndk_library.go')
-rw-r--r-- | cc/ndk_library.go | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/cc/ndk_library.go b/cc/ndk_library.go index e10e70def..c0c6eef3f 100644 --- a/cc/ndk_library.go +++ b/cc/ndk_library.go @@ -44,6 +44,7 @@ var ( CommandDeps: []string{"$ndkStubGenerator"}, }, "arch", "apiLevel", "apiMap", "flags") + // TODO(b/156513478): remove once migration to STG is complete abidw = pctx.AndroidStaticRule("abidw", blueprint.RuleParams{ Command: "$abidw --type-id-style hash --no-corpus-path " + @@ -52,6 +53,13 @@ var ( CommandDeps: []string{"$abidw"}, }, "symbolList") + stg = pctx.AndroidStaticRule("stg", + blueprint.RuleParams{ + Command: "$stg -S :$symbolList --elf $in -o $out", + CommandDeps: []string{"$stg"}, + }, "symbolList") + + // TODO(b/156513478): remove once migration to STG is complete xml2stg = pctx.AndroidStaticRule("xml2stg", blueprint.RuleParams{ Command: "$stg --abi -i $in -o $out", @@ -109,6 +117,10 @@ type libraryProperties struct { // Headers presented by this library to the Public API Surface Export_header_libs []string + + // TODO(b/156513478): remove once migration to STG is complete + // Fall back to the legacy abidw ABI extraction pipeline + Legacy_use_abidw *bool } type stubDecorator struct { @@ -351,7 +363,8 @@ func canDiffAbi() bool { return false } -func (this *stubDecorator) dumpAbi(ctx ModuleContext, symbolList android.Path) { +// TODO(b/156513478): remove once migration to STG is complete +func (this *stubDecorator) dumpAbiLegacy(ctx ModuleContext, symbolList android.Path) { implementationLibrary := this.findImplementationLibrary(ctx) abiRawPath := getNdkAbiDumpInstallBase(ctx).Join(ctx, this.apiLevel.String(), ctx.Arch().ArchType.String(), @@ -378,6 +391,23 @@ func (this *stubDecorator) dumpAbi(ctx ModuleContext, symbolList android.Path) { }) } +func (this *stubDecorator) dumpAbi(ctx ModuleContext, symbolList android.Path) { + implementationLibrary := this.findImplementationLibrary(ctx) + this.abiDumpPath = getNdkAbiDumpInstallBase(ctx).Join(ctx, + this.apiLevel.String(), ctx.Arch().ArchType.String(), + this.libraryName(ctx), "abi.stg") + ctx.Build(pctx, android.BuildParams{ + Rule: stg, + Description: fmt.Sprintf("stg %s", implementationLibrary), + Input: implementationLibrary, + Implicit: symbolList, + Output: this.abiDumpPath, + Args: map[string]string{ + "symbolList": symbolList.String(), + }, + }) +} + func findNextApiLevel(ctx ModuleContext, apiLevel android.ApiLevel) *android.ApiLevel { apiLevels := append(ctx.Config().AllSupportedApiLevels(), android.FutureApiLevel) @@ -476,7 +506,11 @@ func (c *stubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) O objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc) c.versionScriptPath = nativeAbiResult.versionScript if canDumpAbi(ctx.Config()) { - c.dumpAbi(ctx, nativeAbiResult.symbolList) + if proptools.BoolDefault(c.properties.Legacy_use_abidw, false) { + c.dumpAbiLegacy(ctx, nativeAbiResult.symbolList) + } else { + c.dumpAbi(ctx, nativeAbiResult.symbolList) + } if canDiffAbi() { c.diffAbi(ctx) } |