Make libdl.so be loaded after libc.so

Make sure that libdl is always after libc on the command line.
Simplifies the logic to always support system_shared_libs for
sdk and vndk builds.

For backwards compatibility without updating lots of Android.bp
files, allow libdl to be listed in shared_libs as long as it
is also in system_shared_libs or libc is not in system_shared_libs.

Remove all the places that libdl is added as a dependency, since
it will always be present unless explicitly removed now.

Bug: 62815515
Test: m -j checkbuild
Change-Id: I0233178ffea87a2f0b82190746022476304a68e2
This commit is contained in:
Colin Cross
2017-08-18 16:52:25 -07:00
committed by Justin Yun
parent 0b062130dc
commit ef88ae2369
3 changed files with 25 additions and 38 deletions

View File

@@ -107,8 +107,6 @@ func (stl *stl) deps(ctx BaseModuleContext, deps Deps) Deps {
}
if ctx.staticBinary() {
deps.StaticLibs = append(deps.StaticLibs, "libm", "libc", "libdl")
} else {
deps.SharedLibs = append(deps.SharedLibs, "libdl")
}
}
case "":
@@ -118,15 +116,9 @@ func (stl *stl) deps(ctx BaseModuleContext, deps Deps) Deps {
// The system STL doesn't have a prebuilt (it uses the system's libstdc++), but it does have
// its own includes. The includes are handled in CCBase.Flags().
deps.SharedLibs = append([]string{"libstdc++"}, deps.SharedLibs...)
case "ndk_libc++_shared":
deps.SharedLibs = append(deps.SharedLibs, stl.Properties.SelectedStl,
"libdl")
case "ndk_libc++_static":
deps.StaticLibs = append(deps.StaticLibs, stl.Properties.SelectedStl)
deps.SharedLibs = append(deps.SharedLibs, "libdl")
case "ndk_libstlport_shared":
case "ndk_libc++_shared", "ndk_libstlport_shared":
deps.SharedLibs = append(deps.SharedLibs, stl.Properties.SelectedStl)
case "ndk_libstlport_static", "ndk_libgnustl_static":
case "ndk_libc++_static", "ndk_libstlport_static", "ndk_libgnustl_static":
deps.StaticLibs = append(deps.StaticLibs, stl.Properties.SelectedStl)
default:
panic(fmt.Errorf("Unknown stl: %q", stl.Properties.SelectedStl))