kumquat-buildroot/package/go/0001-build.go-explicit-option-for-crosscompilation.patch
Christian Stewart 8a1158f89f package/go: add support for riscv64 architecture
Enable the supported "riscv64" GOARCH.

Add a patch to fix a build failure due to GOARCH leaking into the calls to the
go-bootstrap compiler. Unsets the GOARCH before calling go-bootstrap.

PR: https://github.com/golang/go/pull/52362

Signed-off-by: Christian Stewart <christian@paral.in>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-05-14 11:37:17 +02:00

41 lines
1.5 KiB
Diff

From 335c6245674088de616324398137416c7a1cbe8f Mon Sep 17 00:00:00 2001
From: Angelo Compagnucci <angelo@amarulasolutions.com>
Date: Tue, 8 May 2018 16:08:44 +0200
Subject: [PATCH] build.go: explicit option for crosscompilation
Actually if GOHOSTOS == GOOS || GOHOSTARCH == GOARCH the go build system
assume it's not cross compiling and uses the same toolchain also for the
bootstrap. This is a problem in case the cross compilation mandates a
different toolchain for bootstrap and target. This patch adds
GO_ASSUME_CROSSCOMPILING varible to assure that in case of cross
compilation CC_FOR_TARGET can be different from CC.
Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
Signed-off-by: Anisse Astier <anisse@astier.eu>
---
src/cmd/dist/build.go | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index f99f1f4e43..08a9f24f59 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -286,12 +286,13 @@ func xinit() {
// $CC_FOR_goos_goarch, if set, applies only to goos/goarch.
func compilerEnv(envName, def string) map[string]string {
m := map[string]string{"": def}
+ crosscompiling := os.Getenv("GO_ASSUME_CROSSCOMPILING")
if env := os.Getenv(envName); env != "" {
m[""] = env
}
if env := os.Getenv(envName + "_FOR_TARGET"); env != "" {
- if gohostos != goos || gohostarch != goarch {
+ if gohostos != goos || gohostarch != goarch || crosscompiling == "1" {
m[gohostos+"/"+gohostarch] = m[""]
}
m[""] = env
--
2.35.1