Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01a405a4 authored by Dan Willemsen's avatar Dan Willemsen
Browse files

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
parent 0e2d97b4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ bootstrap_go_package {

        "cc/config/x86_darwin_host.go",
        "cc/config/x86_linux_host.go",
        "cc/config/x86_linux_bionic_host.go",
        "cc/config/x86_windows_host.go",
    ],
    testSrcs: [
+5 −0
Original line number Diff line number Diff line
@@ -164,6 +164,11 @@ func translateAndroidMkModule(ctx blueprint.SingletonContext, w io.Writer, mod b
		return err
	}

	// Make does not understand LinuxBionic
	if amod.Os() == LinuxBionic {
		return nil
	}

	if data.SubName != "" {
		name += data.SubName
	}
+4 −0
Original line number Diff line number Diff line
@@ -781,6 +781,10 @@ func decodeTargetProductVariables(config *config) (map[OsClass][]Target, error)
		addTarget(BuildOs, *variables.HostSecondaryArch, nil, nil, nil)
	}

	if config.Host_bionic != nil && *config.Host_bionic {
		addTarget(LinuxBionic, "x86_64", nil, nil, nil)
	}

	if variables.CrossHost != nil && *variables.CrossHost != "" {
		crossHostOs := osByName(*variables.CrossHost)
		if crossHostOs == NoOsType {
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ const productVariablesFileName = "soong.variables"
type FileConfigurableOptions struct {
	Mega_device *bool `json:",omitempty"`
	Ndk_abis    *bool `json:",omitempty"`
	Host_bionic *bool `json:",omitempty"`
}

func (f *FileConfigurableOptions) SetDefaultConfig() {
+18 −1
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
package cc

import (
	"path/filepath"

	"github.com/google/blueprint"
	"github.com/google/blueprint/proptools"

@@ -236,7 +238,22 @@ func (binary *binaryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags
				if binary.Properties.DynamicLinker != "" {
					flags.DynamicLinker = binary.Properties.DynamicLinker
				} else {
					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"
					}
Loading