From patchwork Sat Mar 1 07:55:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxu Jia X-Patchwork-Id: 58115 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EFFEC282D2 for ; Sat, 1 Mar 2025 07:56:06 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web11.5119.1740815763965397370 for ; Fri, 28 Feb 2025 23:56:03 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=5155a5e946=hongxu.jia@windriver.com) Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5217tSrF023952; Fri, 28 Feb 2025 23:55:57 -0800 Received: from ala-exchng02.corp.ad.wrs.com (ala-exchng02.wrs.com [147.11.82.254]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 4533v09cy3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 28 Feb 2025 23:55:56 -0800 (PST) Received: from ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Fri, 28 Feb 2025 23:55:56 -0800 Received: from pek-lpg-core5.wrs.com (147.11.136.210) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server id 15.1.2507.43 via Frontend Transport; Fri, 28 Feb 2025 23:55:54 -0800 From: Hongxu Jia To: , CC: , , Subject: [poky][PATCH 1/3] go: upgrade 1.22.12 -> 1.24.0 Date: Sat, 1 Mar 2025 15:55:50 +0800 Message-ID: <20250301075552.354661-2-hongxu.jia@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250301075552.354661-1-hongxu.jia@windriver.com> References: <20250301075552.354661-1-hongxu.jia@windriver.com> MIME-Version: 1.0 X-Authority-Analysis: v=2.4 cv=HJQ5Fptv c=1 sm=1 tr=0 ts=67c2bd8d cx=c_pps a=K4BcnWQioVPsTJd46EJO2w==:117 a=K4BcnWQioVPsTJd46EJO2w==:17 a=T2h4t0Lz3GQA:10 a=plf8rDjJAAAA:8 a=NEAV23lmAAAA:8 a=pM9yUfARAAAA:8 a=1XWaLZrsAAAA:8 a=Oh2cFVv5AAAA:8 a=t7CeM3EgAAAA:8 a=pGLkceISAAAA:8 a=ag1SF4gXAAAA:8 a=sznM2NahO1xLrs5emqQA:9 a=XUX8r-IlPeSs03s8:21 a=JWTSs7K9Rhv-lrTctFka:22 a=YH-7kEGJnRg4CV3apUU-:22 a=7KeoIwV6GZqOttXkcoxL:22 a=FdTzh2GWekK77mhwV6Dw:22 a=Yupwre4RP9_Eg_Bd0iYG:22 X-Proofpoint-GUID: Kmt-a4Ks6Q0_jYR6Ccgf1SG5PqYBAjzR X-Proofpoint-ORIG-GUID: Kmt-a4Ks6Q0_jYR6Ccgf1SG5PqYBAjzR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-01_02,2025-02-28_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 clxscore=1011 mlxlogscore=999 suspectscore=0 adultscore=0 bulkscore=0 spamscore=0 mlxscore=0 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.21.0-2502100000 definitions=main-2503010060 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sat, 01 Mar 2025 07:56:06 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/212089 Refresh patches See [1] for Go 1.24 Release Notes License-Update: update per Google Legal [2] [1] https://go.dev/doc/go1.24 [2] https://github.com/golang/go/commit/760b722c344d312ab62a5c2f94865a869ce0bab9 Signed-off-by: Hongxu Jia --- .../go/{go-1.22.12.inc => go-1.24.0.inc} | 4 +- ..._1.22.12.bb => go-binary-native_1.24.0.bb} | 8 ++-- ...1.22.12.bb => go-cross-canadian_1.24.0.bb} | 0 ...go-cross_1.22.12.bb => go-cross_1.24.0.bb} | 0 ...sssdk_1.22.12.bb => go-crosssdk_1.24.0.bb} | 0 ...untime_1.22.12.bb => go-runtime_1.24.0.bb} | 0 ...ent-based-hash-generation-less-pedan.patch | 39 +++++++++++-------- ...OOLDIR-to-be-overridden-in-the-envir.patch | 16 +++++--- ...3-ld-add-soname-to-shareable-objects.patch | 15 ++++--- ...de-CC-when-building-dist-and-go_boot.patch | 33 +++++++++------- ...dist-separate-host-and-target-builds.patch | 38 ++++++++++-------- ...d-go-make-GOROOT-precious-by-default.patch | 23 ++++++----- ...ut-build-specific-paths-from-linker-.patch | 14 ++++--- ...ldgo.go-do-not-hardcode-host-compile.patch | 11 ++++-- ...uild-paths-on-staticly-linked-arches.patch | 15 ++++--- ...5b008e3d106b2706645e5a88cd8e2fb98953.patch | 9 ++++- .../go/{go_1.22.12.bb => go_1.24.0.bb} | 0 17 files changed, 135 insertions(+), 90 deletions(-) rename meta/recipes-devtools/go/{go-1.22.12.inc => go-1.24.0.inc} (82%) rename meta/recipes-devtools/go/{go-binary-native_1.22.12.bb => go-binary-native_1.24.0.bb} (73%) rename meta/recipes-devtools/go/{go-cross-canadian_1.22.12.bb => go-cross-canadian_1.24.0.bb} (100%) rename meta/recipes-devtools/go/{go-cross_1.22.12.bb => go-cross_1.24.0.bb} (100%) rename meta/recipes-devtools/go/{go-crosssdk_1.22.12.bb => go-crosssdk_1.24.0.bb} (100%) rename meta/recipes-devtools/go/{go-runtime_1.22.12.bb => go-runtime_1.24.0.bb} (100%) rename meta/recipes-devtools/go/{go_1.22.12.bb => go_1.24.0.bb} (100%) diff --git a/meta/recipes-devtools/go/go-1.22.12.inc b/meta/recipes-devtools/go/go-1.24.0.inc similarity index 82% rename from meta/recipes-devtools/go/go-1.22.12.inc rename to meta/recipes-devtools/go/go-1.24.0.inc index 8d14efa1e9..26a4947caf 100644 --- a/meta/recipes-devtools/go/go-1.22.12.inc +++ b/meta/recipes-devtools/go/go-1.24.0.inc @@ -2,7 +2,7 @@ require go-common.inc FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/go:" -LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" +LIC_FILES_CHKSUM = "file://LICENSE;md5=7998cb338f82d15c0eff93b7004d272a" SRC_URI += "\ file://0001-cmd-go-make-content-based-hash-generation-less-pedan.patch \ @@ -16,4 +16,4 @@ SRC_URI += "\ file://0009-go-Filter-build-paths-on-staticly-linked-arches.patch \ file://6d265b008e3d106b2706645e5a88cd8e2fb98953.patch \ " -SRC_URI[main.sha256sum] = "012a7e1f37f362c0918c1dfa3334458ac2da1628c4b9cf4d9ca02db986e17d71" +SRC_URI[main.sha256sum] = "d14120614acb29d12bcab72bd689f257eb4be9e0b6f88a8fb7e41ac65f8556e5" diff --git a/meta/recipes-devtools/go/go-binary-native_1.22.12.bb b/meta/recipes-devtools/go/go-binary-native_1.24.0.bb similarity index 73% rename from meta/recipes-devtools/go/go-binary-native_1.22.12.bb rename to meta/recipes-devtools/go/go-binary-native_1.24.0.bb index 747737ff94..d9eebb9c37 100644 --- a/meta/recipes-devtools/go/go-binary-native_1.22.12.bb +++ b/meta/recipes-devtools/go/go-binary-native_1.24.0.bb @@ -3,15 +3,15 @@ SUMMARY = "Go programming language compiler (upstream binary for bootstrap)" HOMEPAGE = " http://golang.org/" LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" +LIC_FILES_CHKSUM = "file://LICENSE;md5=7998cb338f82d15c0eff93b7004d272a" PROVIDES = "go-native" # Checksums available at https://go.dev/dl/ SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}" -SRC_URI[go_linux_amd64.sha256sum] = "4fa4f869b0f7fc6bb1eb2660e74657fbf04cdd290b5aef905585c86051b34d43" -SRC_URI[go_linux_arm64.sha256sum] = "fd017e647ec28525e86ae8203236e0653242722a7436929b1f775744e26278e7" -SRC_URI[go_linux_ppc64le.sha256sum] = "9573d30003b0796717a99d9e2e96c48fddd4fc0f29d840f212c503b03d7de112" +SRC_URI[go_linux_amd64.sha256sum] = "dea9ca38a0b852a74e81c26134671af7c0fbe65d81b0dc1c5bfe22cf7d4c8858" +SRC_URI[go_linux_arm64.sha256sum] = "c3fa6d16ffa261091a5617145553c71d21435ce547e44cc6dfb7470865527cc7" +SRC_URI[go_linux_ppc64le.sha256sum] = "a871a43de7d26c91dd90cb6e0adacb214c9e35ee2188c617c91c08c017efe81a" UPSTREAM_CHECK_URI = "https://golang.org/dl/" UPSTREAM_CHECK_REGEX = "go(?P\d+(\.\d+)+)\.linux" diff --git a/meta/recipes-devtools/go/go-cross-canadian_1.22.12.bb b/meta/recipes-devtools/go/go-cross-canadian_1.24.0.bb similarity index 100% rename from meta/recipes-devtools/go/go-cross-canadian_1.22.12.bb rename to meta/recipes-devtools/go/go-cross-canadian_1.24.0.bb diff --git a/meta/recipes-devtools/go/go-cross_1.22.12.bb b/meta/recipes-devtools/go/go-cross_1.24.0.bb similarity index 100% rename from meta/recipes-devtools/go/go-cross_1.22.12.bb rename to meta/recipes-devtools/go/go-cross_1.24.0.bb diff --git a/meta/recipes-devtools/go/go-crosssdk_1.22.12.bb b/meta/recipes-devtools/go/go-crosssdk_1.24.0.bb similarity index 100% rename from meta/recipes-devtools/go/go-crosssdk_1.22.12.bb rename to meta/recipes-devtools/go/go-crosssdk_1.24.0.bb diff --git a/meta/recipes-devtools/go/go-runtime_1.22.12.bb b/meta/recipes-devtools/go/go-runtime_1.24.0.bb similarity index 100% rename from meta/recipes-devtools/go/go-runtime_1.22.12.bb rename to meta/recipes-devtools/go/go-runtime_1.24.0.bb diff --git a/meta/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch b/meta/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch index a8e5d6e86d..86e941b970 100644 --- a/meta/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch +++ b/meta/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch @@ -1,7 +1,8 @@ -From 9b3ebef0356594a447906f00fe80584952c08289 Mon Sep 17 00:00:00 2001 +From 51c04a9a19dec5a48fa0f38324dc2480b7a859e4 Mon Sep 17 00:00:00 2001 From: Khem Raj -Date: Mon, 28 Mar 2022 10:59:03 -0700 -Subject: [PATCH] cmd/go: make content-based hash generation less pedantic +Date: Sat, 22 Feb 2025 03:24:48 -0800 +Subject: [PATCH 01/11] cmd/go: make content-based hash generation less + pedantic Go 1.10's build tool now uses content-based hashes to determine when something should be built or re-built. @@ -26,16 +27,19 @@ Signed-off-by: Alex Kube Signed-off-by: Matt Madison Signed-off-by: Khem Raj Signed-off-by: Jose Quaresma + +Rebase to 1.23.4 +Signed-off-by: Hongxu Jia --- src/cmd/go/internal/envcmd/env.go | 2 +- src/cmd/go/internal/work/exec.go | 44 ++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go -index c7c2e83..4a90d9d 100644 +index 7c370d427f..c2441f7695 100644 --- a/src/cmd/go/internal/envcmd/env.go +++ b/src/cmd/go/internal/envcmd/env.go -@@ -189,7 +189,7 @@ func ExtraEnvVarsCostly() []cfg.EnvVar { +@@ -219,7 +219,7 @@ func ExtraEnvVarsCostly() []cfg.EnvVar { } }() @@ -45,10 +49,10 @@ index c7c2e83..4a90d9d 100644 // Should not happen - b.CFlags was given an empty package. fmt.Fprintf(os.Stderr, "go: invalid cflags: %v\n", err) diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go -index e05471b..9724cd0 100644 +index 7b073165d5..1f618be0bb 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go -@@ -232,6 +232,8 @@ func (b *Builder) Do(ctx context.Context, root *Action) { +@@ -237,6 +237,8 @@ func (b *Builder) Do(ctx context.Context, root *Action) { writeActionGraph() } @@ -57,7 +61,7 @@ index e05471b..9724cd0 100644 // buildActionID computes the action ID for a build action. func (b *Builder) buildActionID(a *Action) cache.ActionID { p := a.Package -@@ -253,7 +255,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { +@@ -258,7 +260,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { if p.Module != nil { fmt.Fprintf(h, "module %s@%s\n", p.Module.Path, p.Module.Version) } @@ -66,7 +70,7 @@ index e05471b..9724cd0 100644 // The Go compiler always hides the exact value of $GOROOT // when building things in GOROOT. // -@@ -285,9 +287,9 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { +@@ -293,9 +295,9 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { } if len(p.CgoFiles)+len(p.SwigFiles)+len(p.SwigCXXFiles) > 0 { fmt.Fprintf(h, "cgo %q\n", b.toolID("cgo")) @@ -78,7 +82,7 @@ index e05471b..9724cd0 100644 fmt.Fprintf(h, "CC=%q %q %q %q\n", ccExe, cppflags, cflags, ldflags) // Include the C compiler tool ID so that if the C // compiler changes we rebuild the package. -@@ -295,14 +297,14 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { +@@ -303,14 +305,14 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { fmt.Fprintf(h, "CC ID=%q\n", ccID) } if len(p.CXXFiles)+len(p.SwigCXXFiles) > 0 { @@ -95,7 +99,7 @@ index e05471b..9724cd0 100644 fmt.Fprintf(h, "FC=%q %q\n", fcExe, fflags) if fcID, _, err := b.gccToolID(fcExe[0], "f95"); err == nil { fmt.Fprintf(h, "FC ID=%q\n", fcID) -@@ -319,7 +321,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { +@@ -327,7 +329,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { } } if p.Internal.BuildInfo != nil { @@ -104,7 +108,7 @@ index e05471b..9724cd0 100644 } // Configuration specific to compiler toolchain. -@@ -2679,8 +2681,25 @@ func envList(key, def string) []string { +@@ -2659,8 +2661,25 @@ func envList(key, def string) []string { return args } @@ -131,8 +135,8 @@ index e05471b..9724cd0 100644 if cppflags, err = buildFlags("CPPFLAGS", "", p.CgoCPPFLAGS, checkCompilerFlags); err != nil { return } -@@ -2696,6 +2715,13 @@ func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, l - if ldflags, err = buildFlags("LDFLAGS", defaultCFlags, p.CgoLDFLAGS, checkLinkerFlags); err != nil { +@@ -2676,6 +2695,13 @@ func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, l + if ldflags, err = buildFlags("LDFLAGS", DefaultCFlags, p.CgoLDFLAGS, checkLinkerFlags); err != nil { return } + if filtered { @@ -145,7 +149,7 @@ index e05471b..9724cd0 100644 return } -@@ -2713,7 +2739,7 @@ func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgo +@@ -2693,7 +2719,7 @@ func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgo p := a.Package sh := b.Shell(a) @@ -154,7 +158,7 @@ index e05471b..9724cd0 100644 if err != nil { return nil, nil, err } -@@ -3268,7 +3294,7 @@ func (b *Builder) swigOne(a *Action, file, objdir string, pcCFLAGS []string, cxx +@@ -3256,7 +3282,7 @@ func (b *Builder) swigOne(a *Action, file, objdir string, pcCFLAGS []string, cxx p := a.Package sh := b.Shell(a) @@ -163,3 +167,6 @@ index e05471b..9724cd0 100644 if err != nil { return "", "", err } +-- +2.25.1 + diff --git a/meta/recipes-devtools/go/go/0002-cmd-go-Allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch b/meta/recipes-devtools/go/go/0002-cmd-go-Allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch index a69ada47b0..7e86d8cd6b 100644 --- a/meta/recipes-devtools/go/go/0002-cmd-go-Allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch +++ b/meta/recipes-devtools/go/go/0002-cmd-go-Allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch @@ -1,7 +1,8 @@ -From 687ff9d17f756145f9a58413070cccbd488d1ea2 Mon Sep 17 00:00:00 2001 +From fdad9a0ea659cf2281a0df16b0f69f179605ec9a Mon Sep 17 00:00:00 2001 From: Alex Kube Date: Wed, 23 Oct 2019 21:15:37 +0430 -Subject: [PATCH] cmd/go: Allow GOTOOLDIR to be overridden in the environment +Subject: [PATCH 02/11] cmd/go: Allow GOTOOLDIR to be overridden in the + environment to allow for split host/target build roots @@ -19,10 +20,10 @@ Signed-off-by: Jose Quaresma 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go -index 32e59b4..06ee4de 100644 +index 1f467647f5..b62e518030 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go -@@ -259,7 +259,9 @@ func xinit() { +@@ -280,7 +280,9 @@ func xinit() { } xatexit(rmworkdir) @@ -34,10 +35,10 @@ index 32e59b4..06ee4de 100644 goversion := findgoversion() isRelease = strings.HasPrefix(goversion, "release.") || strings.HasPrefix(goversion, "go") diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go -index a8daa2d..393ada3 100644 +index 3b9f27e91d..ec043c1530 100644 --- a/src/cmd/go/internal/cfg/cfg.go +++ b/src/cmd/go/internal/cfg/cfg.go -@@ -230,7 +230,11 @@ func SetGOROOT(goroot string, isTestGo bool) { +@@ -248,7 +248,11 @@ func SetGOROOT(goroot string, isTestGo bool) { // This matches the initialization of ToolDir in go/build, except for // using ctxt.GOROOT and the installed GOOS and GOARCH rather than the // GOROOT, GOOS, and GOARCH reported by the runtime package. @@ -50,3 +51,6 @@ index a8daa2d..393ada3 100644 } } } +-- +2.25.1 + diff --git a/meta/recipes-devtools/go/go/0003-ld-add-soname-to-shareable-objects.patch b/meta/recipes-devtools/go/go/0003-ld-add-soname-to-shareable-objects.patch index abc5faa21c..86a4bb1ea5 100644 --- a/meta/recipes-devtools/go/go/0003-ld-add-soname-to-shareable-objects.patch +++ b/meta/recipes-devtools/go/go/0003-ld-add-soname-to-shareable-objects.patch @@ -1,7 +1,7 @@ -From 01fe178b292db12d811811ff2d8d56b225e4b5e8 Mon Sep 17 00:00:00 2001 +From 1546d837c69b654754ee137af1fa1c2f7500cfa2 Mon Sep 17 00:00:00 2001 From: Alex Kube Date: Wed, 23 Oct 2019 21:16:32 +0430 -Subject: [PATCH] ld: add soname to shareable objects +Subject: [PATCH 03/11] ld: add soname to shareable objects so that OE's shared library dependency handling can find them. @@ -19,10 +19,10 @@ Signed-off-by: Jose Quaresma 1 file changed, 3 insertions(+) diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go -index eab74dc..ae9bbc9 100644 +index 2d8f964f35..dfc72e02c0 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go -@@ -1576,6 +1576,7 @@ func (ctxt *Link) hostlink() { +@@ -1624,6 +1624,7 @@ func (ctxt *Link) hostlink() { argv = append(argv, "-Wl,-z,relro") } argv = append(argv, "-shared") @@ -30,7 +30,7 @@ index eab74dc..ae9bbc9 100644 if ctxt.HeadType == objabi.Hwindows { argv = addASLRargs(argv, *flagAslr) } else { -@@ -1591,6 +1592,7 @@ func (ctxt *Link) hostlink() { +@@ -1639,6 +1640,7 @@ func (ctxt *Link) hostlink() { argv = append(argv, "-Wl,-z,relro") } argv = append(argv, "-shared") @@ -38,7 +38,7 @@ index eab74dc..ae9bbc9 100644 case BuildModePlugin: if ctxt.HeadType == objabi.Hdarwin { argv = append(argv, "-dynamiclib") -@@ -1599,6 +1601,7 @@ func (ctxt *Link) hostlink() { +@@ -1647,6 +1649,7 @@ func (ctxt *Link) hostlink() { argv = append(argv, "-Wl,-z,relro") } argv = append(argv, "-shared") @@ -46,3 +46,6 @@ index eab74dc..ae9bbc9 100644 } } +-- +2.25.1 + diff --git a/meta/recipes-devtools/go/go/0004-make.bash-override-CC-when-building-dist-and-go_boot.patch b/meta/recipes-devtools/go/go/0004-make.bash-override-CC-when-building-dist-and-go_boot.patch index 9df43c46d0..abbb7bda2b 100644 --- a/meta/recipes-devtools/go/go/0004-make.bash-override-CC-when-building-dist-and-go_boot.patch +++ b/meta/recipes-devtools/go/go/0004-make.bash-override-CC-when-building-dist-and-go_boot.patch @@ -1,7 +1,8 @@ -From e47d157631d1b97403f253c63d361b7380b32c22 Mon Sep 17 00:00:00 2001 +From b41aaa851f0074682fcd4bf07c891fbdf0fdf70c Mon Sep 17 00:00:00 2001 From: Alex Kube -Date: Wed, 23 Oct 2019 21:17:16 +0430 -Subject: [PATCH] make.bash: override CC when building dist and go_bootstrap +Date: Sat, 22 Feb 2025 03:14:37 -0800 +Subject: [PATCH 04/11] make.bash: override CC when building dist and + go_bootstrap for handling OE cross-canadian builds. @@ -13,24 +14,27 @@ Upstream-Status: Inappropriate [OE specific] Signed-off-by: Alexander J Kube Signed-off-by: Jose Quaresma + +Rebase to 1.23.4 +Signed-off-by: Hongxu Jia --- src/make.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/make.bash b/src/make.bash -index 76ad516..074e129 100755 +index b67ae1529f..b59cdabd09 100755 --- a/src/make.bash +++ b/src/make.bash -@@ -198,7 +198,7 @@ if [[ "$GOROOT_BOOTSTRAP" == "$GOROOT" ]]; then - exit 1 - fi - rm -f cmd/dist/dist --GOROOT="$GOROOT_BOOTSTRAP" nogoenv "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist -+CC="${BUILD_CC:-${CC}}" GOROOT="$GOROOT_BOOTSTRAP" nogoenv "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist +@@ -153,7 +153,7 @@ fi + export GOROOT_BOOTSTRAP + + bootstrapenv() { +- GOROOT="$GOROOT_BOOTSTRAP" GO111MODULE=off GOENV=off GOOS= GOARCH= GOEXPERIMENT= GOFLAGS= "$@" ++ CC="${BUILD_CC:-${CC}}" GOROOT="$GOROOT_BOOTSTRAP" GO111MODULE=off GOENV=off GOOS= GOARCH= GOEXPERIMENT= GOFLAGS= "$@" + } - # -e doesn't propagate out of eval, so check success by hand. - eval $(./cmd/dist/dist env -p || echo FAIL=true) -@@ -223,7 +223,7 @@ fi + export GOROOT="$(cd .. && pwd)" +@@ -216,7 +216,7 @@ fi # Run dist bootstrap to complete make.bash. # Bootstrap installs a proper cmd/dist, built with the new toolchain. # Throw ours, built with the bootstrap toolchain, away after bootstrap. @@ -39,3 +43,6 @@ index 76ad516..074e129 100755 rm -f ./cmd/dist/dist # DO NOT ADD ANY NEW CODE HERE. +-- +2.25.1 + diff --git a/meta/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch b/meta/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch index bc25d08fbf..f7c3108a98 100644 --- a/meta/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch +++ b/meta/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch @@ -1,7 +1,7 @@ -From bae1cec790ff17c4c93a2f8fda27036e5e021f6d Mon Sep 17 00:00:00 2001 +From 12bf824f8b7e85f05434aa00e866e883a551aaeb Mon Sep 17 00:00:00 2001 From: Alex Kube -Date: Wed, 23 Oct 2019 21:18:12 +0430 -Subject: [PATCH] cmd/dist: separate host and target builds +Date: Fri, 28 Feb 2025 19:09:17 -0800 +Subject: [PATCH 05/11] cmd/dist: separate host and target builds Change the dist tool to allow for OE-style cross- and cross-canadian builds: @@ -40,23 +40,26 @@ Upstream-Status: Inappropriate [OE specific] Signed-off-by: Alexander J Kube Signed-off-by: Jose Quaresma + +Rebase to 1.24.0 +Signed-off-by: Hongxu Jia --- src/cmd/dist/build.go | 76 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go -index 06ee4de..016b1dd 100644 +index b62e518030..0c54d82300 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go -@@ -46,6 +46,7 @@ var ( - goexperiment string +@@ -49,6 +49,7 @@ var ( + gofips140 string workdir string tooldir string + build_tooldir string oldgoos string oldgoarch string oldgocache string -@@ -58,6 +59,7 @@ var ( +@@ -61,6 +62,7 @@ var ( rebuildall bool noOpt bool isRelease bool @@ -64,7 +67,7 @@ index 06ee4de..016b1dd 100644 vflag int // verbosity ) -@@ -265,6 +267,8 @@ func xinit() { +@@ -286,6 +288,8 @@ func xinit() { goversion := findgoversion() isRelease = strings.HasPrefix(goversion, "release.") || strings.HasPrefix(goversion, "go") @@ -73,7 +76,7 @@ index 06ee4de..016b1dd 100644 } // compilerEnv returns a map from "goos/goarch" to the -@@ -499,8 +503,10 @@ func setup() { +@@ -547,8 +551,10 @@ func setup() { goosGoarch := pathf("%s/pkg/%s_%s", goroot, gohostos, gohostarch) if rebuildall { xremoveall(goosGoarch) @@ -84,7 +87,7 @@ index 06ee4de..016b1dd 100644 xatexit(func() { if files := xreaddir(goosGoarch); len(files) == 0 { xremove(goosGoarch) -@@ -1338,14 +1344,20 @@ func cmdbootstrap() { +@@ -1411,14 +1417,20 @@ func cmdbootstrap() { defer timelog("end", "dist bootstrap") var debug, distpack, force, noBanner, noClean bool @@ -106,7 +109,7 @@ index 06ee4de..016b1dd 100644 if noClean { xprintf("warning: --no-clean is deprecated and has no effect; use 'go install std cmd' instead\n") -@@ -1357,6 +1369,18 @@ func cmdbootstrap() { +@@ -1430,6 +1442,18 @@ func cmdbootstrap() { "Use the -force flag to build anyway.\n", goos, goarch) } @@ -125,7 +128,7 @@ index 06ee4de..016b1dd 100644 // Set GOPATH to an internal directory. We shouldn't actually // need to store files here, since the toolchain won't // depend on modules outside of vendor directories, but if -@@ -1434,9 +1458,14 @@ func cmdbootstrap() { +@@ -1513,9 +1537,14 @@ func cmdbootstrap() { xprintf("\n") } @@ -140,7 +143,7 @@ index 06ee4de..016b1dd 100644 goBootstrap := pathf("%s/go_bootstrap", tooldir) if debug { run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full") -@@ -1464,7 +1493,11 @@ func cmdbootstrap() { +@@ -1543,7 +1572,11 @@ func cmdbootstrap() { xprintf("\n") } xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n") @@ -152,7 +155,7 @@ index 06ee4de..016b1dd 100644 // Now that cmd/go is in charge of the build process, enable GOEXPERIMENT. os.Setenv("GOEXPERIMENT", goexperiment) // No need to enable PGO for toolchain2. -@@ -1517,6 +1550,7 @@ func cmdbootstrap() { +@@ -1596,6 +1629,7 @@ func cmdbootstrap() { os.Setenv("GOCACHE", oldgocache) } @@ -160,7 +163,7 @@ index 06ee4de..016b1dd 100644 if goos == oldgoos && goarch == oldgoarch { // Common case - not setting up for cross-compilation. timelog("build", "toolchain") -@@ -1560,6 +1594,42 @@ func cmdbootstrap() { +@@ -1639,6 +1673,42 @@ func cmdbootstrap() { checkNotStale(toolenv(), goBootstrap, toolchain...) copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec) } @@ -203,7 +206,7 @@ index 06ee4de..016b1dd 100644 // Check that there are no new files in $GOROOT/bin other than // go and gofmt and $GOOS_$GOARCH (target bin when cross-compiling). -@@ -1582,8 +1652,12 @@ func cmdbootstrap() { +@@ -1661,8 +1731,12 @@ func cmdbootstrap() { } } @@ -216,3 +219,6 @@ index 06ee4de..016b1dd 100644 if goos == "android" { // Make sure the exec wrapper will sync a fresh $GOROOT to the device. +-- +2.25.1 + diff --git a/meta/recipes-devtools/go/go/0006-cmd-go-make-GOROOT-precious-by-default.patch b/meta/recipes-devtools/go/go/0006-cmd-go-make-GOROOT-precious-by-default.patch index 4a57b07b7a..b29da334ec 100644 --- a/meta/recipes-devtools/go/go/0006-cmd-go-make-GOROOT-precious-by-default.patch +++ b/meta/recipes-devtools/go/go/0006-cmd-go-make-GOROOT-precious-by-default.patch @@ -1,7 +1,7 @@ -From a31db6f78d851741aea1e76132a84a24138a5bc6 Mon Sep 17 00:00:00 2001 +From ba3caa9f969bac2b937f8f1ffed4a3679cd16ec7 Mon Sep 17 00:00:00 2001 From: Alex Kube Date: Wed, 23 Oct 2019 21:18:56 +0430 -Subject: [PATCH] cmd/go: make GOROOT precious by default +Subject: [PATCH 06/11] cmd/go: make GOROOT precious by default The go build tool normally rebuilds whatever it detects is stale. This can be a problem when GOROOT is intended to @@ -29,10 +29,10 @@ Signed-off-by: Jose Quaresma 3 files changed, 34 insertions(+) diff --git a/src/cmd/go/internal/work/action.go b/src/cmd/go/internal/work/action.go -index a59072e..9e35ebd 100644 +index 44bb9f8c1e..87ac4e30e5 100644 --- a/src/cmd/go/internal/work/action.go +++ b/src/cmd/go/internal/work/action.go -@@ -754,6 +754,9 @@ func (b *Builder) addTransitiveLinkDeps(a, a1 *Action, shlib string) { +@@ -837,6 +837,9 @@ func (b *Builder) addTransitiveLinkDeps(a, a1 *Action, shlib string) { if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] { continue } @@ -43,10 +43,10 @@ index a59072e..9e35ebd 100644 // TODO(rsc): The use of ModeInstall here is suspect, but if we only do ModeBuild, // we'll end up building an overall library or executable that depends at runtime diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go -index 408edb5..3d60252 100644 +index 3508d51fbb..77f5e7241a 100644 --- a/src/cmd/go/internal/work/build.go +++ b/src/cmd/go/internal/work/build.go -@@ -233,6 +233,8 @@ See also: go install, go get, go clean. +@@ -238,6 +238,8 @@ See also: go install, go get, go clean. const concurrentGCBackendCompilationEnabledByDefault = true @@ -55,7 +55,7 @@ index 408edb5..3d60252 100644 func init() { // break init cycle CmdBuild.Run = runBuild -@@ -246,6 +248,10 @@ func init() { +@@ -251,6 +253,10 @@ func init() { AddCoverFlags(CmdBuild, nil) AddCoverFlags(CmdInstall, nil) } @@ -67,10 +67,10 @@ index 408edb5..3d60252 100644 // Note that flags consulted by other parts of the code diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go -index 9724cd0..544df46 100644 +index 1f618be0bb..651fa64582 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go -@@ -544,6 +544,23 @@ func (b *Builder) build(ctx context.Context, a *Action) (err error) { +@@ -552,6 +552,23 @@ func (b *Builder) build(ctx context.Context, a *Action) (err error) { return err } @@ -94,7 +94,7 @@ index 9724cd0..544df46 100644 if err := sh.Mkdir(a.Objdir); err != nil { return err } -@@ -1737,6 +1754,14 @@ func (b *Builder) linkShared(ctx context.Context, a *Action) (err error) { +@@ -1747,6 +1764,14 @@ func (b *Builder) linkShared(ctx context.Context, a *Action) (err error) { return err } @@ -109,3 +109,6 @@ index 9724cd0..544df46 100644 if err := b.Shell(a).Mkdir(a.Objdir); err != nil { return err } +-- +2.25.1 + diff --git a/meta/recipes-devtools/go/go/0007-exec.go-filter-out-build-specific-paths-from-linker-.patch b/meta/recipes-devtools/go/go/0007-exec.go-filter-out-build-specific-paths-from-linker-.patch index 2fdd52974f..9a701c7a6b 100644 --- a/meta/recipes-devtools/go/go/0007-exec.go-filter-out-build-specific-paths-from-linker-.patch +++ b/meta/recipes-devtools/go/go/0007-exec.go-filter-out-build-specific-paths-from-linker-.patch @@ -1,7 +1,8 @@ -From 1097a07b097043e15fe29a85326dbd196401244a Mon Sep 17 00:00:00 2001 +From 2197f813c9cff65eedef44473872ec5ea9ced227 Mon Sep 17 00:00:00 2001 From: Changqing Li Date: Tue, 27 Feb 2024 18:06:51 +0800 -Subject: [PATCH] exec.go: filter out build-specific paths from linker flags +Subject: [PATCH 07/11] exec.go: filter out build-specific paths from linker + flags The flags can contain build-specific paths, breaking reproducibility. Filter out options that have build-specific paths. @@ -15,10 +16,10 @@ Signed-off-by: Jose Quaresma 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go -index 544df46..c8f297c 100644 +index 651fa64582..586079afb4 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go -@@ -1401,6 +1401,29 @@ func (b *Builder) linkActionID(a *Action) cache.ActionID { +@@ -1426,6 +1426,29 @@ func (b *Builder) linkActionID(a *Action) cache.ActionID { return h.Sum() } @@ -48,7 +49,7 @@ index 544df46..c8f297c 100644 // printLinkerConfig prints the linker config into the hash h, // as part of the computation of a linker-related action ID. func (b *Builder) printLinkerConfig(h io.Writer, p *load.Package) { -@@ -1411,7 +1434,7 @@ func (b *Builder) printLinkerConfig(h io.Writer, p *load.Package) { +@@ -1436,7 +1459,7 @@ func (b *Builder) printLinkerConfig(h io.Writer, p *load.Package) { case "gc": fmt.Fprintf(h, "link %s %q %s\n", b.toolID("link"), forcedLdflags, ldBuildmode) if p != nil { @@ -57,3 +58,6 @@ index 544df46..c8f297c 100644 } // GOARM, GOMIPS, etc. +-- +2.25.1 + diff --git a/meta/recipes-devtools/go/go/0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch b/meta/recipes-devtools/go/go/0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch index 4c1f0ca145..a9cb2a4b84 100644 --- a/meta/recipes-devtools/go/go/0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch +++ b/meta/recipes-devtools/go/go/0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch @@ -1,8 +1,8 @@ -From e5af6155f2d6e0758d11d6c12d6f47ea8e65b141 Mon Sep 17 00:00:00 2001 +From e5752b239707df8ad7a72dc60420e01c5912d606 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Tue, 10 Nov 2020 16:33:27 +0000 -Subject: [PATCH] src/cmd/dist/buildgo.go: do not hardcode host compilers into - target binaries +Subject: [PATCH 08/11] src/cmd/dist/buildgo.go: do not hardcode host compilers + into target binaries These come from $CC/$CXX on the build host and are not useful on targets; additionally as they contain host specific paths, this helps reproducibility. @@ -16,7 +16,7 @@ Signed-off-by: Jose Quaresma 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cmd/dist/buildgo.go b/src/cmd/dist/buildgo.go -index 884e9d7..2f52eda 100644 +index 884e9d729a..2f52edacfe 100644 --- a/src/cmd/dist/buildgo.go +++ b/src/cmd/dist/buildgo.go @@ -51,8 +51,8 @@ func mkzdefaultcc(dir, file string) { @@ -41,3 +41,6 @@ index 884e9d7..2f52eda 100644 writefile(buf.String(), file, writeSkipSame) } +-- +2.25.1 + diff --git a/meta/recipes-devtools/go/go/0009-go-Filter-build-paths-on-staticly-linked-arches.patch b/meta/recipes-devtools/go/go/0009-go-Filter-build-paths-on-staticly-linked-arches.patch index d939cb4716..d47c4b1d31 100644 --- a/meta/recipes-devtools/go/go/0009-go-Filter-build-paths-on-staticly-linked-arches.patch +++ b/meta/recipes-devtools/go/go/0009-go-Filter-build-paths-on-staticly-linked-arches.patch @@ -1,7 +1,7 @@ -From 6bdd6405ce63c7aa4b35cd85833d03c7f1b9109a Mon Sep 17 00:00:00 2001 +From 79a1c80ed43f2a541bcab665656a4e2bb87baab3 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sat, 2 Jul 2022 23:08:13 +0100 -Subject: [PATCH] go: Filter build paths on staticly linked arches +Subject: [PATCH 09/11] go: Filter build paths on staticly linked arches Filter out build time paths from ldflags and other flags variables when they're embedded in the go binary so that builds are reproducible regardless of build @@ -17,10 +17,10 @@ Signed-off-by: Jose Quaresma 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go -index 1549800..f41fb2c 100644 +index 15f6b2e87b..47c5b865a1 100644 --- a/src/cmd/go/internal/load/pkg.go +++ b/src/cmd/go/internal/load/pkg.go -@@ -2277,6 +2277,17 @@ func appendBuildSetting(info *debug.BuildInfo, key, value string) { +@@ -2291,6 +2291,17 @@ func appendBuildSetting(info *debug.BuildInfo, key, value string) { info.Settings = append(info.Settings, debug.BuildSetting{Key: key, Value: value}) } @@ -38,7 +38,7 @@ index 1549800..f41fb2c 100644 // setBuildInfo gathers build information and sets it into // p.Internal.BuildInfo, which will later be formatted as a string and embedded // in the binary. setBuildInfo should only be called on a main package with no -@@ -2384,7 +2395,7 @@ func (p *Package) setBuildInfo(ctx context.Context, autoVCS bool) { +@@ -2398,7 +2409,7 @@ func (p *Package) setBuildInfo(ctx context.Context, autoVCS bool) { if gcflags := BuildGcflags.String(); gcflags != "" && cfg.BuildContext.Compiler == "gc" { appendSetting("-gcflags", gcflags) } @@ -47,7 +47,7 @@ index 1549800..f41fb2c 100644 // https://go.dev/issue/52372: only include ldflags if -trimpath is not set, // since it can include system paths through various linker flags (notably // -extar, -extld, and -extldflags). -@@ -2427,7 +2438,7 @@ func (p *Package) setBuildInfo(ctx context.Context, autoVCS bool) { +@@ -2444,7 +2455,7 @@ func (p *Package) setBuildInfo(ctx context.Context, autoVCS bool) { // subset of flags that are known not to be paths? if cfg.BuildContext.CgoEnabled && !cfg.BuildTrimpath { for _, name := range []string{"CGO_CFLAGS", "CGO_CPPFLAGS", "CGO_CXXFLAGS", "CGO_LDFLAGS"} { @@ -56,3 +56,6 @@ index 1549800..f41fb2c 100644 } } appendSetting("GOARCH", cfg.BuildContext.GOARCH) +-- +2.25.1 + diff --git a/meta/recipes-devtools/go/go/6d265b008e3d106b2706645e5a88cd8e2fb98953.patch b/meta/recipes-devtools/go/go/6d265b008e3d106b2706645e5a88cd8e2fb98953.patch index d858cc6408..58bd00fc73 100644 --- a/meta/recipes-devtools/go/go/6d265b008e3d106b2706645e5a88cd8e2fb98953.patch +++ b/meta/recipes-devtools/go/go/6d265b008e3d106b2706645e5a88cd8e2fb98953.patch @@ -14,12 +14,14 @@ Change-Id: I9f377e47c22ef20497479c0978c053ed5de46a38 Upstream-Status: Submitted [https://go-review.googlesource.com/c/go/+/391115] --- + src/cmd/link/internal/ld/lib.go | 21 --------------------- + 1 file changed, 21 deletions(-) diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go -index 2d8f964..fcf0bc7 100644 +index dfc72e02c0..2a2a304113 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go -@@ -1670,27 +1670,6 @@ +@@ -1673,27 +1673,6 @@ func (ctxt *Link) hostlink() { // Use lld to avoid errors from default linker (issue #38838) altLinker = "lld" } @@ -47,3 +49,6 @@ index 2d8f964..fcf0bc7 100644 } if ctxt.Arch.Family == sys.ARM64 && buildcfg.GOOS == "freebsd" { // Switch to ld.bfd on freebsd/arm64. +-- +2.25.1 + diff --git a/meta/recipes-devtools/go/go_1.22.12.bb b/meta/recipes-devtools/go/go_1.24.0.bb similarity index 100% rename from meta/recipes-devtools/go/go_1.22.12.bb rename to meta/recipes-devtools/go/go_1.24.0.bb From patchwork Sat Mar 1 07:55:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxu Jia X-Patchwork-Id: 58114 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3843EC282D0 for ; Sat, 1 Mar 2025 07:56:06 +0000 (UTC) Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) by mx.groups.io with SMTP id smtpd.web11.5117.1740815762616818717 for ; Fri, 28 Feb 2025 23:56:02 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.178.238, mailfrom: prvs=5155a5e946=hongxu.jia@windriver.com) Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5217txsr020589; Sat, 1 Mar 2025 07:55:59 GMT Received: from ala-exchng02.corp.ad.wrs.com (ala-exchng02.wrs.com [147.11.82.254]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 453qf108w2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Sat, 01 Mar 2025 07:55:59 +0000 (GMT) Received: from ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Fri, 28 Feb 2025 23:55:58 -0800 Received: from pek-lpg-core5.wrs.com (147.11.136.210) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server id 15.1.2507.43 via Frontend Transport; Fri, 28 Feb 2025 23:55:56 -0800 From: Hongxu Jia To: , CC: , , Subject: [poky][PATCH 2/3] go: fix buildpath issue for go-runtime Date: Sat, 1 Mar 2025 15:55:51 +0800 Message-ID: <20250301075552.354661-3-hongxu.jia@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250301075552.354661-1-hongxu.jia@windriver.com> References: <20250301075552.354661-1-hongxu.jia@windriver.com> MIME-Version: 1.0 X-Proofpoint-GUID: x0nu9iIjLdVZM2dslLI_URWlEu8w0sql X-Authority-Analysis: v=2.4 cv=Yon1R5YX c=1 sm=1 tr=0 ts=67c2bd8f cx=c_pps a=K4BcnWQioVPsTJd46EJO2w==:117 a=K4BcnWQioVPsTJd46EJO2w==:17 a=Vs1iUdzkB0EA:10 a=NEAV23lmAAAA:8 a=Oh2cFVv5AAAA:8 a=t7CeM3EgAAAA:8 a=C9ArJovFf5j5W3SOmiYA:9 a=7KeoIwV6GZqOttXkcoxL:22 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-ORIG-GUID: x0nu9iIjLdVZM2dslLI_URWlEu8w0sql X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-01_02,2025-02-28_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 phishscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 impostorscore=0 suspectscore=0 bulkscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.21.0-2502100000 definitions=main-2503010060 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sat, 01 Mar 2025 07:56:06 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/212088 In upstream commit [cmd: remove support for GOROOT_FINAL][1], it clear GOROOT for func ld when -trimpath is used But it missed to do the same thing for share libarary linking which caused building go-runtime failed with buildpath issue |ERROR: go-runtime-1.23.4-r0 do_package_qa: QA Issue: File /usr/lib/go/pkg/ linux_amd64_dynlink/libstd.so in package go-runtime contains reference to TMPDIR [buildpaths] This commit applied a patch to clear GOROOT for func ldShared when -trimpath is used and add option -trimpath to go-runtime build [1] https://github.com/golang/go/commit/507d1b22f4b58ac68841582d0c2c0ab6b20e5a98 [2] https://github.com/golang/go/commit/507d1b22f4b58ac68841582d0c2c0ab6b20e5a98#diff-cab5921f94f2667bb0bc1b935d2d46b4c03541b4351b33438ab7290b94dea212R669 Signed-off-by: Hongxu Jia --- meta/recipes-devtools/go/go-1.24.0.inc | 1 + meta/recipes-devtools/go/go-runtime.inc | 2 +- ...OOT-for-func-ldShared-when-trimpath-.patch | 51 +++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/go/go/0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch diff --git a/meta/recipes-devtools/go/go-1.24.0.inc b/meta/recipes-devtools/go/go-1.24.0.inc index 26a4947caf..a52dd19e76 100644 --- a/meta/recipes-devtools/go/go-1.24.0.inc +++ b/meta/recipes-devtools/go/go-1.24.0.inc @@ -14,6 +14,7 @@ SRC_URI += "\ file://0007-exec.go-filter-out-build-specific-paths-from-linker-.patch \ file://0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \ file://0009-go-Filter-build-paths-on-staticly-linked-arches.patch \ + file://0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch \ file://6d265b008e3d106b2706645e5a88cd8e2fb98953.patch \ " SRC_URI[main.sha256sum] = "d14120614acb29d12bcab72bd689f257eb4be9e0b6f88a8fb7e41ac65f8556e5" diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-devtools/go/go-runtime.inc index 413cf6d33f..e5f17337bc 100644 --- a/meta/recipes-devtools/go/go-runtime.inc +++ b/meta/recipes-devtools/go/go-runtime.inc @@ -34,7 +34,7 @@ do_compile() { if [ -n "${GO_DYNLINK}" ]; then export GOTOOLDIR="${B}/pkg/tool/native_native" CC="$CC_FOR_${TARGET_GOTUPLE}" GOARCH="${TARGET_GOARCH}" GOOS="${TARGET_GOOS}" GOROOT=${B} \ - $GOTOOLDIR/go_bootstrap install -linkshared -buildmode=shared ${GO_SHLIB_LDFLAGS} std + $GOTOOLDIR/go_bootstrap install -linkshared -trimpath -buildmode=shared ${GO_SHLIB_LDFLAGS} std fi cd ${B} } diff --git a/meta/recipes-devtools/go/go/0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch b/meta/recipes-devtools/go/go/0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch new file mode 100644 index 0000000000..2c2f0cbfb5 --- /dev/null +++ b/meta/recipes-devtools/go/go/0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch @@ -0,0 +1,51 @@ +From c4215b5ca69a7626d97cf9b7ebc460c2b5b9148b Mon Sep 17 00:00:00 2001 +From: Hongxu Jia +Date: Fri, 28 Feb 2025 19:13:18 -0800 +Subject: [PATCH 10/11] cmd/go: clear GOROOT for func ldShared when -trimpath + is used + +In commit [cmd: remove support for GOROOT_FINAL][1], it clear GOROOT +for func ld when -trimpath is used. [2] + +This commit do the same thing for func ldShared, otherwise run go_bootstrap +with -trimpath does not remove build path directory from the generated share +libarary + + $ ./make.bash --target-only --no-banner std + $ go_bootstrap install -linkshared -buildmode=shared -trimpath std + $ grep "$(pwd)" ./pkg/linux_amd64_dynlink/libstd.so + Binary file ./pkg/linux_amd64_dynlink/libstd.so matches + +[1] https://github.com/golang/go/commit/507d1b22f4b58ac68841582d0c2c0ab6b20e5a98 +[2] https://github.com/golang/go/commit/507d1b22f4b58ac68841582d0c2c0ab6b20e5a98#diff-cab5921f94f2667bb0bc1b935d2d46b4c03541b4351b33438ab7290b94dea212R669 + +Upstream-Status: Submitted [https://go-review.googlesource.com/c/go/+/653895] + +Signed-off-by: Hongxu Jia +--- + src/cmd/go/internal/work/gc.go | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/src/cmd/go/internal/work/gc.go b/src/cmd/go/internal/work/gc.go +index 3a173efee8..8b7a44e031 100644 +--- a/src/cmd/go/internal/work/gc.go ++++ b/src/cmd/go/internal/work/gc.go +@@ -728,7 +728,14 @@ func (gcToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, + // the output file path is recorded in the .gnu.version_d section. + dir, targetPath := filepath.Split(targetPath) + +- return b.Shell(root).run(dir, targetPath, nil, cfg.BuildToolexec, base.Tool("link"), "-o", targetPath, "-importcfg", importcfg, ldflags) ++ env := []string{} ++ // When -trimpath is used, GOROOT is cleared ++ if cfg.BuildTrimpath { ++ env = append(env, "GOROOT=") ++ } else { ++ env = append(env, "GOROOT="+cfg.GOROOT) ++ } ++ return b.Shell(root).run(dir, targetPath, env, cfg.BuildToolexec, base.Tool("link"), "-o", targetPath, "-importcfg", importcfg, ldflags) + } + + func (gcToolchain) cc(b *Builder, a *Action, ofile, cfile string) error { +-- +2.25.1 + From patchwork Sat Mar 1 07:55:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxu Jia X-Patchwork-Id: 58116 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 160A6C021B8 for ; Sat, 1 Mar 2025 07:56:16 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web10.5211.1740815766133967141 for ; Fri, 28 Feb 2025 23:56:06 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=5155a5e946=hongxu.jia@windriver.com) Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5217nZSD015268; Fri, 28 Feb 2025 23:56:00 -0800 Received: from ala-exchng02.corp.ad.wrs.com (ala-exchng02.wrs.com [147.11.82.254]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 4533v09cy4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 28 Feb 2025 23:56:00 -0800 (PST) Received: from ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Fri, 28 Feb 2025 23:55:59 -0800 Received: from pek-lpg-core5.wrs.com (147.11.136.210) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server id 15.1.2507.43 via Frontend Transport; Fri, 28 Feb 2025 23:55:58 -0800 From: Hongxu Jia To: , CC: , , Subject: [poky][PATCH 3/3] go: remove support for GOROOT_FINAL Date: Sat, 1 Mar 2025 15:55:52 +0800 Message-ID: <20250301075552.354661-4-hongxu.jia@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250301075552.354661-1-hongxu.jia@windriver.com> References: <20250301075552.354661-1-hongxu.jia@windriver.com> MIME-Version: 1.0 X-Authority-Analysis: v=2.4 cv=HJQ5Fptv c=1 sm=1 tr=0 ts=67c2bd90 cx=c_pps a=K4BcnWQioVPsTJd46EJO2w==:117 a=K4BcnWQioVPsTJd46EJO2w==:17 a=T2h4t0Lz3GQA:10 a=NEAV23lmAAAA:8 a=t7CeM3EgAAAA:8 a=WBAJb5gv3E3ej6zVj10A:9 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-GUID: PPsuhZ668SuIq8Xte41eoCc0WIB0-UVE X-Proofpoint-ORIG-GUID: PPsuhZ668SuIq8Xte41eoCc0WIB0-UVE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-01_02,2025-02-28_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 mlxlogscore=999 suspectscore=0 adultscore=0 bulkscore=0 spamscore=0 mlxscore=0 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.21.0-2502100000 definitions=main-2503010060 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sat, 01 Mar 2025 07:56:16 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/212090 After upstream go applied commit [cmd: remove support for GOROOT_FINAL][1], GOROOT_FINAL variable is dropped and use option -trimpath to instead [2] The option -trimpath has already been added to GOBUILDFLAGS in go.bbclass [1] https://github.com/golang/go/commit/507d1b22f4b58ac68841582d0c2c0ab6b20e5a98 [2] https://github.com/golang/go/issues/62047 Signed-off-by: Hongxu Jia --- meta/classes-recipe/go.bbclass | 1 - meta/recipes-devtools/go/go-common.inc | 1 - 2 files changed, 2 deletions(-) diff --git a/meta/classes-recipe/go.bbclass b/meta/classes-recipe/go.bbclass index e3e4782025..c81d946069 100644 --- a/meta/classes-recipe/go.bbclass +++ b/meta/classes-recipe/go.bbclass @@ -15,7 +15,6 @@ GOROOT:class-native = "${STAGING_LIBDIR_NATIVE}/go" GOROOT:class-nativesdk = "${STAGING_DIR_TARGET}${libdir}/go" GOROOT = "${STAGING_LIBDIR}/go" export GOROOT -export GOROOT_FINAL = "${libdir}/go" export GOCACHE = "${B}/.cache" export GOARCH = "${TARGET_GOARCH}" diff --git a/meta/recipes-devtools/go/go-common.inc b/meta/recipes-devtools/go/go-common.inc index db165792dc..ca8469dbd9 100644 --- a/meta/recipes-devtools/go/go-common.inc +++ b/meta/recipes-devtools/go/go-common.inc @@ -38,7 +38,6 @@ export GOARCH ?= "${TARGET_GOARCH}" export GOARM ?= "${TARGET_GOARM}" export GO386 ?= "${TARGET_GO386}" export GOMIPS ?= "${TARGET_GOMIPS}" -export GOROOT_FINAL ?= "${libdir}/go" export GODEBUG = "gocachehash=1"