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/linker.go b/cc/linker.go
index 28572c6..6d4edbc 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -119,7 +119,7 @@
deps.LateStaticLibs = append(deps.LateStaticLibs, "libcompiler_rt-extras")
}
- if ctx.Device() {
+ if ctx.toolchain().Bionic() {
// libgcc and libatomic have to be last on the command line
deps.LateStaticLibs = append(deps.LateStaticLibs, "libatomic")
if !Bool(linker.Properties.No_libgcc) {
@@ -165,7 +165,7 @@
flags.LdFlags = append(flags.LdFlags, toolchain.Ldflags())
}
- if ctx.Host() {
+ if !ctx.toolchain().Bionic() {
CheckBadHostLdlibs(ctx, "host_ldlibs", linker.Properties.Host_ldlibs)
flags.LdFlags = append(flags.LdFlags, linker.Properties.Host_ldlibs...)