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/binary.go b/cc/binary.go
index c16dae6..2b77514 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -91,7 +91,7 @@
func (binary *binaryDecorator) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
deps = binary.baseLinker.linkerDeps(ctx, deps)
- if ctx.Device() {
+ if ctx.toolchain().Bionic() {
if !Bool(binary.baseLinker.Properties.Nocrt) {
if !ctx.sdk() {
if binary.static() {
@@ -163,7 +163,7 @@
func (binary *binaryDecorator) linkerInit(ctx BaseModuleContext) {
binary.baseLinker.linkerInit(ctx)
- if ctx.Host() {
+ if !ctx.toolchain().Bionic() {
if ctx.Os() == android.Linux {
if binary.Properties.Static_executable == nil && Bool(ctx.AConfig().ProductVariables.HostStaticBinaries) {
binary.Properties.Static_executable = proptools.BoolPtr(true)
@@ -210,7 +210,7 @@
flags.CFlags = append(flags.CFlags, "-fpie")
}
- if ctx.Device() {
+ if ctx.toolchain().Bionic() {
if binary.static() {
// Clang driver needs -static to create static executable.
// However, bionic/linker uses -shared to overwrite.