Link libc++demangle with libc++ for the device.

libc++demangle provides __cxa_demangle, which used to be a part of
libc++.so but is being moved out to save on resources since very few
libraries need it.

Test: make checkbuild
Bug: http://b/138245375
Change-Id: Ie97225d496d7d40f8749522bf36702a2d9dcdfe7
diff --git a/cc/stl.go b/cc/stl.go
index 1a5dd79..d7feb6f 100644
--- a/cc/stl.go
+++ b/cc/stl.go
@@ -161,6 +161,15 @@
 		} else {
 			deps.StaticLibs = append(deps.StaticLibs, stl.Properties.SelectedStl)
 		}
+		if ctx.Device() && !ctx.useSdk() {
+			// __cxa_demangle is not a part of libc++.so on the device since
+			// it's large and most processes don't need it. Statically link
+			// libc++demangle into every process so that users still have it if
+			// needed, but the linker won't include this unless it is actually
+			// called.
+			// http://b/138245375
+			deps.StaticLibs = append(deps.StaticLibs, "libc++demangle")
+		}
 		if ctx.toolchain().Bionic() {
 			if ctx.Arch().ArchType == android.Arm {
 				deps.StaticLibs = append(deps.StaticLibs, "libunwind_llvm")