Add LinuxBionic toolchain and switch

This adds a toolchain definition for LinuxBionic that only supports
Clang/64-bit. It pulls pieces from the x86_linux_host and x86_64_device
configs, and uses the android clang triple, with some manual overrides.

To enable building this, set your soong.config file to:

 {"Host_bionic": true}

Bug: 31559095
Test: out/soong/{Android,make-vars}-aosp_arm64.mk the same with or
      without host bionic turned on
Test: No change to out/soong/build.ninja before/after this change
Change-Id: Id97dda8bd9aa670c32aed31fbe6aaa8175e70b59
diff --git a/cc/binary.go b/cc/binary.go
index 521ccb7..637f6c7 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -15,6 +15,8 @@
 package cc
 
 import (
+	"path/filepath"
+
 	"github.com/google/blueprint"
 	"github.com/google/blueprint/proptools"
 
@@ -236,7 +238,22 @@
 				if binary.Properties.DynamicLinker != "" {
 					flags.DynamicLinker = binary.Properties.DynamicLinker
 				} else {
-					flags.DynamicLinker = "/system/bin/linker"
+					switch ctx.Os() {
+					case android.Android:
+						flags.DynamicLinker = "/system/bin/linker"
+					case android.LinuxBionic:
+						// The linux kernel expects the linker to be an
+						// absolute path
+						path := android.PathForOutput(ctx,
+							"host", "linux_bionic-x86", "bin", "linker")
+						if p, err := filepath.Abs(path.String()); err == nil {
+							flags.DynamicLinker = p
+						} else {
+							ctx.ModuleErrorf("can't find path to dynamic linker: %q", err)
+						}
+					default:
+						ctx.ModuleErrorf("unknown dynamic linker")
+					}
 					if flags.Toolchain.Is64Bit() {
 						flags.DynamicLinker += "64"
 					}