Reuse more of apex stubs implementation for llndk stubs
Use the linker script and exported flags support from apex stubs
for llndk stubs.
Test: no change to build.ninja or Android-${TARGET_PRODUCT}.mk
Change-Id: I9886498dcac7419958d290de99cf5f39f5fdedee
diff --git a/cc/library.go b/cc/library.go
index ac97168..a43adbb 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -346,7 +346,7 @@
// Location of the file that should be copied to dist dir when requested
distFile android.Path
- versionScriptPath android.ModuleGenPath
+ versionScriptPath android.OptionalPath
post_install_cmds []string
@@ -608,7 +608,7 @@
func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
if library.buildStubs() {
objs, versionScript := compileStubLibrary(ctx, flags, String(library.Properties.Stubs.Symbol_file), library.MutatedProperties.StubsVersion, "--apex")
- library.versionScriptPath = versionScript
+ library.versionScriptPath = android.OptionalPathForPath(versionScript)
return objs
}
@@ -928,10 +928,10 @@
linkerDeps = append(linkerDeps, forceWeakSymbols.Path())
}
}
- if library.buildStubs() {
+ if library.versionScriptPath.Valid() {
linkerScriptFlags := "-Wl,--version-script," + library.versionScriptPath.String()
flags.Local.LdFlags = append(flags.Local.LdFlags, linkerScriptFlags)
- linkerDeps = append(linkerDeps, library.versionScriptPath)
+ linkerDeps = append(linkerDeps, library.versionScriptPath.Path())
}
fileName := library.getLibName(ctx) + flags.Toolchain.ShlibSuffix()
@@ -1198,7 +1198,7 @@
}
if library.buildStubs() {
- library.reexportFlags("-D" + versioningMacroName(ctx.ModuleName()) + "=" + library.stubsVersion())
+ library.reexportFlags("-D" + versioningMacroName(ctx.baseModuleName()) + "=" + library.stubsVersion())
}
library.flagExporter.setProvider(ctx)