Build Go tools for arm
Test: prebuilts/build-tools/build-prebuilts.sh
Change-Id: I915be7bb7451f27fcd4beba5e6487da7a01639a6
diff --git a/android/arch.go b/android/arch.go
index 3cd6e4b..d6b2971 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -1553,7 +1553,7 @@
config.BuildOS = func() OsType {
switch runtime.GOOS {
case "linux":
- if Bool(config.productVariables.HostMusl) {
+ if Bool(config.productVariables.HostMusl) || runtime.GOARCH == "arm64" {
return LinuxMusl
}
return Linux
@@ -1565,11 +1565,25 @@
}()
config.BuildArch = func() ArchType {
- switch runtime.GOARCH {
- case "amd64":
- return X86_64
+ switch runtime.GOOS {
+ case "linux":
+ switch runtime.GOARCH {
+ case "amd64":
+ return X86_64
+ case "arm64":
+ return Arm64
+ default:
+ panic(fmt.Sprintf("unsupported arch: %s", runtime.GOARCH))
+ }
+ case "darwin":
+ switch runtime.GOARCH {
+ case "amd64":
+ return X86_64
+ default:
+ panic(fmt.Sprintf("unsupported arch: %s", runtime.GOARCH))
+ }
default:
- panic(fmt.Sprintf("unsupported Arch: %s", runtime.GOARCH))
+ panic(fmt.Sprintf("unsupported OS: %s", runtime.GOOS))
}
}()
diff --git a/android/config.go b/android/config.go
index f6d08b8..54c8aac 100644
--- a/android/config.go
+++ b/android/config.go
@@ -814,11 +814,18 @@
func (c *config) PrebuiltOS() string {
switch runtime.GOOS {
case "linux":
- return "linux-x86"
+ switch runtime.GOARCH {
+ case "amd64":
+ return "linux-x86"
+ case "arm64":
+ return "linux-arm64"
+ default:
+ panic(fmt.Errorf("Unknown GOARCH %s", runtime.GOARCH))
+ }
case "darwin":
return "darwin-x86"
default:
- panic("Unknown GOOS")
+ panic(fmt.Errorf("Unknown GOOS %s", runtime.GOOS))
}
}
diff --git a/android/paths.go b/android/paths.go
index 1c0321c..a020d8a 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -209,6 +209,10 @@
var _ ModuleErrorfContext = blueprint.ModuleContext(nil)
+type AddMissingDependenciesContext interface {
+ AddMissingDependencies([]string)
+}
+
// reportPathError will register an error with the attached context. It
// attempts ctx.ModuleErrorf for a better error message first, then falls
// back to ctx.Errorf.
@@ -220,7 +224,9 @@
// attempts ctx.ModuleErrorf for a better error message first, then falls
// back to ctx.Errorf.
func ReportPathErrorf(ctx PathContext, format string, args ...interface{}) {
- if mctx, ok := ctx.(ModuleErrorfContext); ok {
+ if mctx, ok := ctx.(AddMissingDependenciesContext); ok && ctx.Config().AllowMissingDependencies() {
+ mctx.AddMissingDependencies([]string{fmt.Sprintf(format, args...)})
+ } else if mctx, ok := ctx.(ModuleErrorfContext); ok {
mctx.ModuleErrorf(format, args...)
} else if ectx, ok := ctx.(errorfContext); ok {
ectx.Errorf(format, args...)