Use Soong modules for the NDK's extra STL libraries
* The extra STL libs are:
libc++abi.a [needed for ndk_libc++_static]
libandroid_support.a [always needed in NDK r16]
libunwind.a [needed for ARM32]
* The existing STL-dependency logic in linkShared only applies to shared
libraries. By moving it to STL deps, the extra STL libs are linked into
both shared libraries and executables.
* Remove the ndk_prebuilt_library/ndkPrebuiltLibraryFactory module type,
which is unused now.
* Reuse the ndk_prebuilt_static_stl module type to describe the extra
static libraries that are linked with both the static and shared libc++
STLs.
Bug: b/73133405
Test: manual
Change-Id: I3f73e4f882d39e6efa470073bb4fc8c42dff8253
diff --git a/cc/stl.go b/cc/stl.go
index 2da6471..6f63835 100644
--- a/cc/stl.go
+++ b/cc/stl.go
@@ -129,10 +129,16 @@
// 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)
- case "ndk_libc++_static":
- deps.StaticLibs = append(deps.StaticLibs, stl.Properties.SelectedStl)
+ case "ndk_libc++_shared", "ndk_libc++_static":
+ if stl.Properties.SelectedStl == "ndk_libc++_shared" {
+ deps.SharedLibs = append(deps.SharedLibs, stl.Properties.SelectedStl)
+ } else {
+ deps.StaticLibs = append(deps.StaticLibs, stl.Properties.SelectedStl, "ndk_libc++abi")
+ }
+ deps.StaticLibs = append(deps.StaticLibs, "ndk_libandroid_support")
+ if ctx.Arch().ArchType == android.Arm {
+ deps.StaticLibs = append(deps.StaticLibs, "ndk_libunwind")
+ }
default:
panic(fmt.Errorf("Unknown stl: %q", stl.Properties.SelectedStl))
}