Fix shared_libs for cc/prebuilt.go

This commit fixes `shared_libs` for `cc_prebuilt_binary`,
`cc_prebuilt_library_static`, and `cc_prebuilt_library_shared`.  Before
this commit, all shared libraries in `shared_libs` are dropped from the
generated `LOCAL_SHARED_LIBRARIES`.  This commit fixes the problem by
delegating `linkerDeps()` to `libraryDecorator.linkerDeps()`.

This commit also fixes the dependencies to NDK shared libraries.  Before
this change, those dependencies are mapped to a `ndkStubDepTag` and then
ignored by the computation of `AndroidMkSharedLibs`.  This commit adds
it back.

Bug: 123053270
Bug: 119084334
Test: libclang_rt.scudo-*.so can be checked with 2 more hacks.
Change-Id: I59e37e1a3fe0c329e8cb7032e5671f117f7832a0
This commit is contained in:
Logan Chien 2019-01-14 15:35:08 +08:00
parent f1b3352b97
commit c7f797ea54
2 changed files with 6 additions and 5 deletions

View file

@ -1674,6 +1674,11 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
// they merely serve as Make dependencies and do not affect this lib itself. // they merely serve as Make dependencies and do not affect this lib itself.
c.Properties.AndroidMkSharedLibs = append( c.Properties.AndroidMkSharedLibs = append(
c.Properties.AndroidMkSharedLibs, makeLibName(depName)) c.Properties.AndroidMkSharedLibs, makeLibName(depName))
case ndkStubDepTag, ndkLateStubDepTag:
ndkStub := ccDep.linker.(*stubDecorator)
c.Properties.AndroidMkSharedLibs = append(
c.Properties.AndroidMkSharedLibs,
depName+"."+ndkStub.properties.ApiLevel)
case staticDepTag, staticExportDepTag, lateStaticDepTag: case staticDepTag, staticExportDepTag, lateStaticDepTag:
c.Properties.AndroidMkStaticLibs = append( c.Properties.AndroidMkStaticLibs = append(
c.Properties.AndroidMkStaticLibs, makeLibName(depName)) c.Properties.AndroidMkStaticLibs, makeLibName(depName))

View file

@ -59,11 +59,7 @@ var _ prebuiltLinkerInterface = (*prebuiltLibraryLinker)(nil)
func (p *prebuiltLibraryLinker) linkerInit(ctx BaseModuleContext) {} func (p *prebuiltLibraryLinker) linkerInit(ctx BaseModuleContext) {}
func (p *prebuiltLibraryLinker) linkerDeps(ctx DepsContext, deps Deps) Deps { func (p *prebuiltLibraryLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
// export_header_lib_headers needs to be passed along return p.libraryDecorator.linkerDeps(ctx, deps)
return Deps{
HeaderLibs: p.baseLinker.Properties.Header_libs,
ReexportHeaderLibHeaders: p.baseLinker.Properties.Export_header_lib_headers,
}
} }
func (p *prebuiltLibraryLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags { func (p *prebuiltLibraryLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {