Add Toolchain.Bionic()
Move some cc ctx.Host() / ctx.Device() checks over to using
ctx.toolchain().Bionic(). There will be more changes, these are just the
obvious ones dealing with host_ldlibs / crt / system libraries.
Bug: 31559095
Test: out/soong/build.ninja is identical
Change-Id: Ibba60483b4ab0e01f6996eb7d883120e4acc1830
diff --git a/cc/stl.go b/cc/stl.go
index 874e7ae..0ffeb03 100644
--- a/cc/stl.go
+++ b/cc/stl.go
@@ -97,7 +97,7 @@
} else {
deps.StaticLibs = append(deps.StaticLibs, stl.Properties.SelectedStl)
}
- if ctx.Device() {
+ if ctx.toolchain().Bionic() {
if ctx.Arch().ArchType == android.Arm {
deps.StaticLibs = append(deps.StaticLibs, "libunwind_llvm")
}
@@ -135,7 +135,7 @@
switch stl.Properties.SelectedStl {
case "libc++", "libc++_static":
flags.CFlags = append(flags.CFlags, "-D_USING_LIBCXX")
- if ctx.Host() {
+ if !ctx.toolchain().Bionic() {
flags.CppFlags = append(flags.CppFlags, "-nostdinc++")
flags.LdFlags = append(flags.LdFlags, "-nodefaultlibs")
flags.LdFlags = append(flags.LdFlags, "-lpthread", "-lm")
@@ -161,7 +161,7 @@
// Nothing
case "":
// None or error.
- if ctx.Host() {
+ if !ctx.toolchain().Bionic() {
flags.CppFlags = append(flags.CppFlags, "-nostdinc++")
flags.LdFlags = append(flags.LdFlags, "-nodefaultlibs")
if ctx.staticBinary() {