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

Commit 57da8269 authored by Chih-Hung Hsieh's avatar Chih-Hung Hsieh
Browse files

Do not add non-existing -Bprebuilts/gcc/.../bin

* Only prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/bin
  exists for x86_windows_host.
* Remove config.ToolPath;
  add required -B flags into ToolchainCflags and ToolchainLdflags.

Bug: 218883919
Test: make droid tidy-soong_subset
Change-Id: I9a18bf8cc0cf84e091c7463b3bda316eaab53aa3
parent ec76c2f0
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -3943,7 +3943,6 @@ func TestIncludeDirectoryOrdering(t *testing.T) {
		"${config.ArmGenericCflags}",
		"-target",
		"armv7a-linux-androideabi20",
		"-B${config.ArmGccRoot}/arm-linux-androideabi/bin",
	}

	expectedIncludes := []string{
+3 −5
Original line number Diff line number Diff line
@@ -450,11 +450,9 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
		}
	}

	gccPrefix := "-B" + config.ToolPath(tc)

	flags.Global.CFlags = append(flags.Global.CFlags, target, gccPrefix)
	flags.Global.AsFlags = append(flags.Global.AsFlags, target, gccPrefix)
	flags.Global.LdFlags = append(flags.Global.LdFlags, target, gccPrefix)
	flags.Global.CFlags = append(flags.Global.CFlags, target)
	flags.Global.AsFlags = append(flags.Global.AsFlags, target)
	flags.Global.LdFlags = append(flags.Global.LdFlags, target)

	hod := "Host"
	if ctx.Os().Class == android.Device {
+6 −2
Original line number Diff line number Diff line
@@ -258,8 +258,12 @@ func (t *toolchainDarwin) AvailableLibraries() []string {
	return darwinAvailableLibraries
}

func (t *toolchainDarwin) ToolPath() string {
	return "${config.MacToolPath}"
func (t *toolchainDarwin) ToolchainCflags() string {
	return "-B${config.MacToolPath}"
}

func (t *toolchainDarwin) ToolchainLdflags() string {
	return "-B${config.MacToolPath}"
}

var toolchainDarwinArmSingleton Toolchain = &toolchainDarwinArm{}
+0 −13
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@ package config

import (
	"fmt"
	"path/filepath"

	"android/soong/android"
)
@@ -77,7 +76,6 @@ type Toolchain interface {
	GccTriple() string
	// GccVersion should return a real value, not a ninja reference
	GccVersion() string
	ToolPath() string

	IncludeFlags() string

@@ -198,10 +196,6 @@ func (toolchainBase) Musl() bool {
	return false
}

func (t toolchainBase) ToolPath() string {
	return ""
}

type toolchain64Bit struct {
	toolchainBase
}
@@ -283,11 +277,4 @@ func LibFuzzerRuntimeLibrary(t Toolchain) string {
	return LibclangRuntimeLibrary(t, "fuzzer")
}

func ToolPath(t Toolchain) string {
	if p := t.ToolPath(); p != "" {
		return p
	}
	return filepath.Join(t.GccRoot(), t.GccTriple(), "bin")
}

var inList = android.InList
+9 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
package config

import (
	"path/filepath"
	"strings"

	"android/soong/android"
@@ -180,6 +181,14 @@ func (t *toolchainWindows) GccTriple() string {
	return "${config.WindowsGccTriple}"
}

func (t *toolchainWindows) ToolchainCflags() string {
	return "-B" + filepath.Join(t.GccRoot(), t.GccTriple(), "bin")
}

func (t *toolchainWindows) ToolchainLdflags() string {
	return "-B" + filepath.Join(t.GccRoot(), t.GccTriple(), "bin")
}

func (t *toolchainWindows) GccVersion() string {
	return windowsGccVersion
}
Loading