From 479df0db2c48e8ea93d0440ae9f1f2d2644094d7 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Fri, 13 Mar 2026 23:12:20 +0000 Subject: [PATCH] toolchain-funcs.eclass: Set some Go arch-specific vars in tc-env_build Some Go arch-specific variables can be set automatically based on the tuple alone. Others cannot feasibly be determined automatically and must therefore be set by the user. It is sometimes necessary to build Go code for CBUILD, so use BUILD_GO* variables in case CHOST is a more advanced model of CBUILD's architecture. Signed-off-by: James Le Cuirot --- eclass/toolchain-funcs.eclass | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index 2b57fc118705d..8299c103c8dc0 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -369,6 +369,13 @@ tc-export_build_env() { : "${BUILD_CXXFLAGS:=${CXXFLAGS}}" : "${BUILD_CPPFLAGS:=${CPPFLAGS}}" : "${BUILD_LDFLAGS:=${LDFLAGS}}" + + if has go-env ${INHERITED}; then + : "${BUILD_GOAMD64:=${GOAMD64}}" + : "${BUILD_GOARM64:=${GOARM64}}" + : "${BUILD_GOPPC64:=${GOPPC64}}" + : "${BUILD_GORISCV64:=${GORISCV64}}" + fi fi export BUILD_{C,CXX,CPP,LD}FLAGS @@ -388,6 +395,13 @@ tc-export_build_env() { # the target build system does not check. tc-env_build() { tc-export_build_env + + has go-env ${INHERITED} && local -x \ + GOAMD64=${BUILD_GOAMD64} \ + GOARM64=${BUILD_GOARM64} \ + GOPPC64=${BUILD_GOPPC64} \ + GORISCV64=${BUILD_GORISCV64} + CFLAGS=${BUILD_CFLAGS} \ CXXFLAGS=${BUILD_CXXFLAGS} \ CPPFLAGS=${BUILD_CPPFLAGS} \