From 2bc91ba5493a63561d5cb3c7af3a85db2f62b96b Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Thu, 28 Jul 2016 17:40:28 -0700 Subject: [PATCH] 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 --- cc/ndk_library.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cc/ndk_library.go b/cc/ndk_library.go index 903a96bff..d681b772b 100644 --- a/cc/ndk_library.go +++ b/cc/ndk_library.go @@ -93,6 +93,8 @@ type stubCompiler struct { baseCompiler properties libraryProperties + + linker *stubLinker } // OMG GO @@ -175,6 +177,7 @@ func (c *stubCompiler) compile(ctx ModuleContext, flags Flags, deps PathDeps) an 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 @@ func (c *stubCompiler) compile(ctx ModuleContext, flags Flags, deps PathDeps) an type stubLinker struct { libraryLinker + + versionScriptPath android.ModuleGenPath } func (linker *stubLinker) linkerDeps(ctx BaseModuleContext, deps Deps) Deps { @@ -221,6 +226,14 @@ func (linker *stubLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags { 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 @@ func newStubLibrary() *Module { module.linker = linker compiler := &stubCompiler{} + compiler.linker = linker module.compiler = compiler module.installer = &stubInstaller{baseInstaller{ dir: "lib",