Use the version script for ndk_library.
We were generating this, but not actually using it yet.
Test: `make ndk` with libc/libm migration patches, readelf generated
libs.
Change-Id: I9aadf58307bc645b33cab5207409552c5046937a
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 903a96b..d681b77 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -93,6 +93,8 @@
baseCompiler
properties libraryProperties
+
+ linker *stubLinker
}
// OMG GO
@@ -175,6 +177,7 @@
stubSrcPath := android.PathForModuleGen(ctx, stubSrcName)
versionScriptName := fileBase + ".map"
versionScriptPath := android.PathForModuleGen(ctx, versionScriptName)
+ c.linker.versionScriptPath = versionScriptPath
symbolFilePath := android.PathForModuleSrc(ctx, c.properties.Symbol_file)
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
Rule: genStubSrc,
@@ -209,6 +212,8 @@
type stubLinker struct {
libraryLinker
+
+ versionScriptPath android.ModuleGenPath
}
func (linker *stubLinker) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
@@ -221,6 +226,14 @@
return linker.libraryLinker.linkerFlags(ctx, flags)
}
+func (linker *stubLinker) link(ctx ModuleContext, flags Flags, deps PathDeps,
+ objFiles android.Paths) android.Path {
+
+ linkerScriptFlag := "-Wl,--version-script," + linker.versionScriptPath.String()
+ flags.LdFlags = append(flags.LdFlags, linkerScriptFlag)
+ return linker.libraryLinker.link(ctx, flags, deps, objFiles)
+}
+
type stubInstaller struct {
baseInstaller
@@ -258,6 +271,7 @@
module.linker = linker
compiler := &stubCompiler{}
+ compiler.linker = linker
module.compiler = compiler
module.installer = &stubInstaller{baseInstaller{
dir: "lib",