From patchwork Mon Sep 14 19:12:30 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Marko X-Patchwork-Id: 98216 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 1BB68C88E72 for ; Mon, 14 Sep 2026 19:13:13 +0000 (UTC) Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net [185.136.64.226]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.5578.1789413183822141740 for ; Mon, 14 Sep 2026 12:13:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm1 header.b=C9+AX0hS; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.226, mailfrom: fm-256628-202609141913000523f900870002075e-ulw8vj@rts-flowmailer.siemens.com) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 202609141913000523f900870002075e for ; Mon, 14 Sep 2026 21:13:01 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc; bh=cyMHwxq7rLTS4XdLDtzyuy8tsqMWT7ceyeIVnEir2WU=; b=C9+AX0hSBy/DjdN/PsBO/ujgLZvsIfFeZrW2zfRb1l072A1JLvoed0wR1/z2o+PjGJtL8f qljYhooPR5Pdm2P2nZiOaiycwwWLd8oic9LetdLjmoX0ENohF3aU46XYBi3jHz6rFn+zXk2C I8hEY3fJ0uQNmoRzQvl8DvNo0l6EtoJagMp4rmWa75Cr51qJCZpGHKDlQVR29UNL5EdqSdaX krLRGTpxZtK0yT2ADfotxVSWctfRpjpvBRuGifI1uLAJjTUn0ypm34VOshpGfQdy6tRxWfLx lv+0uald74imt6hE5FzF4OYfPkO1mW3buJLHqtYJufqXea/OgRXarjNg==; From: Peter Marko To: yocto-patches@lists.yoctoproject.org Cc: peter.marko@siemens.com, jose.quaresma@foundries.io Subject: [meta-lts-mixins][wrynose/go][PATCH 01/11] Initial commit: add license, readme, gitignore and layer config Date: Mon, 14 Sep 2026 21:12:30 +0200 Message-ID: <20260914191240.1066469-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 14 Sep 2026 19:13:13 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/4828 From: Peter Marko This is a copy of these files from scarthgap/go branch modified for wrynose release: * switch scarthgap to wrynose * drop extra configurations fro layer.conf Signed-off-by: Peter Marko --- .gitignore | 1 + COPYING.MIT | 17 ++++++++++ README.md | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ conf/layer.conf | 15 +++++++++ 4 files changed, 119 insertions(+) create mode 100644 .gitignore create mode 100644 COPYING.MIT create mode 100644 README.md create mode 100644 conf/layer.conf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0d20b64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/COPYING.MIT b/COPYING.MIT new file mode 100644 index 0000000..fb950dc --- /dev/null +++ b/COPYING.MIT @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..7330b8c --- /dev/null +++ b/README.md @@ -0,0 +1,86 @@ +meta-mixins-lts - wrynose/go +============================ + +"Mixin" layer for adding latest Go toolchain versions into the Yocto Project LTS. + +At the time Wrynose was released in April 2026, Go 1.26 was the latest version +and officially Wrynose supports only that. This thin special-purpose mixin +layer is meant to address this issue by backporting Go recipes from the master +branch of openembedded-core. + +Dependencies +------------ + +This layer depends on: + +- URI: git://github.com/openembedded/openembedded-core.git + layers: meta + branch: wrynose + +Contributing +------------ + +The patches can be backported from openembedded-core with: + + git -C ../openembedded-core format-patch --stdout -1 origin/master meta/recipes-devtools/go | \ + git am --signoff -p4 --directory=recipes-devtools/go + +The yocto-patches mailinglist (yocto-patches@lists.yoctoproject.org) is used +for questions, comments and patch review. It is subscriber only, so please +register before posting. + +Send pull requests to yocto-patches@lists.yoctoproject.org with +'[meta-lts-mixins][wrynose/go]' in the subject. + +When sending single patches, please use something like: +git send-email -M -1 --to=yocto-patches@lists.yoctoproject.org --subject-prefix='meta-lts-mixins][wrynose/go][PATCH' + +Maintenance +----------- + +Layer maintainers: +* Jose Quaresma +* Peter Marko + +Quality Assurance +----------------- + +QA tests are using original openembedded-core testsuites. +Current plan is to backport QA test changes to openembedded-core wrynose branch. +When that is no longer possible, changes will picked here. + +Automated tests to verify go toolchain functionality are being executed with following configurations and commands: + +* OEQA runtime + + ``` + IMAGE_INSTALL:append = " cgo-helloworld go-helloworld packagegroup-go-sdk-target" + IMAGE_CLASSES += "testimage" + TEST_SUITES:append = " go go_mixin" + ``` + + ``` + bitbake core-image-ptest-go && bitbake core-image-ptest-go:do_testimage + ``` + +* OEQA SDK + + ``` + IMAGE_CLASSES += "testimage" + SDK_TOOLCHAIN_LANGS = "go" + TESTSDK_SUITES = "go" + ``` + + ``` + bitbake core-image-minimal:do_populate_sdk && bitbake core-image-minimal:do_testsdk + ``` + +* OEQA selftest + + ``` + SANITY_TESTED_DISTROS = "" + ``` + + ``` + oe-selftest -r gotoolchain -j $(grep -c ^processor /proc/cpuinfo) + ``` diff --git a/conf/layer.conf b/conf/layer.conf new file mode 100644 index 0000000..9215c91 --- /dev/null +++ b/conf/layer.conf @@ -0,0 +1,15 @@ +# We have a conf and classes directory, append to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have a recipes directory, add to BBFILES +BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend" + +BBFILE_COLLECTIONS += "lts-go-mixin" +BBFILE_PATTERN_lts-go-mixin := "^${LAYERDIR}/" +BBFILE_PRIORITY_lts-go-mixin = "6" + +LAYERSERIES_COMPAT_lts-go-mixin = "wrynose" + +LAYERDEPENDS_lts-go-mixin = " \ + core \ +" From patchwork Mon Sep 14 19:12:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Marko X-Patchwork-Id: 98217 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 2379AC88E6F for ; Mon, 14 Sep 2026 19:13:23 +0000 (UTC) Received: from mta-65-228.siemens.flowmailer.net (mta-65-228.siemens.flowmailer.net [185.136.65.228]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.5587.1789413201073225199 for ; Mon, 14 Sep 2026 12:13:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm1 header.b=M+FV7ZRi; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.228, mailfrom: fm-256628-202609141913194e4ec1c6c8000207aa-fttvsg@rts-flowmailer.siemens.com) Received: by mta-65-228.siemens.flowmailer.net with ESMTPSA id 202609141913194e4ec1c6c8000207aa for ; Mon, 14 Sep 2026 21:13:19 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=yMj+38evx9Yy5woo8kryov/21PgVQKNM4jd0RUM/O4k=; b=M+FV7ZRifsldfEyQu7o1W7LVHL3JDMke7N2MfOIz/vtBWo+cyid/8MfRiO/Y7AbsvKAO7C gdajUXf7JFrXb3/itsdYqSkN0P3wHXMtNjAieMSFOtd4c8+Jn+UEQ+QJws0QG2GSDSBEcDvY FH/BD1EpHTPjjBZjYgeEVSaMjrhfFai9nVT9D93b4arzk81WXjFUUdgdNQ8rabAzOLLcADqy YIiXhkwURRZwoM86bZsWTX3UcOxXv49LEbfxzT/ZEQn+bgocdYz/TRJrRZvn9V9hQFrp6Deu FVnrLOgrFz2bWAYhX0GbC5w5h47EXyFSvDhgaNjBACXbMBLAUCVtluPw==; From: Peter Marko To: yocto-patches@lists.yoctoproject.org Cc: peter.marko@siemens.com, jose.quaresma@foundries.io Subject: [meta-lts-mixins][wrynose/go][PATCH 02/11] readme: update testing instructions Date: Mon, 14 Sep 2026 21:12:31 +0200 Message-ID: <20260914191240.1066469-2-peter.marko@siemens.com> In-Reply-To: <20260914191240.1066469-1-peter.marko@siemens.com> References: <20260914191240.1066469-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 14 Sep 2026 19:13:23 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/4829 From: Peter Marko Add fragment for root login without password needed for ptest. "Unsafe" settings were removed from default distro configs in Wrynose. Signed-off-by: Peter Marko --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7330b8c..6968860 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ Automated tests to verify go toolchain functionality are being executed with fol IMAGE_INSTALL:append = " cgo-helloworld go-helloworld packagegroup-go-sdk-target" IMAGE_CLASSES += "testimage" TEST_SUITES:append = " go go_mixin" + OE_FRAGMENTS += "core/yocto/root-login-with-empty-password" ``` ``` From patchwork Mon Sep 14 19:12:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Marko X-Patchwork-Id: 98218 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 0275AC88E72 for ; Mon, 14 Sep 2026 19:13:33 +0000 (UTC) Received: from mta-65-226.siemens.flowmailer.net (mta-65-226.siemens.flowmailer.net [185.136.65.226]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.5849.1789413208393070429 for ; Mon, 14 Sep 2026 12:13:29 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm1 header.b=dBTl7AEV; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.226, mailfrom: fm-256628-20260914191326baeca44130000207dd-yql8kd@rts-flowmailer.siemens.com) Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 20260914191326baeca44130000207dd for ; Mon, 14 Sep 2026 21:13:26 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=MxtQlsvAEiTbkSvvCzSkjXdsDtS49yw9w4RXkmP/XTg=; b=dBTl7AEVJK8abpfBh+Ny8mazbUZFkZKT9ubMZxNI59bkF3AP5WM0WGxttYUJmJCopl/XWw roHwhO+GY6NefmcrHzOvC7AN/5gfLWnUMhkBzdirgTHwOK8SGNIgR4rIknhXwypYgRw7e3Ey eCSnlU8fPjy5z+xGoSPGcd2cU0pU71pE9YEHaLXGRIY2ROJX0viEYGEUj6w/Tb55ag1dY7b7 RnqdOqoyshnEN5Eio5kYGTLfD518DK0MR/C2L06Cvs8lHrgN8hn9yGIE/Uhz6Pt7qIQ37p5I haOqva4SoiDXWpgT5tfSxMN2uYnzxJZNgvezjjgTIpkfeAcIwYEKiAHQ==; From: Peter Marko To: yocto-patches@lists.yoctoproject.org Cc: peter.marko@siemens.com, jose.quaresma@foundries.io Subject: [meta-lts-mixins][wrynose/go][PATCH 03/11] go: add from openembedded-core wrynose Date: Mon, 14 Sep 2026 21:12:32 +0200 Message-ID: <20260914191240.1066469-3-peter.marko@siemens.com> In-Reply-To: <20260914191240.1066469-1-peter.marko@siemens.com> References: <20260914191240.1066469-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 14 Sep 2026 19:13:33 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/4830 From: Peter Marko Taken from oe-core f5d807c50beaac084c14e42e1f9cc8041b757862 which is between yocto-6.0.3 and yocto-6.0.4. Version 1.26.7 is the last version from master before upgrading to 1.27.0. The only difference in master and wrynose recipes is ptest support which will be added in later backport commit. Signed-off-by: Peter Marko --- recipes-devtools/go/go-1.26.7.inc | 19 ++ .../go/go-binary-native_1.26.7.bb | 52 ++++ recipes-devtools/go/go-common.inc | 48 ++++ recipes-devtools/go/go-cross-canadian.inc | 62 +++++ .../go/go-cross-canadian_1.26.7.bb | 2 + recipes-devtools/go/go-cross.inc | 54 +++++ recipes-devtools/go/go-cross_1.26.7.bb | 2 + recipes-devtools/go/go-crosssdk.inc | 44 ++++ recipes-devtools/go/go-crosssdk_1.26.7.bb | 2 + recipes-devtools/go/go-runtime.inc | 94 ++++++++ recipes-devtools/go/go-runtime_1.26.7.bb | 3 + recipes-devtools/go/go-target.inc | 53 +++++ ...ent-based-hash-generation-less-pedan.patch | 173 ++++++++++++++ ...OOLDIR-to-be-overridden-in-the-envir.patch | 56 +++++ ...3-ld-add-soname-to-shareable-objects.patch | 51 ++++ ...de-CC-when-building-dist-and-go_boot.patch | 48 ++++ ...dist-separate-host-and-target-builds.patch | 224 ++++++++++++++++++ ...d-go-make-GOROOT-precious-by-default.patch | 114 +++++++++ ...ut-build-specific-paths-from-linker-.patch | 63 +++++ ...ldgo.go-do-not-hardcode-host-compile.patch | 46 ++++ ...uild-paths-on-staticly-linked-arches.patch | 61 +++++ ...OOT-for-func-ldShared-when-trimpath-.patch | 48 ++++ recipes-devtools/go/go_1.26.7.bb | 18 ++ 23 files changed, 1337 insertions(+) create mode 100644 recipes-devtools/go/go-1.26.7.inc create mode 100644 recipes-devtools/go/go-binary-native_1.26.7.bb create mode 100644 recipes-devtools/go/go-common.inc create mode 100644 recipes-devtools/go/go-cross-canadian.inc create mode 100644 recipes-devtools/go/go-cross-canadian_1.26.7.bb create mode 100644 recipes-devtools/go/go-cross.inc create mode 100644 recipes-devtools/go/go-cross_1.26.7.bb create mode 100644 recipes-devtools/go/go-crosssdk.inc create mode 100644 recipes-devtools/go/go-crosssdk_1.26.7.bb create mode 100644 recipes-devtools/go/go-runtime.inc create mode 100644 recipes-devtools/go/go-runtime_1.26.7.bb create mode 100644 recipes-devtools/go/go-target.inc create mode 100644 recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch create mode 100644 recipes-devtools/go/go/0002-cmd-go-Allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch create mode 100644 recipes-devtools/go/go/0003-ld-add-soname-to-shareable-objects.patch create mode 100644 recipes-devtools/go/go/0004-make.bash-override-CC-when-building-dist-and-go_boot.patch create mode 100644 recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch create mode 100644 recipes-devtools/go/go/0006-cmd-go-make-GOROOT-precious-by-default.patch create mode 100644 recipes-devtools/go/go/0007-exec.go-filter-out-build-specific-paths-from-linker-.patch create mode 100644 recipes-devtools/go/go/0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch create mode 100644 recipes-devtools/go/go/0009-go-Filter-build-paths-on-staticly-linked-arches.patch create mode 100644 recipes-devtools/go/go/0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch create mode 100644 recipes-devtools/go/go_1.26.7.bb diff --git a/recipes-devtools/go/go-1.26.7.inc b/recipes-devtools/go/go-1.26.7.inc new file mode 100644 index 0000000..fed8701 --- /dev/null +++ b/recipes-devtools/go/go-1.26.7.inc @@ -0,0 +1,19 @@ +require go-common.inc + +FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/go:" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=7998cb338f82d15c0eff93b7004d272a" + +SRC_URI += "\ + file://0001-cmd-go-make-content-based-hash-generation-less-pedan.patch \ + file://0002-cmd-go-Allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch \ + file://0003-ld-add-soname-to-shareable-objects.patch \ + file://0004-make.bash-override-CC-when-building-dist-and-go_boot.patch \ + file://0005-cmd-dist-separate-host-and-target-builds.patch \ + file://0006-cmd-go-make-GOROOT-precious-by-default.patch \ + 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 \ +" +SRC_URI[main.sha256sum] = "0ed24eac755105085b89fe9cabc2742b91a0ad7b94b59d3ad364918ebc8956ad" diff --git a/recipes-devtools/go/go-binary-native_1.26.7.bb b/recipes-devtools/go/go-binary-native_1.26.7.bb new file mode 100644 index 0000000..753f1b1 --- /dev/null +++ b/recipes-devtools/go/go-binary-native_1.26.7.bb @@ -0,0 +1,52 @@ +# This recipe is for bootstrapping our go-cross from a prebuilt binary of Go from golang.org. + +SUMMARY = "Go programming language compiler (upstream binary for bootstrap)" +HOMEPAGE = " http://golang.org/" +LICENSE = "BSD-3-Clause" +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] = "ffb5f8de10c62550dfddab66b36b57030721e0a44a3218e9e1181d7b59f121ca" +SRC_URI[go_linux_arm64.sha256sum] = "5a4ec883379d51ee9ce1040d5e87f8d35e20387574dd8c947feb01eabc3c1b37" +SRC_URI[go_linux_ppc64le.sha256sum] = "22d3b362d557175fd16b79651cab0cad64f8aaaedca745f66d16f44d56bc5de1" + +UPSTREAM_CHECK_URI = "https://golang.org/dl/" +UPSTREAM_CHECK_REGEX = "go(?P\d+(\.\d+)+)\.linux" + +CVE_PRODUCT = "golang:go" +CVE_STATUS[CVE-2024-3566] = "not-applicable-platform: Issue only applies on Windows" +CVE_STATUS[CVE-2024-24786] = "cpe-incorrect: this CVE is for golang-google-protobuf" + +S = "${UNPACKDIR}/go" + +inherit goarch native + +do_compile() { + : +} + +make_wrapper() { + rm -f ${D}${bindir}/$1 + cat <${D}${bindir}/$1 +#!/bin/bash +here=\`dirname \$0\` +export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" +\$here/../lib/go/bin/$1 "\$@" +END + chmod +x ${D}${bindir}/$1 +} + +do_install() { + find ${S} -depth -type d -name testdata -exec rm -rf {} + + + install -d ${D}${bindir} ${D}${libdir}/go + cp --preserve=mode,timestamps -R ${S}/ ${D}${libdir}/ + + for f in ${S}/bin/* + do + make_wrapper `basename $f` + done +} diff --git a/recipes-devtools/go/go-common.inc b/recipes-devtools/go/go-common.inc new file mode 100644 index 0000000..5d0177b --- /dev/null +++ b/recipes-devtools/go/go-common.inc @@ -0,0 +1,48 @@ +SUMMARY = "Go programming language compiler" +DESCRIPTION = " The Go programming language is an open source project to make \ + programmers more productive. Go is expressive, concise, clean, and\ + efficient. Its concurrency mechanisms make it easy to write programs\ + that get the most out of multicore and networked machines, while its\ + novel type system enables flexible and modular program construction.\ + Go compiles quickly to machine code yet has the convenience of\ + garbage collection and the power of run-time reflection. It's a\ + fast, statically typed, compiled language that feels like a\ + dynamically typed, interpreted language." + +HOMEPAGE = " http://golang.org/" +LICENSE = "BSD-3-Clause" + +inherit goarch + +SRC_URI = "https://golang.org/dl/go${PV}.src.tar.gz;name=main" +S = "${UNPACKDIR}/go" +B = "${S}" +UPSTREAM_CHECK_REGEX = "(?P\d+(\.\d+)+)\.src\.tar" + +# all recipe variants are created from the same product +CVE_PRODUCT = "golang:go" +CVE_STATUS[CVE-2024-3566] = "not-applicable-platform: Issue only applies on Windows" +CVE_STATUS[CVE-2024-24786] = "cpe-incorrect: this CVE is for golang-google-protobuf" + +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +SSTATE_SCAN_CMD = "true" + +export GOROOT_OVERRIDE = "1" +export GOTMPDIR ?= "${WORKDIR}/build-tmp" +GOTMPDIR[vardepvalue] = "" +export CGO_ENABLED = "1" + +export GOHOSTOS ?= "${BUILD_GOOS}" +export GOHOSTARCH ?= "${BUILD_GOARCH}" +export GOROOT_BOOTSTRAP ?= "${STAGING_LIBDIR_NATIVE}/go" +export GOOS ?= "${TARGET_GOOS}" +export GOARCH ?= "${TARGET_GOARCH}" +export GOARM ?= "${TARGET_GOARM}" +export GO386 ?= "${TARGET_GO386}" +export GOMIPS ?= "${TARGET_GOMIPS}" + +export GODEBUG = "gocachehash=1" + +do_compile:prepend() { + BUILD_CC=${BUILD_CC} +} diff --git a/recipes-devtools/go/go-cross-canadian.inc b/recipes-devtools/go/go-cross-canadian.inc new file mode 100644 index 0000000..4a6f2f4 --- /dev/null +++ b/recipes-devtools/go/go-cross-canadian.inc @@ -0,0 +1,62 @@ +inherit cross-canadian + +DEPENDS = "go-native virtual/${HOST_PREFIX}go virtual/nativesdk-${HOST_PREFIX}go-runtime \ + virtual/nativesdk-cross-cc virtual/nativesdk-libc \ + virtual/nativesdk-compilerlibs" +PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}" + +GOARCH = "${HOST_GOARCH}" + +# it uses gcc on build machine during go-cross-canadian bootstrap, but +# the gcc version may be old and not support option '-fmacro-prefix-map' +# which is one of default values of DEBUG_PREFIX_MAP +DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=${TARGET_DBGSRC_DIR} \ + -fdebug-prefix-map=${STAGING_DIR_HOST}= \ + -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \ + " + +export GOTOOLDIR_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/${HOST_SYS}/go/pkg/tool/${BUILD_GOTUPLE}" +export CGO_CFLAGS = "${CFLAGS}" +export CGO_LDFLAGS = "${LDFLAGS}" +export GO_LDFLAGS = '-extld ${HOST_PREFIX}gcc -extldflags "--sysroot=${STAGING_DIR_HOST} ${SECURITY_NOPIE_CFLAGS} ${HOST_CC_ARCH} ${LDFLAGS}"' + +do_configure[noexec] = "1" + +do_compile() { + export CC_FOR_${HOST_GOTUPLE}="${HOST_PREFIX}gcc --sysroot=${STAGING_DIR_HOST} ${SECURITY_NOPIE_CFLAGS}" + export CXX_FOR_${HOST_GOTUPLE}="${HOST_PREFIX}gxx --sysroot=${STAGING_DIR_HOST} ${SECURITY_NOPIE_CFLAGS}" + cd src + ./make.bash --target-only --no-banner + cd ${B} +} +do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" + +make_wrapper() { + rm -f ${D}${bindir}/$2 + cat <${D}${bindir}/$2 +#!/bin/sh +here=\`dirname \$0\` +native_goroot=\`readlink -f \$here/../../lib/${TARGET_SYS}/go\` +export GOARCH="${TARGET_GOARCH}" +export GOOS="${TARGET_GOOS}" +test -n "\$GOARM" || export GOARM="${TARGET_GOARM}" +test -n "\$GO386" || export GO386="${TARGET_GO386}" +test -n "\$GOMIPS" || export GOMIPS="${TARGET_GOMIPS}" +export GOTOOLDIR="\$native_goroot/pkg/tool/${HOST_GOTUPLE}" +test -n "\$GOROOT" || export GOROOT="\$OECORE_TARGET_SYSROOT/${target_libdir}/go" +\$here/../../lib/${TARGET_SYS}/go/bin/$1 "\$@" +END + chmod +x ${D}${bindir}/$2 +} + +do_install() { + install -d ${D}${libdir}/go/pkg/tool + cp --preserve=mode,timestamps -R ${B}/pkg/tool/${HOST_GOTUPLE} ${D}${libdir}/go/pkg/tool/ + install -d ${D}${bindir} ${D}${libdir}/go/bin + for f in $(find ${B}/${GO_BUILD_BINDIR} -type f) + do + base=`basename $f` + install -m755 $f ${D}${libdir}/go/bin + make_wrapper $base ${TARGET_PREFIX}$base + done +} diff --git a/recipes-devtools/go/go-cross-canadian_1.26.7.bb b/recipes-devtools/go/go-cross-canadian_1.26.7.bb new file mode 100644 index 0000000..7ac9449 --- /dev/null +++ b/recipes-devtools/go/go-cross-canadian_1.26.7.bb @@ -0,0 +1,2 @@ +require go-cross-canadian.inc +require go-${PV}.inc diff --git a/recipes-devtools/go/go-cross.inc b/recipes-devtools/go/go-cross.inc new file mode 100644 index 0000000..ebee2e5 --- /dev/null +++ b/recipes-devtools/go/go-cross.inc @@ -0,0 +1,54 @@ +inherit cross + +PROVIDES = "virtual/${TUNE_PKGARCH}-go" +DEPENDS = "go-native" + +PN = "go-cross-${TUNE_PKGARCH}" + +CCACHE_DISABLE = "1" + +export GOCACHE = "${B}/.cache" +CC = "${@d.getVar('BUILD_CC').strip()}" + +do_configure[noexec] = "1" + +do_compile() { + export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" + export CXX_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" + cd src + ./make.bash --host-only --no-banner + cd ${B} +} +do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" + +make_wrapper() { + rm -f ${D}${bindir}/$2 + cat <${D}${bindir}/$2 +#!/bin/bash +here=\`dirname \$0\` +export GOARCH="${TARGET_GOARCH}" +export GOOS="${TARGET_GOOS}" +export GOARM="\${GOARM:-${TARGET_GOARM}}" +export GO386="\${GO386:-${TARGET_GO386}}" +export GOMIPS="\${GOMIPS:-${TARGET_GOMIPS}}" +\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@" +END + chmod +x ${D}${bindir}/$2 +} + +do_install() { + install -d ${D}${libdir}/go + cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ + install -d ${D}${libdir}/go/src + (cd ${S}/src; for d in *; do \ + [ ! -d $d ] || cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \ + done) + find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \; + install -d ${D}${bindir} ${D}${libdir}/go/bin + for f in ${B}/bin/* + do + base=`basename $f` + install -m755 $f ${D}${libdir}/go/bin + make_wrapper $base ${TARGET_PREFIX}$base + done +} diff --git a/recipes-devtools/go/go-cross_1.26.7.bb b/recipes-devtools/go/go-cross_1.26.7.bb new file mode 100644 index 0000000..80b5a03 --- /dev/null +++ b/recipes-devtools/go/go-cross_1.26.7.bb @@ -0,0 +1,2 @@ +require go-cross.inc +require go-${PV}.inc diff --git a/recipes-devtools/go/go-crosssdk.inc b/recipes-devtools/go/go-crosssdk.inc new file mode 100644 index 0000000..4f19025 --- /dev/null +++ b/recipes-devtools/go/go-crosssdk.inc @@ -0,0 +1,44 @@ +inherit crosssdk + +DEPENDS = "go-native virtual/nativesdk-cross-cc virtual/nativesdk-compilerlibs virtual/nativesdk-cross-binutils" +PN = "go-crosssdk-${SDK_SYS}" +PROVIDES = "virtual/${TARGET_PREFIX}go" + +export GOCACHE = "${B}/.cache" + +do_configure[noexec] = "1" + +do_compile() { + export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}" + export CXX_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}" + cd src + ./make.bash --host-only --no-banner + cd ${B} +} +do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" + +make_wrapper() { + rm -f ${D}${bindir}/$2 + cat <${D}${bindir}/$2 +#!/bin/bash +here=\`dirname \$0\` +export GOARCH="${TARGET_GOARCH}" +export GOOS="${TARGET_GOOS}" +\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@" +END + chmod +x ${D}${bindir}/$2 +} + +do_install() { + install -d ${D}${libdir}/go + install -d ${D}${libdir}/go/bin + install -d ${D}${libdir}/go/pkg/tool + install -d ${D}${bindir} + cp --preserve=mode,timestamps -R ${S}/pkg/tool/${BUILD_GOTUPLE} ${D}${libdir}/go/pkg/tool/ + for f in ${B}/bin/* + do + base=`basename $f` + install -m755 $f ${D}${libdir}/go/bin + make_wrapper $base ${TARGET_PREFIX}$base + done +} diff --git a/recipes-devtools/go/go-crosssdk_1.26.7.bb b/recipes-devtools/go/go-crosssdk_1.26.7.bb new file mode 100644 index 0000000..1857c8a --- /dev/null +++ b/recipes-devtools/go/go-crosssdk_1.26.7.bb @@ -0,0 +1,2 @@ +require go-crosssdk.inc +require go-${PV}.inc diff --git a/recipes-devtools/go/go-runtime.inc b/recipes-devtools/go/go-runtime.inc new file mode 100644 index 0000000..e5f1733 --- /dev/null +++ b/recipes-devtools/go/go-runtime.inc @@ -0,0 +1,94 @@ +DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native" +DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go" +PROVIDES = "virtual/${TARGET_PREFIX}go-runtime" + +DEBUG_PREFIX_MAP = "\ + -fdebug-prefix-map=${STAGING_DIR_HOST}= \ + -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \ +" + +export CGO_CFLAGS = "${CFLAGS}" +export CGO_CPPFLAGS = "${CPPFLAGS}" +export CGO_CXXFLAGS = "${CXXFLAGS}" +# Filter out -fdebug-prefix-map options as they clash with the GO's build system +export CGO_LDFLAGS = "${@ ' '.join(filter(lambda f: not f.startswith('-fdebug-prefix-map'), d.getVar('LDFLAGS').split())) }" +export GOCACHE = "${B}/.cache" + +GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}" +GO_SHLIB_LDFLAGS ?= '-ldflags="-extldflags '${GO_EXTLDFLAGS}'"' + +do_configure() { + : +} + +do_configure:libc-musl() { + rm -f ${S}/src/runtime/race/*.syso +} + +do_compile() { + export CC_FOR_${TARGET_GOTUPLE}="${CC}" + export CXX_FOR_${TARGET_GOTUPLE}="${CXX}" + + cd src + ./make.bash --target-only --no-banner std + 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 -trimpath -buildmode=shared ${GO_SHLIB_LDFLAGS} std + fi + cd ${B} +} +do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" + +do_install() { + install -d ${D}${libdir}/go/src + cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ + if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then + rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE} + rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE} + fi + rm -rf ${D}${libdir}/go/pkg/tool + rm -rf ${D}${libdir}/go/pkg/obj + rm -rf ${D}${libdir}/go/pkg/bootstrap + # the cmd directory is built for the native arch so if BUILD == TARGET + rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}/cmd + find src -mindepth 1 -maxdepth 1 -type d | while read srcdir; do + cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/ + done + find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \; + rm -f ${D}${libdir}/go/src/cmd/dist/dist + rm -f ${D}${libdir}/go/src/cmd/cgo/zdefaultcc.go + rm -f ${D}${libdir}/go/src/cmd/go/internal/cfg/zdefaultcc.go + +} + +ALLOW_EMPTY:${PN} = "1" +FILES:${PN} = "${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*${SOLIBSDEV}" +FILES:${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include \ + ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*.shlibname \ + ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*.shlibname \ + ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*.shlibname \ + ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*.shlibname \ + ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*.shlibname \ + ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.shlibname \ + ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.shlibname \ + ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*.a \ + ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*.a \ + ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*.a \ + ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*.a \ + ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*.a \ + ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.a \ + ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.a \ +" +FILES:${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE}" + +# Go sources include some scripts and pre-built binaries for +# multiple architectures. The static .a files for dynamically-linked +# runtime are also required in -dev. +INSANE_SKIP:${PN}-dev = "staticdev file-rdeps arch" + +INHIBIT_PACKAGE_STRIP = "1" +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_SYSROOT_STRIP = "1" + +BBCLASSEXTEND = "nativesdk" diff --git a/recipes-devtools/go/go-runtime_1.26.7.bb b/recipes-devtools/go/go-runtime_1.26.7.bb new file mode 100644 index 0000000..63464a1 --- /dev/null +++ b/recipes-devtools/go/go-runtime_1.26.7.bb @@ -0,0 +1,3 @@ +require go-${PV}.inc +require go-runtime.inc + diff --git a/recipes-devtools/go/go-target.inc b/recipes-devtools/go/go-target.inc new file mode 100644 index 0000000..981c7ab --- /dev/null +++ b/recipes-devtools/go/go-target.inc @@ -0,0 +1,53 @@ +DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native" +DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go go-native" + +DEBUG_PREFIX_MAP = "\ + -fdebug-prefix-map=${STAGING_DIR_HOST}= \ + -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \ +" + +export CGO_CFLAGS = "${CFLAGS}" +export CGO_CPPFLAGS = "${CPPFLAGS}" +export CGO_CXXFLAGS = "${CXXFLAGS}" +# Filter out -fdebug-prefix-map options as they clash with the GO's build system +export CGO_LDFLAGS = "${@ ' '.join(filter(lambda f: not f.startswith('-fdebug-prefix-map'), d.getVar('LDFLAGS').split())) }" + +export GOCACHE = "${B}/.cache" +export GO_LDFLAGS = "" +export GOBUILDFLAGS = "-gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH -trimpath" +CC:append:class-nativesdk = " ${SECURITY_NOPIE_CFLAGS}" + +do_configure[noexec] = "1" + +do_compile() { + export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}" + export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}" + + cd src + ./make.bash --target-only --no-banner + cd ${B} +} +do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" + +do_install() { + install -d ${D}${libdir}/go/pkg/tool + cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/ + install -d ${D}${libdir}/go/src + cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/ + find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \; + install -d ${D}${libdir}/go/bin + install -d ${D}${bindir} + for f in ${B}/${GO_BUILD_BINDIR}/*; do + name=`basename $f` + install -m 0755 $f ${D}${libdir}/go/bin/ + ln -sf ../${baselib}/go/bin/$name ${D}${bindir}/ + done + rm -rf ${D}${libdir}/go/src +} + +PACKAGES = "${PN} ${PN}-dev" +FILES:${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}" +RDEPENDS:${PN} = "go-runtime" +INSANE_SKIP:${PN} = "ldflags" + +BBCLASSEXTEND = "nativesdk" diff --git a/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch b/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch new file mode 100644 index 0000000..077bebe --- /dev/null +++ b/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch @@ -0,0 +1,173 @@ +From 51c04a9a19dec5a48fa0f38324dc2480b7a859e4 Mon Sep 17 00:00:00 2001 +From: Khem Raj +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. +This same mechanism is used to maintain a built-artifact +cache for speeding up builds. + +However, the hashes it generates include information that +doesn't work well with OE, nor with using a shared runtime +library. + +First, it embeds path names to source files, unless +building within GOROOT. This prevents the building +of a package in GOPATH for later staging into GOROOT. + +This patch adds support for the environment variable +GOPATH_OMIT_IN_ACTIONID. If present, path name +embedding is disabled. + +Upstream-Status: Inappropriate [OE specific] + +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 7c370d427f..c2441f7695 100644 +--- a/src/cmd/go/internal/envcmd/env.go ++++ b/src/cmd/go/internal/envcmd/env.go +@@ -219,7 +219,7 @@ func ExtraEnvVarsCostly(loaderstate *modload.State) []cfg.EnvVar { + } + }() + +- cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{}) ++ cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{}, false) + if err != nil { + // 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 7b073165d5..1f618be0bb 100644 +--- a/src/cmd/go/internal/work/exec.go ++++ b/src/cmd/go/internal/work/exec.go +@@ -257,6 +257,8 @@ func (b *Builder) Do(ctx context.Context, root *Action) { + writeActionGraph() + } + ++var omitGopath = os.Getenv("GOPATH_OMIT_IN_ACTIONID") != "" ++ + // buildActionID computes the action ID for a build action. + func (b *Builder) buildActionID(a *Action) cache.ActionID { + p := a.Package +@@ -278,7 +280,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) + } +- } else if p.Goroot { ++ } else if p.Goroot || omitGopath { + // The Go compiler always hides the exact value of $GOROOT + // when building things in GOROOT. + // +@@ -313,9 +315,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")) +- cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p) ++ cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p, true) + +- ccExe := b.ccExe() ++ ccExe := filterCompilerFlags(b.ccExe(), true) + 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. +@@ -325,7 +327,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { + fmt.Fprintf(h, "CC ID ERROR=%q\n", err) + } + if len(p.CXXFiles)+len(p.SwigCXXFiles) > 0 { +- cxxExe := b.cxxExe() ++ cxxExe := filterCompilerFlags(b.cxxExe(), true) + fmt.Fprintf(h, "CXX=%q %q\n", cxxExe, cxxflags) + if cxxID, _, err := b.gccToolID(cxxExe[0], "c++"); err == nil { + fmt.Fprintf(h, "CXX ID=%q\n", cxxID) +@@ -334,7 +336,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { + } + } + if len(p.FFiles) > 0 { +- fcExe := b.fcExe() ++ fcExe := filterCompilerFlags(b.fcExe(), true) + 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) +@@ -353,7 +355,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { + } + } + if p.Internal.BuildInfo != nil { +- fmt.Fprintf(h, "modinfo %q\n", p.Internal.BuildInfo.String()) ++ //fmt.Fprintf(h, "modinfo %q\n", p.Internal.BuildInfo.String()) + } + + // Configuration specific to compiler toolchain. +@@ -2804,8 +2806,25 @@ func envList(key, def string) []string { + return args + } + ++var filterFlags = os.Getenv("CGO_PEDANTIC") == "" ++ ++func filterCompilerFlags(flags []string, keepfirst bool) []string { ++ var newflags []string ++ var realkeepfirst bool = keepfirst ++ if !filterFlags { ++ return flags ++ } ++ for _, flag := range flags { ++ if strings.HasPrefix(flag, "-m") || realkeepfirst { ++ newflags = append(newflags, flag) ++ realkeepfirst = false ++ } ++ } ++ return newflags ++} ++ + // CFlags returns the flags to use when invoking the C, C++ or Fortran compilers, or cgo. +-func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) { ++func (b *Builder) CFlags(p *load.Package, filtered bool) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) { + if cppflags, err = buildFlags("CPPFLAGS", "", p.CgoCPPFLAGS, checkCompilerFlags); err != nil { + return + } +@@ -2821,6 +2840,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 { ++ cppflags = filterCompilerFlags(cppflags, false) ++ cflags = filterCompilerFlags(cflags, false) ++ cxxflags = filterCompilerFlags(cxxflags, false) ++ fflags = filterCompilerFlags(fflags, false) ++ ldflags = filterCompilerFlags(ldflags, false) ++ } + + return + } +@@ -2909,7 +2935,7 @@ func (b *Builder) runCgo(ctx context.Context, a *Action) error { + cgoExe := base.Tool("cgo") + cgofiles = mkAbsFiles(p.Dir, cgofiles) + +- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p) ++ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p, false) + if err != nil { + return err + } +@@ -3462,7 +3488,7 @@ func (b *Builder) swigOne(a *Action, file, objdir string, pcCFLAGS []string, cxx + p := a.Package + sh := b.Shell(a) + +- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p) ++ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p, false) + if err != nil { + return err + } +-- +2.25.1 + diff --git a/recipes-devtools/go/go/0002-cmd-go-Allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch b/recipes-devtools/go/go/0002-cmd-go-Allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch new file mode 100644 index 0000000..f6767d0 --- /dev/null +++ b/recipes-devtools/go/go/0002-cmd-go-Allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch @@ -0,0 +1,56 @@ +From fdad9a0ea659cf2281a0df16b0f69f179605ec9a Mon Sep 17 00:00:00 2001 +From: Alex Kube +Date: Wed, 23 Oct 2019 21:15:37 +0430 +Subject: [PATCH 02/11] cmd/go: Allow GOTOOLDIR to be overridden in the + environment + +to allow for split host/target build roots + +Adapted to Go 1.13 from patches originally submitted to +the meta/recipes-devtools/go tree by +Matt Madison . + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Alexander J Kube +Signed-off-by: Jose Quaresma +--- + src/cmd/dist/build.go | 4 +++- + src/cmd/go/internal/cfg/cfg.go | 6 +++++- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go +index 1f467647f5..b62e518030 100644 +--- a/src/cmd/dist/build.go ++++ b/src/cmd/dist/build.go +@@ -271,7 +271,9 @@ func xinit() { + } + xatexit(rmworkdir) + +- tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch) ++ if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" { ++ tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch) ++ } + + 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 3b9f27e91d..ec043c1530 100644 +--- a/src/cmd/go/internal/cfg/cfg.go ++++ b/src/cmd/go/internal/cfg/cfg.go +@@ -279,7 +279,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. +- build.ToolDir = filepath.Join(GOROOTpkg, "tool", installedGOOS+"_"+installedGOARCH) ++ if s := os.Getenv("GOTOOLDIR"); s != "" { ++ build.ToolDir = filepath.Clean(s) ++ } else { ++ build.ToolDir = filepath.Join(GOROOTpkg, "tool", installedGOOS+"_"+installedGOARCH) ++ } + } + } + } +-- +2.25.1 + diff --git a/recipes-devtools/go/go/0003-ld-add-soname-to-shareable-objects.patch b/recipes-devtools/go/go/0003-ld-add-soname-to-shareable-objects.patch new file mode 100644 index 0000000..0b5026f --- /dev/null +++ b/recipes-devtools/go/go/0003-ld-add-soname-to-shareable-objects.patch @@ -0,0 +1,51 @@ +From 1546d837c69b654754ee137af1fa1c2f7500cfa2 Mon Sep 17 00:00:00 2001 +From: Alex Kube +Date: Wed, 23 Oct 2019 21:16:32 +0430 +Subject: [PATCH 03/11] ld: add soname to shareable objects + +so that OE's shared library dependency handling +can find them. + +Adapted to Go 1.13 from patches originally submitted to +the meta/recipes-devtools/go tree by +Matt Madison . + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Alexander J Kube +Signed-off-by: Jose Quaresma +--- + src/cmd/link/internal/ld/lib.go | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go +index 2d8f964f35..dfc72e02c0 100644 +--- a/src/cmd/link/internal/ld/lib.go ++++ b/src/cmd/link/internal/ld/lib.go +@@ -1652,6 +1652,7 @@ func (ctxt *Link) hostlink() { + argv = append(argv, "-Wl,-z,relro") + } + argv = append(argv, "-shared") ++ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile))) + if ctxt.HeadType == objabi.Hwindows { + argv = addASLRargs(argv, *flagAslr) + } else { +@@ -1667,6 +1668,7 @@ func (ctxt *Link) hostlink() { + argv = append(argv, "-Wl,-z,relro") + } + argv = append(argv, "-shared") ++ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile))) + case BuildModePlugin: + if ctxt.HeadType == objabi.Hdarwin { + argv = append(argv, "-dynamiclib") +@@ -1675,6 +1677,7 @@ func (ctxt *Link) hostlink() { + argv = append(argv, "-Wl,-z,relro") + } + argv = append(argv, "-shared") ++ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile))) + } + } + +-- +2.25.1 + diff --git a/recipes-devtools/go/go/0004-make.bash-override-CC-when-building-dist-and-go_boot.patch b/recipes-devtools/go/go/0004-make.bash-override-CC-when-building-dist-and-go_boot.patch new file mode 100644 index 0000000..abbb7bd --- /dev/null +++ b/recipes-devtools/go/go/0004-make.bash-override-CC-when-building-dist-and-go_boot.patch @@ -0,0 +1,48 @@ +From b41aaa851f0074682fcd4bf07c891fbdf0fdf70c Mon Sep 17 00:00:00 2001 +From: Alex Kube +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. + +Adapted to Go 1.13 from patches originally submitted to +the meta/recipes-devtools/go tree by +Matt Madison . + +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 b67ae1529f..b59cdabd09 100755 +--- a/src/make.bash ++++ b/src/make.bash +@@ -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= "$@" + } + + 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. +-./cmd/dist/dist bootstrap -a $vflag $GO_DISTFLAGS "$@" ++CC="${BUILD_CC:-${CC}}" ./cmd/dist/dist bootstrap -a $vflag $GO_DISTFLAGS "$@" + rm -f ./cmd/dist/dist + + # DO NOT ADD ANY NEW CODE HERE. +-- +2.25.1 + diff --git a/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch b/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch new file mode 100644 index 0000000..7c8923f --- /dev/null +++ b/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch @@ -0,0 +1,224 @@ +From 12bf824f8b7e85f05434aa00e866e883a551aaeb Mon Sep 17 00:00:00 2001 +From: Alex Kube +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: + + - command flags --host-only and --target only are added; + if one is present, the other changes mentioned below + take effect, and arguments may also be specified on + the command line to enumerate the package(s) to be + built. + + - for OE cross builds, go_bootstrap is always built for + the current build host, and is moved, along with the supporting + toolchain (asm, compile, etc.) to a separate 'native_native' + directory under GOROOT/pkg/tool. + + - go_bootstrap is not automatically removed after the build, + so it can be reused later (e.g., building both static and + shared runtime). + +Note that for --host-only builds, it would be nice to specify +just the "cmd" package to build only the go commands/tools, +the staleness checks in the dist tool will fail if the "std" +library has not also been built. So host-only builds have to +build everything anyway. + +Adapted to Go 1.13 from patches originally submitted to +the meta/recipes-devtools/go tree by +Matt Madison . + +Rework the patch to avoid identation, it breaks formatting rules but +makes the changes more obvious and maintainable. +Jose Quaresma +Richard Purdie + +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 b62e518030..0c54d82300 100644 +--- a/src/cmd/dist/build.go ++++ b/src/cmd/dist/build.go +@@ -50,6 +50,7 @@ var ( + gofips140 string + workdir string + tooldir string ++ build_tooldir string + oldgoos string + oldgoarch string + oldgocache string +@@ -62,6 +63,7 @@ var ( + rebuildall bool + noOpt bool + isRelease bool ++ crossBuild bool + + vflag int // verbosity + ) +@@ -278,6 +280,8 @@ func xinit() { + goversion := findgoversion() + isRelease = (strings.HasPrefix(goversion, "release.") || strings.HasPrefix(goversion, "go")) && + !strings.Contains(goversion, "devel") ++ ++ build_tooldir = pathf("%s/pkg/tool/native_native", goroot) + } + + // compilerEnv returns a map from "goos/goarch" to the +@@ -543,8 +547,10 @@ func setup() { + goosGoarch := pathf("%s/pkg/%s_%s", goroot, gohostos, gohostarch) + if rebuildall { + xremoveall(goosGoarch) ++ xremoveall(build_tooldir) + } + xmkdirall(goosGoarch) ++ xmkdirall(build_tooldir) + xatexit(func() { + if files := xreaddir(goosGoarch); len(files) == 0 { + xremove(goosGoarch) +@@ -1415,14 +1421,20 @@ func cmdbootstrap() { + defer timelog("end", "dist bootstrap") + + var debug, distpack, force, noBanner, noClean bool ++ var hostOnly bool ++ var targetOnly bool ++ var toBuild = []string{"std", "cmd"} ++ + flag.BoolVar(&rebuildall, "a", rebuildall, "rebuild all") + flag.BoolVar(&debug, "d", debug, "enable debugging of bootstrap process") + flag.BoolVar(&distpack, "distpack", distpack, "write distribution files to pkg/distpack") + flag.BoolVar(&force, "force", force, "build even if the port is marked as broken") + flag.BoolVar(&noBanner, "no-banner", noBanner, "do not print banner") + flag.BoolVar(&noClean, "no-clean", noClean, "print deprecation warning") ++ flag.BoolVar(&hostOnly, "host-only", hostOnly, "build only host binaries, not target") ++ flag.BoolVar(&targetOnly, "target-only", targetOnly, "build only target binaries, not host") + +- xflagparse(0) ++ xflagparse(-1) + + if noClean { + xprintf("warning: --no-clean is deprecated and has no effect; use 'go install std cmd' instead\n") +@@ -1434,6 +1446,18 @@ func cmdbootstrap() { + "Use the -force flag to build anyway.\n", goos, goarch) + } + ++ if hostOnly && targetOnly { ++ fatalf("specify only one of --host-only or --target-only\n") ++ } ++ crossBuild = hostOnly || targetOnly ++ if flag.NArg() > 0 { ++ if crossBuild { ++ toBuild = flag.Args() ++ } else { ++ fatalf("package names not permitted without --host-only or --target-only\n") ++ } ++ } ++ + // 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 +@@ -1512,9 +1536,14 @@ func cmdbootstrap() { + xprintf("\n") + } + ++ // For split host/target cross/cross-canadian builds, we don't ++ // want to be setting these flags until after we have compiled ++ // the toolchain that runs on the build host. ++if !crossBuild { + gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now + setNoOpt() + goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now ++} + goBootstrap := pathf("%s/go_bootstrap", tooldir) + if debug { + run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full") +@@ -1542,7 +1571,11 @@ func cmdbootstrap() { + xprintf("\n") + } + xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n") ++if !crossBuild { + os.Setenv("CC", compilerEnvLookup("CC", defaultcc, goos, goarch)) ++} else { ++ os.Setenv("CC", defaultcc[""]) ++} + // Now that cmd/go is in charge of the build process, enable GOEXPERIMENT. + os.Setenv("GOEXPERIMENT", goexperiment) + // No need to enable PGO for toolchain2. +@@ -1595,6 +1628,7 @@ func cmdbootstrap() { + os.Setenv("GOCACHE", oldgocache) + } + ++if !crossBuild { + if goos == oldgoos && goarch == oldgoarch { + // Common case - not setting up for cross-compilation. + timelog("build", "toolchain") +@@ -1638,6 +1672,42 @@ func cmdbootstrap() { + checkNotStale(toolenv(), goBootstrap, toolchain...) + copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec) + } ++} else { ++ gogcflags = os.Getenv("GO_GCFLAGS") ++ goldflags = os.Getenv("GO_LDFLAGS") ++ tool_files, _ := filepath.Glob(pathf("%s/*", tooldir)) ++ for _, f := range tool_files { ++ copyfile(pathf("%s/%s", build_tooldir, filepath.Base(f)), f, writeExec) ++ xremove(f) ++ } ++ os.Setenv("GOTOOLDIR", build_tooldir) ++ goBootstrap = pathf("%s/go_bootstrap", build_tooldir) ++ if hostOnly { ++ timelog("build", "host toolchain") ++ if vflag > 0 { ++ xprintf("\n") ++ } ++ xprintf("Building %s for host, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch) ++ goInstall(toolenv(), goBootstrap, toBuild...) ++ checkNotStale(toolenv(), goBootstrap, toBuild...) ++ // Skip cmdGo staleness checks here, since we can't necessarily run the cmdGo binary ++ ++ timelog("build", "target toolchain") ++ if vflag > 0 { ++ xprintf("\n") ++ } ++ } else if targetOnly { ++ goos = oldgoos ++ goarch = oldgoarch ++ os.Setenv("GOOS", goos) ++ os.Setenv("GOARCH", goarch) ++ os.Setenv("CC", compilerEnvLookup("CC", defaultcc, goos, goarch)) ++ xprintf("Building %s for target, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch) ++ goInstall(toolenv(), goBootstrap, toBuild...) ++ checkNotStale(toolenv(), goBootstrap, toBuild...) ++ // Skip cmdGo staleness checks here, since we can't run the target's cmdGo binary ++ } ++} + + // Check that there are no new files in $GOROOT/bin other than + // go and gofmt and $GOOS_$GOARCH (target bin when cross-compiling). +@@ -1660,8 +1730,12 @@ func cmdbootstrap() { + } + } + ++ // Except that for split host/target cross-builds, we need to ++ // keep it. ++if !crossBuild { + // Remove go_bootstrap now that we're done. + xremove(pathf("%s/go_bootstrap"+exe, tooldir)) ++} + + if goos == "android" { + // Make sure the exec wrapper will sync a fresh $GOROOT to the device. +-- +2.25.1 + diff --git a/recipes-devtools/go/go/0006-cmd-go-make-GOROOT-precious-by-default.patch b/recipes-devtools/go/go/0006-cmd-go-make-GOROOT-precious-by-default.patch new file mode 100644 index 0000000..9aebc2f --- /dev/null +++ b/recipes-devtools/go/go/0006-cmd-go-make-GOROOT-precious-by-default.patch @@ -0,0 +1,114 @@ +From ba3caa9f969bac2b937f8f1ffed4a3679cd16ec7 Mon Sep 17 00:00:00 2001 +From: Alex Kube +Date: Wed, 23 Oct 2019 21:18:56 +0430 +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 +be read-only and the go runtime has been built as a shared +library, since we don't want every application to be rebuilding +the shared runtime - particularly in cross-build/packaging +setups, since that would lead to 'abi mismatch' runtime errors. + +This patch prevents the install and linkshared actions from +installing to GOROOT unless overridden with the GOROOT_OVERRIDE +environment variable. + +Adapted to Go 1.13 from patches originally submitted to +the meta/recipes-devtools/go tree by +Matt Madison . + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Alexander J Kube +Signed-off-by: Jose Quaresma +--- + src/cmd/go/internal/work/action.go | 3 +++ + src/cmd/go/internal/work/build.go | 6 ++++++ + src/cmd/go/internal/work/exec.go | 25 +++++++++++++++++++++++++ + 3 files changed, 34 insertions(+) + +diff --git a/src/cmd/go/internal/work/action.go b/src/cmd/go/internal/work/action.go +index 44bb9f8c1e..87ac4e30e5 100644 +--- a/src/cmd/go/internal/work/action.go ++++ b/src/cmd/go/internal/work/action.go +@@ -1076,6 +1076,9 @@ func (b *Builder) addTransitiveLinkDeps(s *modload.State, a, a1 *Action, shlib s + if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] { + continue + } ++ if goRootPrecious && (p1.Standard || p1.Goroot) { ++ continue ++ } + haveShlib[filepath.Base(p1.Shlib)] = true + // 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 3508d51fbb..77f5e7241a 100644 +--- a/src/cmd/go/internal/work/build.go ++++ b/src/cmd/go/internal/work/build.go +@@ -238,6 +238,8 @@ See also: go install, go get, go clean. + `, + } + ++var goRootPrecious bool = true ++ + func init() { + // break init cycle + CmdBuild.Run = runBuild +@@ -292,6 +294,10 @@ func init() { + case "gc", "gccgo": + buildCompiler{}.Set(build.Default.Compiler) + } ++ ++ if x := os.Getenv("GOROOT_OVERRIDE"); x != "" { ++ goRootPrecious = false ++ } + } + + type BuildFlagMask int +diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go +index 1f618be0bb..651fa64582 100644 +--- a/src/cmd/go/internal/work/exec.go ++++ b/src/cmd/go/internal/work/exec.go +@@ -605,6 +605,23 @@ func (b *Builder) checkCacheForBuild(a, buildAction *Action, covMetaFileName str + return nil, err + } + ++ if goRootPrecious && (a.Package.Standard || a.Package.Goroot) { ++ _, err := os.Stat(a.Package.Target) ++ if err == nil { ++ a.built = a.Package.Target ++ a.Target = a.Package.Target ++ a.buildID = b.fileHash(a.Package.Target) ++ a.Package.Stale = false ++ a.Package.StaleReason = "GOROOT-resident package" ++ return nil, err ++ } ++ a.Package.Stale = true ++ a.Package.StaleReason = "missing or invalid GOROOT-resident package" ++ if b.IsCmdList { ++ return nil, err ++ } ++ } ++ + if err := sh.Mkdir(buildAction.Objdir); err != nil { + return nil, err + } +@@ -1888,6 +1905,14 @@ func (b *Builder) linkShared(ctx context.Context, a *Action) (err error) { + return err + } + ++ if goRootPrecious && a.Package != nil { ++ p := a.Package ++ if p.Standard || p.Goroot { ++ err := fmt.Errorf("attempting to install package %s into read-only GOROOT", p.ImportPath) ++ return err ++ } ++ } ++ + if err := b.Shell(a).Mkdir(a.Objdir); err != nil { + return err + } +-- +2.25.1 + diff --git a/recipes-devtools/go/go/0007-exec.go-filter-out-build-specific-paths-from-linker-.patch b/recipes-devtools/go/go/0007-exec.go-filter-out-build-specific-paths-from-linker-.patch new file mode 100644 index 0000000..2598a7b --- /dev/null +++ b/recipes-devtools/go/go/0007-exec.go-filter-out-build-specific-paths-from-linker-.patch @@ -0,0 +1,63 @@ +From 2197f813c9cff65eedef44473872ec5ea9ced227 Mon Sep 17 00:00:00 2001 +From: Changqing Li +Date: Tue, 27 Feb 2024 18:06:51 +0800 +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. + +Upstream-Status: Inappropriate [ Not perfect for upstream ] + +Signed-off-by: Changqing Li +Signed-off-by: Jose Quaresma +--- + src/cmd/go/internal/work/exec.go | 25 ++++++++++++++++++++++++- + 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 651fa64582..586079afb4 100644 +--- a/src/cmd/go/internal/work/exec.go ++++ b/src/cmd/go/internal/work/exec.go +@@ -1563,6 +1563,29 @@ func (b *Builder) linkActionID(a *Action) cache.ActionID { + return h.Sum() + } + ++func filterLinkerFlags(flags []string) []string { ++ var newflags []string ++ var skipflag bool ++ skipflag = false ++ for i, flag := range flags { ++ if skipflag == true { ++ skipflag = false ++ continue ++ } ++ if strings.HasPrefix(flag, "--sysroot") || strings.HasPrefix(flag, "-fmacro-prefix-map") || strings.HasPrefix(flag, "-fdebug-prefix-map") || strings.HasPrefix(flag, "-ffile-prefix-map") || strings.HasPrefix(flag, "-fcanon-prefix-map") || strings.HasPrefix(flag, "-fprofile-prefix-map") || strings.HasPrefix(flag, "-Wl,-rpath-link"){ ++ continue ++ } else if strings.HasPrefix(flag, "-extldflags") { ++ skipflag = true ++ newflags = append(newflags, flag) ++ var filterd_Extldflags []string = filterLinkerFlags(strings.Split(flags[i+1], " ")) ++ newflags = append(newflags, strings.Join(filterd_Extldflags, " ")) ++ } else { ++ newflags = append(newflags, flag) ++ } ++ } ++ return newflags ++} ++ + // 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) { +@@ -1573,7 +1596,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 { +- fmt.Fprintf(h, "linkflags %q\n", p.Internal.Ldflags) ++ fmt.Fprintf(h, "linkflags %q\n", filterLinkerFlags(p.Internal.Ldflags)) + } + + // GOARM, GOMIPS, etc. +-- +2.25.1 + diff --git a/recipes-devtools/go/go/0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch b/recipes-devtools/go/go/0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch new file mode 100644 index 0000000..59cbff1 --- /dev/null +++ b/recipes-devtools/go/go/0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch @@ -0,0 +1,46 @@ +From e5752b239707df8ad7a72dc60420e01c5912d606 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Tue, 10 Nov 2020 16:33:27 +0000 +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. + +Upstream-Status: Inappropriate [needs upstream discussion] + +Signed-off-by: Alexander Kanavin +Signed-off-by: Jose Quaresma +--- + src/cmd/dist/buildgo.go | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/cmd/dist/buildgo.go b/src/cmd/dist/buildgo.go +index 884e9d729a..2f52edacfe 100644 +--- a/src/cmd/dist/buildgo.go ++++ b/src/cmd/dist/buildgo.go +@@ -50,8 +50,8 @@ func mkzdefaultcc(dir, file string) { + fmt.Fprintf(&buf, "package cfg\n") + fmt.Fprintln(&buf) + fmt.Fprintf(&buf, "const DefaultPkgConfig = `%s`\n", defaultpkgconfig) +- buf.WriteString(defaultCCFunc("DefaultCC", defaultcc)) +- buf.WriteString(defaultCCFunc("DefaultCXX", defaultcxx)) ++ buf.WriteString(defaultCCFunc("DefaultCC", map[string]string{"":"gcc"})) ++ buf.WriteString(defaultCCFunc("DefaultCXX", map[string]string{"":"g++"})) + writefile(buf.String(), file, writeSkipSame) + return + } +@@ -61,8 +61,8 @@ func mkzdefaultcc(dir, file string) { + fmt.Fprintf(&buf, "package main\n") + fmt.Fprintln(&buf) + fmt.Fprintf(&buf, "const defaultPkgConfig = `%s`\n", defaultpkgconfig) +- buf.WriteString(defaultCCFunc("defaultCC", defaultcc)) +- buf.WriteString(defaultCCFunc("defaultCXX", defaultcxx)) ++ buf.WriteString(defaultCCFunc("defaultCC", map[string]string{"":"gcc"})) ++ buf.WriteString(defaultCCFunc("defaultCXX", map[string]string{"":"g++"})) + writefile(buf.String(), file, writeSkipSame) + } + +-- +2.25.1 + diff --git a/recipes-devtools/go/go/0009-go-Filter-build-paths-on-staticly-linked-arches.patch b/recipes-devtools/go/go/0009-go-Filter-build-paths-on-staticly-linked-arches.patch new file mode 100644 index 0000000..140923f --- /dev/null +++ b/recipes-devtools/go/go/0009-go-Filter-build-paths-on-staticly-linked-arches.patch @@ -0,0 +1,61 @@ +From 79a1c80ed43f2a541bcab665656a4e2bb87baab3 Mon Sep 17 00:00:00 2001 +From: Richard Purdie +Date: Sat, 2 Jul 2022 23:08:13 +0100 +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 +location. This codepath is hit for statically linked go binaries such as those +on mips/ppc. + +Upstream-Status: Submitted [https://github.com/golang/go/pull/56410] + +Signed-off-by: Richard Purdie +Signed-off-by: Jose Quaresma +--- + src/cmd/go/internal/load/pkg.go | 15 +++++++++++++-- + 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 15f6b2e87b..47c5b865a1 100644 +--- a/src/cmd/go/internal/load/pkg.go ++++ b/src/cmd/go/internal/load/pkg.go +@@ -2314,6 +2314,17 @@ func appendBuildSetting(info *debug.BuildInfo, key, value string) { + info.Settings = append(info.Settings, debug.BuildSetting{Key: key, Value: value}) + } + ++func filterCompilerFlags(flags string) string { ++ var newflags []string ++ for _, flag := range strings.Fields(flags) { ++ if strings.HasPrefix(flag, "--sysroot") || strings.HasPrefix(flag, "-fmacro-prefix-map") || strings.HasPrefix(flag, "-fdebug-prefix-map") { ++ continue ++ } ++ newflags = append(newflags, flag) ++ } ++ return strings.Join(newflags, " ") ++} ++ + // 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 +@@ -2421,7 +2432,7 @@ func (p *Package) setBuildInfo(ctx context.Context, f *modfetch.Fetcher, autoVCS + if gcflags := BuildGcflags.String(); gcflags != "" && cfg.BuildContext.Compiler == "gc" { + appendSetting("-gcflags", gcflags) + } +- if ldflags := BuildLdflags.String(); ldflags != "" { ++ if ldflags := filterCompilerFlags(BuildLdflags.String()); ldflags != "" { + // 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). +@@ -2467,7 +2478,7 @@ func (p *Package) setBuildInfo(ctx context.Context, f *modfetch.Fetcher, autoVCS + // 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"} { +- appendSetting(name, cfg.Getenv(name)) ++ appendSetting(name, filterCompilerFlags(cfg.Getenv(name))) + } + } + appendSetting("GOARCH", cfg.BuildContext.GOARCH) +-- +2.25.1 + diff --git a/recipes-devtools/go/go/0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch b/recipes-devtools/go/go/0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch new file mode 100644 index 0000000..33e91bb --- /dev/null +++ b/recipes-devtools/go/go/0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch @@ -0,0 +1,48 @@ +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 | 6 ++++++ + 1 file changed, 6 insertions(+) + +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 +@@ -717,6 +717,12 @@ 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) + ++ // When -trimpath is used, GOROOT is cleared ++ if cfg.BuildTrimpath { ++ cfgChangedEnv = append(cfgChangedEnv, "GOROOT=") ++ } else { ++ cfgChangedEnv = append(cfgChangedEnv, "GOROOT="+cfg.GOROOT) ++ } + return b.Shell(root).run(dir, targetPath, cfgChangedEnv, cfg.BuildToolexec, base.Tool("link"), "-o", targetPath, "-importcfg", importcfg, ldflags) + } + +-- +2.25.1 + diff --git a/recipes-devtools/go/go_1.26.7.bb b/recipes-devtools/go/go_1.26.7.bb new file mode 100644 index 0000000..46f5fbc --- /dev/null +++ b/recipes-devtools/go/go_1.26.7.bb @@ -0,0 +1,18 @@ +require go-${PV}.inc +require go-target.inc + +inherit linuxloader + +CGO_LDFLAGS:append = " -no-pie" + +export GO_LDSO = "${@get_linuxloader(d)}" +export CC_FOR_TARGET = "gcc" +export CXX_FOR_TARGET = "g++" + +# mips/rv64 doesn't support -buildmode=pie, so skip the QA checking for mips/riscv32 and its +# variants. +python() { + if 'mips' in d.getVar('TARGET_ARCH') or 'riscv32' in d.getVar('TARGET_ARCH'): + d.appendVar('INSANE_SKIP:%s' % d.getVar('PN'), " textrel") +} + From patchwork Mon Sep 14 19:12:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Marko X-Patchwork-Id: 98219 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 EE380C88E72 for ; Mon, 14 Sep 2026 19:13:42 +0000 (UTC) Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.5593.1789413215905992786 for ; Mon, 14 Sep 2026 12:13:36 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm1 header.b=MVWDbsLy; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.227, mailfrom: fm-256628-202609141913334dbf2710c400020710-4qzuvx@rts-flowmailer.siemens.com) Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 202609141913334dbf2710c400020710 for ; Mon, 14 Sep 2026 21:13:34 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=0zNzVAp1D25R4YOjdgRVce27pHCaYR9j24R5d0Qxn+g=; b=MVWDbsLy9nHvGrIRJ1OS2vw8Ij0/e2orioSiGY2jTbz+xO7TJ6yM5ZmG048yIxIupNRaju nJl5nTTOvINpn6M+iGsIADiaQTb1tYbOvycIJkCayFKbvy7upjPFWHb+YfVnH/f4Wy+OsnHo dUIowVYv1syLtdcWdTXAU3ugNThyOAzqyGVRHkzOjQtb419EuBazq/hTR5Fm+tYfNiyEPdl4 eLJKKdkKHl5EtY/dGEq+lLMbyIis1Ws8uXDlfHhMWhqnbjHbB7JzX3baL76gZQcnqRa30syT y11SwNL17MGMgsa5+YCNRc9esDCk5/y008+ujH4gyn3kVptAAEZpku9Q==; From: Peter Marko To: yocto-patches@lists.yoctoproject.org Cc: peter.marko@siemens.com, jose.quaresma@foundries.io Subject: [meta-lts-mixins][wrynose/go][PATCH 04/11] go: add ptest support Date: Mon, 14 Sep 2026 21:12:33 +0200 Message-ID: <20260914191240.1066469-4-peter.marko@siemens.com> In-Reply-To: <20260914191240.1066469-1-peter.marko@siemens.com> References: <20260914191240.1066469-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 14 Sep 2026 19:13:42 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/4831 From: Pratik Farkase Add ptest infrastructure to test the Go standard library. - Run 'go test -short std' via run-ptest script - Install source tree and pkg/include headers - Create VERSION file for architecture detection - Exclude multi-arch binary testdata to avoid QA errors Signed-off-by: Pratik Farkase Signed-off-by: Mathieu Dubois-Briand (From OE-Core rev: 9ca41405e6bca276468a3b6f67eaa328b8016485) Signed-off-by: Peter Marko --- conf/layer.conf | 2 ++ recipes-core/images/core-image-ptest.bbappend | 6 ++++ recipes-devtools/go/go-1.26.7.inc | 1 + recipes-devtools/go/go/run-ptest | 32 +++++++++++++++++++ recipes-devtools/go/go_1.26.7.bb | 27 +++++++++++++++- 5 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 recipes-core/images/core-image-ptest.bbappend create mode 100755 recipes-devtools/go/go/run-ptest diff --git a/conf/layer.conf b/conf/layer.conf index 9215c91..8b98c80 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -13,3 +13,5 @@ LAYERSERIES_COMPAT_lts-go-mixin = "wrynose" LAYERDEPENDS_lts-go-mixin = " \ core \ " + +PTESTS_SLOW:append = " go" diff --git a/recipes-core/images/core-image-ptest.bbappend b/recipes-core/images/core-image-ptest.bbappend new file mode 100644 index 0000000..835487c --- /dev/null +++ b/recipes-core/images/core-image-ptest.bbappend @@ -0,0 +1,6 @@ +PTEST_RUNNER_TIMEOUT:virtclass-mcextend-go = "4800" + +# golang go-ptest requires extra space +IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-go = "1524288" + +QB_MEM:virtclass-mcextend-go = "-m 4096" diff --git a/recipes-devtools/go/go-1.26.7.inc b/recipes-devtools/go/go-1.26.7.inc index fed8701..ed2c7a7 100644 --- a/recipes-devtools/go/go-1.26.7.inc +++ b/recipes-devtools/go/go-1.26.7.inc @@ -15,5 +15,6 @@ SRC_URI += "\ 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://run-ptest \ " SRC_URI[main.sha256sum] = "0ed24eac755105085b89fe9cabc2742b91a0ad7b94b59d3ad364918ebc8956ad" diff --git a/recipes-devtools/go/go/run-ptest b/recipes-devtools/go/go/run-ptest new file mode 100755 index 0000000..ac020de --- /dev/null +++ b/recipes-devtools/go/go/run-ptest @@ -0,0 +1,32 @@ +#!/bin/sh + +PTEST_DIR=/usr/lib/go/ptest +GOROOT=/usr/lib/go + +export GOROOT +export PATH=$GOROOT/bin:$PATH +export ZONEINFO=/usr/share/zoneinfo + +ln -sf $PTEST_DIR/src $GOROOT/src +mkdir -p $GOROOT/pkg/include +cp $PTEST_DIR/pkg/include/* $GOROOT/pkg/include/ +cp $PTEST_DIR/VERSION $GOROOT/VERSION + +cd $GOROOT + +SKIP_PKGS="debug/dwarf debug/elf debug/pe debug/plan9obj go/types internal/xcoff net/http runtime testing time" + +SKIP_REGEX=$(echo "$SKIP_PKGS" | sed 's/ /|/g') + +for pkg in $(go list std); do + if echo "$pkg" | grep -qE "^($SKIP_REGEX)$"; then + echo "SKIP: $pkg" + continue + fi + + if go test -short "$pkg" >/dev/null 2>&1; then + echo "PASS: $pkg" + else + echo "FAIL: $pkg" + fi +done diff --git a/recipes-devtools/go/go_1.26.7.bb b/recipes-devtools/go/go_1.26.7.bb index 46f5fbc..35a14b8 100644 --- a/recipes-devtools/go/go_1.26.7.bb +++ b/recipes-devtools/go/go_1.26.7.bb @@ -1,7 +1,7 @@ require go-${PV}.inc require go-target.inc -inherit linuxloader +inherit linuxloader ptest CGO_LDFLAGS:append = " -no-pie" @@ -16,3 +16,28 @@ python() { d.appendVar('INSANE_SKIP:%s' % d.getVar('PN'), " textrel") } +do_install_ptest() { + install -d ${D}${PTEST_PATH}/src + install -d ${D}${PTEST_PATH}/pkg/include + + cp ${S}/pkg/include/* ${D}${PTEST_PATH}/pkg/include/ + echo "go${PV}" > ${D}${PTEST_PATH}/VERSION + + cd ${S}/src + find . -type d -exec install -d ${D}${PTEST_PATH}/src/{} \; + find . -type f \ + ! -path "*/testdata/*.elf*" \ + ! -path "*/testdata/*-x86-64*" \ + ! -path "*/testdata/*.obj" \ + ! -path "*/testdata/*.syso" \ + ! -path "*/testdata/*.so" \ + ! -path "*/testdata/*.so_" \ + ! -path "*/testdata/*-exec" \ + ! -path "*/testdata/test32*" \ + ! -path "*/testdata/test64*" \ + ! -path "*/race/*.syso" \ + ! -path "*/boring/syso/*.syso" \ + -exec install -m 0644 {} ${D}${PTEST_PATH}/src/{} \; +} + +RDEPENDS:${PN}-ptest += "bash tzdata git packagegroup-core-buildessential" From patchwork Mon Sep 14 19:12:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Marko X-Patchwork-Id: 98220 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 EDB94C88E6F for ; Mon, 14 Sep 2026 19:13:52 +0000 (UTC) Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net [185.136.65.225]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.5600.1789413226007800041 for ; Mon, 14 Sep 2026 12:13:46 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm1 header.b=eFSu3CMY; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.225, mailfrom: fm-256628-20260914191344769fdf564f00020740-eyf1_j@rts-flowmailer.siemens.com) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 20260914191344769fdf564f00020740 for ; Mon, 14 Sep 2026 21:13:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=TSwgaY3IiL6yfjiJ3UVFuaVTc6dKy1db617odHtXyUY=; b=eFSu3CMYWyUgBh/G3t7/tYLx0hrZFh48UUlSbcAr/oGjucqa5cihXaw2B6dvHRo8W8wEHk ucUyXPKjjm6wHxb/863L89Ozs1/QLfaAgqPaooXfHtbkDZBZOA+po9gas28x7i9tFFCMZHzs t9qoI5SJ3BN0PHrk+usyaVoAEnvvgqMGF+wpb9oQQw1eDTlhRevbrCJCp+pylLRQTi5cFzCy akj0/FvTxjk0Pdp2cBeFk8P1skek5w7vrt664Zax5eeib/XSTmfbBfiQ+GrJshdX/eYCrb8m u/xH0O1eHOhhFf2EZQh6DtITR3H0EKhWRLgsaRSOZO9sz00Q9jn0DTuQ==; From: Peter Marko To: yocto-patches@lists.yoctoproject.org Cc: peter.marko@siemens.com, jose.quaresma@foundries.io Subject: [meta-lts-mixins][wrynose/go][PATCH 05/11] go: ptest: improvements and multiple fixes in golang ptest Date: Mon, 14 Sep 2026 21:12:34 +0200 Message-ID: <20260914191240.1066469-5-peter.marko@siemens.com> In-Reply-To: <20260914191240.1066469-1-peter.marko@siemens.com> References: <20260914191240.1066469-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 14 Sep 2026 19:13:52 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/4832 From: Pratik Farkase Summary of Changelog: - run-ptest permanently modified the installed GOROOT by symlinking src/ and copying files without cleanup, corrupting the Go installation - Sub-package skip regex used exact match (^pkg$) so subpackages like net/http/httptest and runtime/debug were not skipped and would fail - Test output was completely suppressed (>/dev/null 2>&1), making failures impossible to diagnose - go was missing from RDEPENDS, allowing ptest to be installed without the toolchain it needs - bash was in RDEPENDS despite the script using #!/bin/sh with no bash-isms - file://run-ptest was in the shared .inc, affecting go-cross and go-native which don't inherit ptest - cp pkg/include/* would fail if the directory was empty Fix by saving/restoring GOROOT/src, using (/|$) in the skip regex, printing output on failure, correcting RDEPENDS, moving run-ptest to the target .bb, and guarding the glob. Tested on qemux86-64: all tests pass, 0 failures (~63 min). Signed-off-by: Pratik Farkase Signed-off-by: Richard Purdie (From OE-Core rev: a359aed2a8b94ad395a259a2009347e97185cbbc) Signed-off-by: Peter Marko --- recipes-devtools/go/go-1.26.7.inc | 1 - recipes-devtools/go/go/run-ptest | 47 +++++++++++++++++++++++++------ recipes-devtools/go/go_1.26.7.bb | 8 ++++-- 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/recipes-devtools/go/go-1.26.7.inc b/recipes-devtools/go/go-1.26.7.inc index ed2c7a7..fed8701 100644 --- a/recipes-devtools/go/go-1.26.7.inc +++ b/recipes-devtools/go/go-1.26.7.inc @@ -15,6 +15,5 @@ SRC_URI += "\ 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://run-ptest \ " SRC_URI[main.sha256sum] = "0ed24eac755105085b89fe9cabc2742b91a0ad7b94b59d3ad364918ebc8956ad" diff --git a/recipes-devtools/go/go/run-ptest b/recipes-devtools/go/go/run-ptest index ac020de..b8a0805 100755 --- a/recipes-devtools/go/go/run-ptest +++ b/recipes-devtools/go/go/run-ptest @@ -1,32 +1,63 @@ #!/bin/sh +# SPDX-License-Identifier: MIT -PTEST_DIR=/usr/lib/go/ptest +PTEST_DIR=$(cd "$(dirname "$0")" && pwd) GOROOT=/usr/lib/go export GOROOT export PATH=$GOROOT/bin:$PATH +export GOCACHE=$(mktemp -d) export ZONEINFO=/usr/share/zoneinfo -ln -sf $PTEST_DIR/src $GOROOT/src -mkdir -p $GOROOT/pkg/include -cp $PTEST_DIR/pkg/include/* $GOROOT/pkg/include/ -cp $PTEST_DIR/VERSION $GOROOT/VERSION +# Link ptest source tree into GOROOT for testing. +# Save and restore any existing src directory. +if [ -d "$GOROOT/src" ] && [ ! -L "$GOROOT/src" ]; then + mv "$GOROOT/src" "$GOROOT/src.orig" +fi +ln -sf "$PTEST_DIR/src" "$GOROOT/src" -cd $GOROOT +if [ -f "$PTEST_DIR/VERSION" ]; then + cp "$PTEST_DIR/VERSION" "$GOROOT/VERSION" +fi +if ls "$PTEST_DIR/pkg/include/"* >/dev/null 2>&1; then + mkdir -p "$GOROOT/pkg/include" + cp "$PTEST_DIR/pkg/include/"* "$GOROOT/pkg/include/" +fi +cd "$GOROOT" || exit 1 + +# Packages skipped due to known issues in the ptest environment: +# debug/dwarf, debug/elf, debug/pe, debug/plan9obj, internal/xcoff: +# require binary testdata files excluded to avoid QA errors +# go/types: extremely slow, exceeds ptest timeout +# net/http: requires network access unavailable in qemu +# runtime: requires cgo rebuild and race detector setup +# testing: circular dependency when testing the test framework +# time: requires writable GOROOT for timezone data SKIP_PKGS="debug/dwarf debug/elf debug/pe debug/plan9obj go/types internal/xcoff net/http runtime testing time" SKIP_REGEX=$(echo "$SKIP_PKGS" | sed 's/ /|/g') for pkg in $(go list std); do - if echo "$pkg" | grep -qE "^($SKIP_REGEX)$"; then + # Skip package and all its subpackages + if echo "$pkg" | grep -qE "^($SKIP_REGEX)(/|$)"; then echo "SKIP: $pkg" continue fi - if go test -short "$pkg" >/dev/null 2>&1; then + output=$(go test -short "$pkg" 2>&1) + ret=$? + if [ $ret -eq 0 ]; then echo "PASS: $pkg" else echo "FAIL: $pkg" + echo "$output" fi done + +# Cleanup: restore original src directory +rm -f "$GOROOT/src" +if [ -d "$GOROOT/src.orig" ]; then + mv "$GOROOT/src.orig" "$GOROOT/src" +fi +rm -rf "$GOCACHE" diff --git a/recipes-devtools/go/go_1.26.7.bb b/recipes-devtools/go/go_1.26.7.bb index 35a14b8..2e18ce0 100644 --- a/recipes-devtools/go/go_1.26.7.bb +++ b/recipes-devtools/go/go_1.26.7.bb @@ -3,6 +3,8 @@ require go-target.inc inherit linuxloader ptest +SRC_URI += "file://run-ptest" + CGO_LDFLAGS:append = " -no-pie" export GO_LDSO = "${@get_linuxloader(d)}" @@ -20,7 +22,9 @@ do_install_ptest() { install -d ${D}${PTEST_PATH}/src install -d ${D}${PTEST_PATH}/pkg/include - cp ${S}/pkg/include/* ${D}${PTEST_PATH}/pkg/include/ + if ls ${S}/pkg/include/* >/dev/null 2>&1; then + cp ${S}/pkg/include/* ${D}${PTEST_PATH}/pkg/include/ + fi echo "go${PV}" > ${D}${PTEST_PATH}/VERSION cd ${S}/src @@ -40,4 +44,4 @@ do_install_ptest() { -exec install -m 0644 {} ${D}${PTEST_PATH}/src/{} \; } -RDEPENDS:${PN}-ptest += "bash tzdata git packagegroup-core-buildessential" +RDEPENDS:${PN}-ptest += "go tzdata git packagegroup-core-buildessential" From patchwork Mon Sep 14 19:12:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Marko X-Patchwork-Id: 98221 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 EB152C88E72 for ; Mon, 14 Sep 2026 19:14:02 +0000 (UTC) Received: from mta-65-228.siemens.flowmailer.net (mta-65-228.siemens.flowmailer.net [185.136.65.228]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.5602.1789413235007052573 for ; Mon, 14 Sep 2026 12:13:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm1 header.b=Nloeo1md; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.228, mailfrom: fm-256628-202609141913530f394783fd0002074d-wwcv7g@rts-flowmailer.siemens.com) Received: by mta-65-228.siemens.flowmailer.net with ESMTPSA id 202609141913530f394783fd0002074d for ; Mon, 14 Sep 2026 21:13:53 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=0fbKSvMNHTyC6kzTJ9xbbZbrX3EsXBEf9Eq0W3XrgqQ=; b=Nloeo1mdO0aF+6lSlVfNJSasDy1MHGktofl5/XxuhqWYRAexUnzpN8VOIMDGZzHFZqp5hy gOP687Cm6w4lx0czT3MwqMYYc/UlXfxgRxAoJN5mWO/ZBCLUlDvl1kCg6AdVOJ5qy6674Rzv C+238RM0cWjMtgtnNqQ8DVaGAtxOAAbFSdPCmZe7h0cMpATZzOSXoRzo22aOeujPlrshxh+5 BD+gWZPkic/Mhq2RVrFPh7oqDr+NNcCkGg0KfWmqyV+H8yizM78eYKBU0/x5fpY5v5kHDq8t OZyfgTXltcw2lkRcnggam6inbirin/RzuC0+54mYfIzXLj0nFqJQUxvw==; From: Peter Marko To: yocto-patches@lists.yoctoproject.org Cc: peter.marko@siemens.com, jose.quaresma@foundries.io Subject: [meta-lts-mixins][wrynose/go][PATCH 06/11] go: ptest: fix GOROOT detection and improve cleanup/exit handling Date: Mon, 14 Sep 2026 21:12:35 +0200 Message-ID: <20260914191240.1066469-6-peter.marko@siemens.com> In-Reply-To: <20260914191240.1066469-1-peter.marko@siemens.com> References: <20260914191240.1066469-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 14 Sep 2026 19:14:02 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/4833 From: Pratik Farkase Changes: - Derive GOROOT dynamically from PTEST_DIR instead of hardcoding /usr/lib/go, which breaks on distros using lib64. - Track and clean up VERSION and pkg/include files that were copied into GOROOT, preventing stale artifacts after ptest runs. - Track failures with RC variable and exit non-zero when tests fail, consistent with other ptest scripts. Signed-off-by: Pratik Farkase Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie (From OE-Core rev: a912153baed08d8d1d563341e29a2d596546bdb4) Signed-off-by: Peter Marko --- recipes-devtools/go/go/run-ptest | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/recipes-devtools/go/go/run-ptest b/recipes-devtools/go/go/run-ptest index b8a0805..5fc9367 100755 --- a/recipes-devtools/go/go/run-ptest +++ b/recipes-devtools/go/go/run-ptest @@ -2,7 +2,7 @@ # SPDX-License-Identifier: MIT PTEST_DIR=$(cd "$(dirname "$0")" && pwd) -GOROOT=/usr/lib/go +GOROOT=$(dirname "$PTEST_DIR") export GOROOT export PATH=$GOROOT/bin:$PATH @@ -16,11 +16,18 @@ if [ -d "$GOROOT/src" ] && [ ! -L "$GOROOT/src" ]; then fi ln -sf "$PTEST_DIR/src" "$GOROOT/src" -if [ -f "$PTEST_DIR/VERSION" ]; then +CLEANUP_VERSION=0 +if [ -f "$PTEST_DIR/VERSION" ] && [ ! -f "$GOROOT/VERSION" ]; then cp "$PTEST_DIR/VERSION" "$GOROOT/VERSION" + CLEANUP_VERSION=1 fi + +CLEANUP_INCLUDE=0 if ls "$PTEST_DIR/pkg/include/"* >/dev/null 2>&1; then - mkdir -p "$GOROOT/pkg/include" + if [ ! -d "$GOROOT/pkg/include" ]; then + mkdir -p "$GOROOT/pkg/include" + CLEANUP_INCLUDE=1 + fi cp "$PTEST_DIR/pkg/include/"* "$GOROOT/pkg/include/" fi @@ -38,6 +45,7 @@ SKIP_PKGS="debug/dwarf debug/elf debug/pe debug/plan9obj go/types internal/xcoff SKIP_REGEX=$(echo "$SKIP_PKGS" | sed 's/ /|/g') +RC=0 for pkg in $(go list std); do # Skip package and all its subpackages if echo "$pkg" | grep -qE "^($SKIP_REGEX)(/|$)"; then @@ -52,6 +60,7 @@ for pkg in $(go list std); do else echo "FAIL: $pkg" echo "$output" + RC=1 fi done @@ -60,4 +69,12 @@ rm -f "$GOROOT/src" if [ -d "$GOROOT/src.orig" ]; then mv "$GOROOT/src.orig" "$GOROOT/src" fi +if [ $CLEANUP_VERSION -eq 1 ]; then + rm -f "$GOROOT/VERSION" +fi +if [ $CLEANUP_INCLUDE -eq 1 ]; then + rm -rf "$GOROOT/pkg/include" +fi rm -rf "$GOCACHE" + +exit $RC From patchwork Mon Sep 14 19:12:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Marko X-Patchwork-Id: 98222 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 ED418C88E6F for ; Mon, 14 Sep 2026 19:14:12 +0000 (UTC) Received: from mta-64-225.siemens.flowmailer.net (mta-64-225.siemens.flowmailer.net [185.136.64.225]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.5610.1789413246396589624 for ; Mon, 14 Sep 2026 12:14:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm1 header.b=dxZ4E3oU; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.225, mailfrom: fm-256628-2026091419140432fd3a46c5000207ef-91gf2w@rts-flowmailer.siemens.com) Received: by mta-64-225.siemens.flowmailer.net with ESMTPSA id 2026091419140432fd3a46c5000207ef for ; Mon, 14 Sep 2026 21:14:04 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=/G8ZxKjmpnZI5FjCsZLbIfSY7yJjaHnEExEc0vcs/4Q=; b=dxZ4E3oUm8SfEjYF85QX0wX9ONgBz+Sixth+X+6rM8i7lcupjUEXFOqsTk+qS/gZ+2zSBp cOYMflP40070+cxDaCoNfJq2Jn564RbFrHDYXTPDkQGOZO56GCQZ7yzI34WSdDidPzbX/pqC e6GmUPIsENXJGGVhrB1eqHbtCPdkaInQaKkeoR9aG5IyfV+aFwnD+EQUMOera6mgVu4o2MnS 4JgHkZJW2yImmoM/G6gmjDMBnTCCLxVNejevoKorUZ0YWn+UIdpRvLDKrQ7rmyi+mwV0bfBY Sj4v3fy7QCW/NllcoVl+4NfRI4S0gXrN/2jN4CKDjpOVxHHPxT2kuwfg==; From: Peter Marko To: yocto-patches@lists.yoctoproject.org Cc: peter.marko@siemens.com, jose.quaresma@foundries.io Subject: [meta-lts-mixins][wrynose/go][PATCH 07/11] cgo-helloworld: init add Date: Mon, 14 Sep 2026 21:12:36 +0200 Message-ID: <20260914191240.1066469-7-peter.marko@siemens.com> In-Reply-To: <20260914191240.1066469-1-peter.marko@siemens.com> References: <20260914191240.1066469-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 14 Sep 2026 19:14:12 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/4834 From: Changqing Li * Add a go example recipe with cgo enabled, Flush the stdio buffer so that piped stdout can read the output before the program exits. This is for covering go reproducibility with cgo enabled. The test coverage is provided by the reproducibility world build. Related to the following commit [1]: [0642d23230 go.bbclass: change GOTMPDIR to improve reproducibility] * cgo-helloworld is a complement for go-helloworld, also add it in runtime case for go and gotools [1] https://git.openembedded.org/openembedded-core/commit/?id=0642d2323072f561a4d0eeb9266213387b2997fc [YOCTO #16100] Signed-off-by: Changqing Li Signed-off-by: Antonin Godard Signed-off-by: Richard Purdie (From OE-Core rev: 204e4f7398ca0e8847a026c5b4f46685760af90a) Signed-off-by: Peter Marko --- lib/oeqa/runtime/cases/go_mixin.py | 15 ++++++++++++ .../packagegroup-core-tools-testapps.bbappend | 4 ++++ .../cgo-helloworld/cgo-helloworld.go | 9 ++++++++ .../go-examples/cgo-helloworld_1.0.bb | 23 +++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 lib/oeqa/runtime/cases/go_mixin.py create mode 100644 recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend create mode 100644 recipes-extended/go-examples/cgo-helloworld/cgo-helloworld.go create mode 100644 recipes-extended/go-examples/cgo-helloworld_1.0.bb diff --git a/lib/oeqa/runtime/cases/go_mixin.py b/lib/oeqa/runtime/cases/go_mixin.py new file mode 100644 index 0000000..9e94cfa --- /dev/null +++ b/lib/oeqa/runtime/cases/go_mixin.py @@ -0,0 +1,15 @@ +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.runtime.decorator.package import OEHasPackage + +class CgoHelloworldTest(OERuntimeTestCase): + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['cgo-helloworld']) + def test_cgohelloworld(self): + cmd = "cgo-helloworld" + status, output = self.target.run(cmd) + msg = 'Exit status was not 0. Output: %s' % output + self.assertEqual(status, 0, msg=msg) + + msg = 'Incorrect output: %s' % output + self.assertEqual(output, "Hello, world!", msg=msg) diff --git a/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend b/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend new file mode 100644 index 0000000..e5dca6f --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend @@ -0,0 +1,4 @@ +GOTOOLS = "\ + go-helloworld \ + cgo-helloworld \ + " diff --git a/recipes-extended/go-examples/cgo-helloworld/cgo-helloworld.go b/recipes-extended/go-examples/cgo-helloworld/cgo-helloworld.go new file mode 100644 index 0000000..0c1f9d4 --- /dev/null +++ b/recipes-extended/go-examples/cgo-helloworld/cgo-helloworld.go @@ -0,0 +1,9 @@ +package main + +// #include +// void hello() { printf("Hello, world!\n"); fflush(stdout);} +import "C" + +func main() { + C.hello() +} diff --git a/recipes-extended/go-examples/cgo-helloworld_1.0.bb b/recipes-extended/go-examples/cgo-helloworld_1.0.bb new file mode 100644 index 0000000..9ca1e16 --- /dev/null +++ b/recipes-extended/go-examples/cgo-helloworld_1.0.bb @@ -0,0 +1,23 @@ +SUMMARY = "A simple CGO example that calls C to print hello world" +SECTION = "examples" +HOMEPAGE = "https://golang.org/" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = "file://cgo-helloworld.go" + +S = "${UNPACKDIR}" + +GO_IMPORT = "cgo-helloworld" +GO_INSTALL = "${GO_IMPORT}" + +inherit go + +export GO111MODULE = "off" +export CGO_ENABLED = "1" + +do_configure:prepend() { + mkdir -p ${S}/src/${GO_IMPORT} + cp ${UNPACKDIR}/cgo-helloworld.go ${S}/src/${GO_IMPORT}/main.go +} From patchwork Mon Sep 14 19:12:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Marko X-Patchwork-Id: 98223 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 E9A2BC88E6F for ; Mon, 14 Sep 2026 19:14:22 +0000 (UTC) Received: from mta-65-227.siemens.flowmailer.net (mta-65-227.siemens.flowmailer.net [185.136.65.227]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.5612.1789413255544851488 for ; Mon, 14 Sep 2026 12:14:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm1 header.b=qZmbFaOY; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.227, mailfrom: fm-256628-202609141914139b1dbb0fd300020758-o4cc7x@rts-flowmailer.siemens.com) Received: by mta-65-227.siemens.flowmailer.net with ESMTPSA id 202609141914139b1dbb0fd300020758 for ; Mon, 14 Sep 2026 21:14:13 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=v1DNYaUbdLUUDz2ahCqJ2PkZw7kN/AMJVzIEI2eX3YY=; b=qZmbFaOYNB3mzqUD00T/BfnfEibGQ5DgfDke9DD6XKeOduQ34+1AXIrznJL7vHBT7x7krW nCwAYQxiVkyPBn+fPO2ftyFeQbiSanJZPAfD/R9N/eEeeN+CllIdI0r0Q/PqFsre5a7Qxmy7 J4jNT9oem3CA2D6WBf00RB92YTDHUYx1xbBNbEN/C6M+HpsftAbhmuub/AIal12ub9+MEyi0 H+G9axaDDxvNdUjeIJQZ0aKUoM+r3SprDmwpmSfcFvNCc4W5d4KFx8E7FHZgixS5PgLKPmIW x8RMKYj7cKHB+edQkMWEloWVXon7MtjBANXPJbKRjQi0VXjVkbR3ywuA==; From: Peter Marko To: yocto-patches@lists.yoctoproject.org Cc: peter.marko@siemens.com, jose.quaresma@foundries.io Subject: [meta-lts-mixins][wrynose/go][PATCH 08/11] golang: fix homepage Date: Mon, 14 Sep 2026 21:12:37 +0200 Message-ID: <20260914191240.1066469-8-peter.marko@siemens.com> In-Reply-To: <20260914191240.1066469-1-peter.marko@siemens.com> References: <20260914191240.1066469-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 14 Sep 2026 19:14:22 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/4835 From: Peter Marko Leading space leads to SPDX document validation errors in some tools. Example: SchemaError: \" http://golang.org/\" is not valid under any of the schemas listed in the 'anyOf' keyword (components -> ... -> externalReferences -> 0 -> url) Signed-off-by: Peter Marko Signed-off-by: Richard Purdie (From OE-Core rev: cbf36f436b477d81b58ff605846a2482308aefa4) Signed-off-by: Peter Marko --- recipes-devtools/go/go-binary-native_1.26.7.bb | 2 +- recipes-devtools/go/go-common.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes-devtools/go/go-binary-native_1.26.7.bb b/recipes-devtools/go/go-binary-native_1.26.7.bb index 753f1b1..034c051 100644 --- a/recipes-devtools/go/go-binary-native_1.26.7.bb +++ b/recipes-devtools/go/go-binary-native_1.26.7.bb @@ -1,7 +1,7 @@ # This recipe is for bootstrapping our go-cross from a prebuilt binary of Go from golang.org. SUMMARY = "Go programming language compiler (upstream binary for bootstrap)" -HOMEPAGE = " http://golang.org/" +HOMEPAGE = "http://golang.org/" LICENSE = "BSD-3-Clause" LIC_FILES_CHKSUM = "file://LICENSE;md5=7998cb338f82d15c0eff93b7004d272a" diff --git a/recipes-devtools/go/go-common.inc b/recipes-devtools/go/go-common.inc index 5d0177b..a96e676 100644 --- a/recipes-devtools/go/go-common.inc +++ b/recipes-devtools/go/go-common.inc @@ -9,7 +9,7 @@ DESCRIPTION = " The Go programming language is an open source project to make \ fast, statically typed, compiled language that feels like a\ dynamically typed, interpreted language." -HOMEPAGE = " http://golang.org/" +HOMEPAGE = "http://golang.org/" LICENSE = "BSD-3-Clause" inherit goarch From patchwork Mon Sep 14 19:12:38 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Marko X-Patchwork-Id: 98224 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 EEFDFC88E72 for ; Mon, 14 Sep 2026 19:14:32 +0000 (UTC) Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net [185.136.65.225]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.5868.1789413262584726876 for ; Mon, 14 Sep 2026 12:14:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm1 header.b=d5wZ3Alh; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.225, mailfrom: fm-256628-20260914191420b37d5290c500020721-2knfvz@rts-flowmailer.siemens.com) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 20260914191420b37d5290c500020721 for ; Mon, 14 Sep 2026 21:14:20 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=t6aptl2aSUJl4ppa0qf60bNVPYj+EjSCK/DcruwukoY=; b=d5wZ3Alhq+SUll/ltC5eC+7eixT4W4p+oY2q1kxqtoUVpli42bXLlyqoeCgG/bkfIT44v2 nEFo20rLVPHR5huFMK8SSnHOE684kaZ5XTlRR2TLqGUMQw8HpVz2OtNWd/lSL5PqTOYlrd2m XE6jEJXw0UirswQkqznRUmui376m1lgeYNu0uGcwQ5UIaYUSW3W1klC+d7b/2KBO6gZ1azW7 3EjBjIHN+RmlaIgEsSwf7/zwTzQavOyPySe8raTJHl3u38cGMtqob5nw7ac2f9DtzNvKBUof 2dKiZlc15/IHxegmpPm7giUwEvwJp4mr64XDtwUdEn6j7rwKEUZwUO7A==; From: Peter Marko To: yocto-patches@lists.yoctoproject.org Cc: peter.marko@siemens.com, jose.quaresma@foundries.io Subject: [meta-lts-mixins][wrynose/go][PATCH 09/11] go: upgrade 1.26.7 -> 1.27.0 Date: Mon, 14 Sep 2026 21:12:38 +0200 Message-ID: <20260914191240.1066469-9-peter.marko@siemens.com> In-Reply-To: <20260914191240.1066469-1-peter.marko@siemens.com> References: <20260914191240.1066469-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 14 Sep 2026 19:14:32 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/4836 From: Yash Shinde Release information: https://groups.google.com/g/golang-announce/c/8gcPInd8SQE https://go.dev/doc/go1.27 Signed-off-by: Yash Shinde Signed-off-by: Richard Purdie Signed-off-by: Peter Marko (From OE-Core rev: a0723b756582036eb0ce9a52ef0edc002c864cc9) Signed-off-by: Peter Marko --- recipes-devtools/go/{go-1.26.7.inc => go-1.27.0.inc} | 2 +- ...o-binary-native_1.26.7.bb => go-binary-native_1.27.0.bb} | 6 +++--- ...cross-canadian_1.26.7.bb => go-cross-canadian_1.27.0.bb} | 0 .../go/{go-cross_1.26.7.bb => go-cross_1.27.0.bb} | 0 .../go/{go-crosssdk_1.26.7.bb => go-crosssdk_1.27.0.bb} | 0 .../go/{go-runtime_1.26.7.bb => go-runtime_1.27.0.bb} | 0 recipes-devtools/go/{go_1.26.7.bb => go_1.27.0.bb} | 0 7 files changed, 4 insertions(+), 4 deletions(-) rename recipes-devtools/go/{go-1.26.7.inc => go-1.27.0.inc} (90%) rename recipes-devtools/go/{go-binary-native_1.26.7.bb => go-binary-native_1.27.0.bb} (80%) rename recipes-devtools/go/{go-cross-canadian_1.26.7.bb => go-cross-canadian_1.27.0.bb} (100%) rename recipes-devtools/go/{go-cross_1.26.7.bb => go-cross_1.27.0.bb} (100%) rename recipes-devtools/go/{go-crosssdk_1.26.7.bb => go-crosssdk_1.27.0.bb} (100%) rename recipes-devtools/go/{go-runtime_1.26.7.bb => go-runtime_1.27.0.bb} (100%) rename recipes-devtools/go/{go_1.26.7.bb => go_1.27.0.bb} (100%) diff --git a/recipes-devtools/go/go-1.26.7.inc b/recipes-devtools/go/go-1.27.0.inc similarity index 90% rename from recipes-devtools/go/go-1.26.7.inc rename to recipes-devtools/go/go-1.27.0.inc index fed8701..4162a2b 100644 --- a/recipes-devtools/go/go-1.26.7.inc +++ b/recipes-devtools/go/go-1.27.0.inc @@ -16,4 +16,4 @@ SRC_URI += "\ file://0009-go-Filter-build-paths-on-staticly-linked-arches.patch \ file://0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch \ " -SRC_URI[main.sha256sum] = "0ed24eac755105085b89fe9cabc2742b91a0ad7b94b59d3ad364918ebc8956ad" +SRC_URI[main.sha256sum] = "7002403d7cc44529ef6d26f69a44818263395ead7c16c05a5808ae047ebeb0e5" diff --git a/recipes-devtools/go/go-binary-native_1.26.7.bb b/recipes-devtools/go/go-binary-native_1.27.0.bb similarity index 80% rename from recipes-devtools/go/go-binary-native_1.26.7.bb rename to recipes-devtools/go/go-binary-native_1.27.0.bb index 034c051..0f6c3bc 100644 --- a/recipes-devtools/go/go-binary-native_1.26.7.bb +++ b/recipes-devtools/go/go-binary-native_1.27.0.bb @@ -9,9 +9,9 @@ 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] = "ffb5f8de10c62550dfddab66b36b57030721e0a44a3218e9e1181d7b59f121ca" -SRC_URI[go_linux_arm64.sha256sum] = "5a4ec883379d51ee9ce1040d5e87f8d35e20387574dd8c947feb01eabc3c1b37" -SRC_URI[go_linux_ppc64le.sha256sum] = "22d3b362d557175fd16b79651cab0cad64f8aaaedca745f66d16f44d56bc5de1" +SRC_URI[go_linux_amd64.sha256sum] = "675c26c449cbb18fc24b74650de1eabbae6e16f64326fd85a283fb3b58280685" +SRC_URI[go_linux_arm64.sha256sum] = "51798d2c42d0e1c6ed7fd9f48728b4193abac9e8aad6dbac2fe96a81f5909bda" +SRC_URI[go_linux_ppc64le.sha256sum] = "068085e257a6014c036c723ca62943edbf48fd168b8d00a6d39527d10b656255" UPSTREAM_CHECK_URI = "https://golang.org/dl/" UPSTREAM_CHECK_REGEX = "go(?P\d+(\.\d+)+)\.linux" diff --git a/recipes-devtools/go/go-cross-canadian_1.26.7.bb b/recipes-devtools/go/go-cross-canadian_1.27.0.bb similarity index 100% rename from recipes-devtools/go/go-cross-canadian_1.26.7.bb rename to recipes-devtools/go/go-cross-canadian_1.27.0.bb diff --git a/recipes-devtools/go/go-cross_1.26.7.bb b/recipes-devtools/go/go-cross_1.27.0.bb similarity index 100% rename from recipes-devtools/go/go-cross_1.26.7.bb rename to recipes-devtools/go/go-cross_1.27.0.bb diff --git a/recipes-devtools/go/go-crosssdk_1.26.7.bb b/recipes-devtools/go/go-crosssdk_1.27.0.bb similarity index 100% rename from recipes-devtools/go/go-crosssdk_1.26.7.bb rename to recipes-devtools/go/go-crosssdk_1.27.0.bb diff --git a/recipes-devtools/go/go-runtime_1.26.7.bb b/recipes-devtools/go/go-runtime_1.27.0.bb similarity index 100% rename from recipes-devtools/go/go-runtime_1.26.7.bb rename to recipes-devtools/go/go-runtime_1.27.0.bb diff --git a/recipes-devtools/go/go_1.26.7.bb b/recipes-devtools/go/go_1.27.0.bb similarity index 100% rename from recipes-devtools/go/go_1.26.7.bb rename to recipes-devtools/go/go_1.27.0.bb From patchwork Mon Sep 14 19:12:39 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Marko X-Patchwork-Id: 98225 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 00265C88E72 for ; Mon, 14 Sep 2026 19:14:42 +0000 (UTC) Received: from mta-65-226.siemens.flowmailer.net (mta-65-226.siemens.flowmailer.net [185.136.65.226]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.5871.1789413273183816645 for ; Mon, 14 Sep 2026 12:14:33 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm1 header.b=e54nuRAZ; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.226, mailfrom: fm-256628-2026091419143103350ea530000207c8-2l_vw6@rts-flowmailer.siemens.com) Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 2026091419143103350ea530000207c8 for ; Mon, 14 Sep 2026 21:14:31 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=UIAUYKBRYEPxWQspY/uc0iOsZp6e0faaCn87WYCOWUk=; b=e54nuRAZfq9qBQTke88nERsHFg8/j0zSYgA/BUSGU52ZK10zhmnjU1zieTOFH1x04wqZ7F O5XuT6jZjvzTKjBKgnbOTmcLeRYQHYuTDRd6HEE6oZQiy+HR6mv5wJWBC5z2O88weITiq52o TBLaqczPAyFTZ/YpyRY+3bQ7SqbLoyttqUmaw/XCjCr9+8yQYx+Fl7/o8PynM9rWuwlc2D8P hSrxHAi52pn3OguDOI9G4xUKvdcAySqep9zaRBqB3dzcI7dnaNEWIjK5ILDaSqa8PdqEFeW5 NeENJqnqqj10UIY2GDrsrB07RxO04Jzb9EerUsjW4YuivlXdQX2JPnCg==; From: Peter Marko To: yocto-patches@lists.yoctoproject.org Cc: peter.marko@siemens.com, jose.quaresma@foundries.io Subject: [meta-lts-mixins][wrynose/go][PATCH 10/11] go: upgrade 1.27.0 -> 1.27.1 Date: Mon, 14 Sep 2026 21:12:39 +0200 Message-ID: <20260914191240.1066469-10-peter.marko@siemens.com> In-Reply-To: <20260914191240.1066469-1-peter.marko@siemens.com> References: <20260914191240.1066469-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 14 Sep 2026 19:14:42 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/4837 From: Mathieu Dubois-Briand Changelog: go1.27.1 includes fixes to cgo, the compiler, the runtime, the go fix command, and the database/sql, debug/elf, encoding/json, net/http, os, simd, and simd/archsimd packages Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie Signed-off-by: Peter Marko (From OE-Core rev: e87255c5a3705659eedb9a9b2e4910b5218e3bd9) Signed-off-by: Peter Marko --- .../go/{go-1.27.0.inc => go-1.27.1.inc} | 2 +- ..._1.27.0.bb => go-cross-canadian_1.27.1.bb} | 0 ...{go-cross_1.27.0.bb => go-cross_1.27.1.bb} | 0 ...osssdk_1.27.0.bb => go-crosssdk_1.27.1.bb} | 0 ...runtime_1.27.0.bb => go-runtime_1.27.1.bb} | 0 ...ent-based-hash-generation-less-pedan.patch | 34 ++++++++----------- ...OOLDIR-to-be-overridden-in-the-envir.patch | 14 +++----- ...3-ld-add-soname-to-shareable-objects.patch | 15 ++++---- ...de-CC-when-building-dist-and-go_boot.patch | 10 ++---- ...dist-separate-host-and-target-builds.patch | 31 ++++++++--------- ...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 ++++---- ...OOT-for-func-ldShared-when-trimpath-.patch | 12 +++---- .../go/{go_1.27.0.bb => go_1.27.1.bb} | 0 16 files changed, 73 insertions(+), 108 deletions(-) rename recipes-devtools/go/{go-1.27.0.inc => go-1.27.1.inc} (90%) rename recipes-devtools/go/{go-cross-canadian_1.27.0.bb => go-cross-canadian_1.27.1.bb} (100%) rename recipes-devtools/go/{go-cross_1.27.0.bb => go-cross_1.27.1.bb} (100%) rename recipes-devtools/go/{go-crosssdk_1.27.0.bb => go-crosssdk_1.27.1.bb} (100%) rename recipes-devtools/go/{go-runtime_1.27.0.bb => go-runtime_1.27.1.bb} (100%) rename recipes-devtools/go/{go_1.27.0.bb => go_1.27.1.bb} (100%) diff --git a/recipes-devtools/go/go-1.27.0.inc b/recipes-devtools/go/go-1.27.1.inc similarity index 90% rename from recipes-devtools/go/go-1.27.0.inc rename to recipes-devtools/go/go-1.27.1.inc index 4162a2b..61df455 100644 --- a/recipes-devtools/go/go-1.27.0.inc +++ b/recipes-devtools/go/go-1.27.1.inc @@ -16,4 +16,4 @@ SRC_URI += "\ file://0009-go-Filter-build-paths-on-staticly-linked-arches.patch \ file://0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch \ " -SRC_URI[main.sha256sum] = "7002403d7cc44529ef6d26f69a44818263395ead7c16c05a5808ae047ebeb0e5" +SRC_URI[main.sha256sum] = "4e408abae126d916b6164627193f2c54f0e3ca1312d693b86db45f862ab238b1" diff --git a/recipes-devtools/go/go-cross-canadian_1.27.0.bb b/recipes-devtools/go/go-cross-canadian_1.27.1.bb similarity index 100% rename from recipes-devtools/go/go-cross-canadian_1.27.0.bb rename to recipes-devtools/go/go-cross-canadian_1.27.1.bb diff --git a/recipes-devtools/go/go-cross_1.27.0.bb b/recipes-devtools/go/go-cross_1.27.1.bb similarity index 100% rename from recipes-devtools/go/go-cross_1.27.0.bb rename to recipes-devtools/go/go-cross_1.27.1.bb diff --git a/recipes-devtools/go/go-crosssdk_1.27.0.bb b/recipes-devtools/go/go-crosssdk_1.27.1.bb similarity index 100% rename from recipes-devtools/go/go-crosssdk_1.27.0.bb rename to recipes-devtools/go/go-crosssdk_1.27.1.bb diff --git a/recipes-devtools/go/go-runtime_1.27.0.bb b/recipes-devtools/go/go-runtime_1.27.1.bb similarity index 100% rename from recipes-devtools/go/go-runtime_1.27.0.bb rename to recipes-devtools/go/go-runtime_1.27.1.bb diff --git a/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch b/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch index 077bebe..6372b78 100644 --- a/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch +++ b/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch @@ -1,8 +1,7 @@ -From 51c04a9a19dec5a48fa0f38324dc2480b7a859e4 Mon Sep 17 00:00:00 2001 +From a84463da5bd6dfa1e514bbac2134155275a6f0ca Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 22 Feb 2025 03:24:48 -0800 -Subject: [PATCH 01/11] cmd/go: make content-based hash generation less - pedantic +Subject: [PATCH] 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. @@ -36,10 +35,10 @@ Signed-off-by: Hongxu Jia 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 7c370d427f..c2441f7695 100644 +index 3d72c368b088..7e4235718a3f 100644 --- a/src/cmd/go/internal/envcmd/env.go +++ b/src/cmd/go/internal/envcmd/env.go -@@ -219,7 +219,7 @@ func ExtraEnvVarsCostly(loaderstate *modload.State) []cfg.EnvVar { +@@ -246,7 +246,7 @@ func ExtraEnvVarsCostly(ld *modload.Loader) []cfg.EnvVar { } }() @@ -49,10 +48,10 @@ index 7c370d427f..c2441f7695 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 7b073165d5..1f618be0bb 100644 +index 8dcf324529f5..617b7ece73f0 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go -@@ -257,6 +257,8 @@ func (b *Builder) Do(ctx context.Context, root *Action) { +@@ -260,6 +260,8 @@ func (b *Builder) Do(ctx context.Context, root *Action) { writeActionGraph() } @@ -61,7 +60,7 @@ index 7b073165d5..1f618be0bb 100644 // buildActionID computes the action ID for a build action. func (b *Builder) buildActionID(a *Action) cache.ActionID { p := a.Package -@@ -278,7 +280,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { +@@ -281,7 +283,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) } @@ -70,7 +69,7 @@ index 7b073165d5..1f618be0bb 100644 // The Go compiler always hides the exact value of $GOROOT // when building things in GOROOT. // -@@ -313,9 +315,9 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { +@@ -316,9 +318,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")) @@ -82,7 +81,7 @@ index 7b073165d5..1f618be0bb 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. -@@ -325,7 +327,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { +@@ -328,7 +330,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { fmt.Fprintf(h, "CC ID ERROR=%q\n", err) } if len(p.CXXFiles)+len(p.SwigCXXFiles) > 0 { @@ -91,7 +90,7 @@ index 7b073165d5..1f618be0bb 100644 fmt.Fprintf(h, "CXX=%q %q\n", cxxExe, cxxflags) if cxxID, _, err := b.gccToolID(cxxExe[0], "c++"); err == nil { fmt.Fprintf(h, "CXX ID=%q\n", cxxID) -@@ -334,7 +336,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { +@@ -337,7 +339,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { } } if len(p.FFiles) > 0 { @@ -100,7 +99,7 @@ index 7b073165d5..1f618be0bb 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) -@@ -353,7 +355,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { +@@ -356,7 +358,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { } } if p.Internal.BuildInfo != nil { @@ -109,7 +108,7 @@ index 7b073165d5..1f618be0bb 100644 } // Configuration specific to compiler toolchain. -@@ -2804,8 +2806,25 @@ func envList(key, def string) []string { +@@ -2838,8 +2840,25 @@ func envList(key, def string) []string { return args } @@ -136,7 +135,7 @@ index 7b073165d5..1f618be0bb 100644 if cppflags, err = buildFlags("CPPFLAGS", "", p.CgoCPPFLAGS, checkCompilerFlags); err != nil { return } -@@ -2821,6 +2840,13 @@ func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, l +@@ -2855,6 +2874,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 } @@ -150,7 +149,7 @@ index 7b073165d5..1f618be0bb 100644 return } -@@ -2909,7 +2935,7 @@ func (b *Builder) runCgo(ctx context.Context, a *Action) error { +@@ -2943,7 +2969,7 @@ func (b *Builder) runCgo(ctx context.Context, a *Action) error { cgoExe := base.Tool("cgo") cgofiles = mkAbsFiles(p.Dir, cgofiles) @@ -159,7 +158,7 @@ index 7b073165d5..1f618be0bb 100644 if err != nil { return err } -@@ -3462,7 +3488,7 @@ func (b *Builder) swigOne(a *Action, file, objdir string, pcCFLAGS []string, cxx +@@ -3501,7 +3527,7 @@ func (b *Builder) swigOne(a *Action, file, objdir string, pcCFLAGS []string, cxx p := a.Package sh := b.Shell(a) @@ -168,6 +167,3 @@ index 7b073165d5..1f618be0bb 100644 if err != nil { return err } --- -2.25.1 - diff --git a/recipes-devtools/go/go/0002-cmd-go-Allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch b/recipes-devtools/go/go/0002-cmd-go-Allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch index f6767d0..e47bd53 100644 --- a/recipes-devtools/go/go/0002-cmd-go-Allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch +++ b/recipes-devtools/go/go/0002-cmd-go-Allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch @@ -1,8 +1,7 @@ -From fdad9a0ea659cf2281a0df16b0f69f179605ec9a Mon Sep 17 00:00:00 2001 +From 7c951454dc9acbb0649d38504c8237304a80fa46 Mon Sep 17 00:00:00 2001 From: Alex Kube Date: Wed, 23 Oct 2019 21:15:37 +0430 -Subject: [PATCH 02/11] cmd/go: Allow GOTOOLDIR to be overridden in the - environment +Subject: [PATCH] cmd/go: Allow GOTOOLDIR to be overridden in the environment to allow for split host/target build roots @@ -20,10 +19,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 1f467647f5..b62e518030 100644 +index 78d55bec5599..4210466fa4ea 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go -@@ -271,7 +271,9 @@ func xinit() { +@@ -272,7 +272,9 @@ func xinit() { } xatexit(rmworkdir) @@ -35,7 +34,7 @@ index 1f467647f5..b62e518030 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 3b9f27e91d..ec043c1530 100644 +index 78cbbb949e7c..96b5fc38a495 100644 --- a/src/cmd/go/internal/cfg/cfg.go +++ b/src/cmd/go/internal/cfg/cfg.go @@ -279,7 +279,11 @@ func SetGOROOT(goroot string, isTestGo bool) { @@ -51,6 +50,3 @@ index 3b9f27e91d..ec043c1530 100644 } } } --- -2.25.1 - diff --git a/recipes-devtools/go/go/0003-ld-add-soname-to-shareable-objects.patch b/recipes-devtools/go/go/0003-ld-add-soname-to-shareable-objects.patch index 0b5026f..59ae99c 100644 --- a/recipes-devtools/go/go/0003-ld-add-soname-to-shareable-objects.patch +++ b/recipes-devtools/go/go/0003-ld-add-soname-to-shareable-objects.patch @@ -1,7 +1,7 @@ -From 1546d837c69b654754ee137af1fa1c2f7500cfa2 Mon Sep 17 00:00:00 2001 +From 2bd7bc502c308b39ba80a8804bb4e2305acd0f62 Mon Sep 17 00:00:00 2001 From: Alex Kube Date: Wed, 23 Oct 2019 21:16:32 +0430 -Subject: [PATCH 03/11] ld: add soname to shareable objects +Subject: [PATCH] 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 2d8f964f35..dfc72e02c0 100644 +index 9cbc12919f1d..0f33521777d1 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go -@@ -1652,6 +1652,7 @@ func (ctxt *Link) hostlink() { +@@ -1672,6 +1672,7 @@ func (ctxt *Link) hostlink() { argv = append(argv, "-Wl,-z,relro") } argv = append(argv, "-shared") @@ -30,7 +30,7 @@ index 2d8f964f35..dfc72e02c0 100644 if ctxt.HeadType == objabi.Hwindows { argv = addASLRargs(argv, *flagAslr) } else { -@@ -1667,6 +1668,7 @@ func (ctxt *Link) hostlink() { +@@ -1687,6 +1688,7 @@ func (ctxt *Link) hostlink() { argv = append(argv, "-Wl,-z,relro") } argv = append(argv, "-shared") @@ -38,7 +38,7 @@ index 2d8f964f35..dfc72e02c0 100644 case BuildModePlugin: if ctxt.HeadType == objabi.Hdarwin { argv = append(argv, "-dynamiclib") -@@ -1675,6 +1677,7 @@ func (ctxt *Link) hostlink() { +@@ -1695,6 +1697,7 @@ func (ctxt *Link) hostlink() { argv = append(argv, "-Wl,-z,relro") } argv = append(argv, "-shared") @@ -46,6 +46,3 @@ index 2d8f964f35..dfc72e02c0 100644 } } --- -2.25.1 - diff --git a/recipes-devtools/go/go/0004-make.bash-override-CC-when-building-dist-and-go_boot.patch b/recipes-devtools/go/go/0004-make.bash-override-CC-when-building-dist-and-go_boot.patch index abbb7bd..fa98120 100644 --- a/recipes-devtools/go/go/0004-make.bash-override-CC-when-building-dist-and-go_boot.patch +++ b/recipes-devtools/go/go/0004-make.bash-override-CC-when-building-dist-and-go_boot.patch @@ -1,8 +1,7 @@ -From b41aaa851f0074682fcd4bf07c891fbdf0fdf70c Mon Sep 17 00:00:00 2001 +From ad5252b238946d7d9f21853709e6b592fb2d50e5 Mon Sep 17 00:00:00 2001 From: Alex Kube Date: Sat, 22 Feb 2025 03:14:37 -0800 -Subject: [PATCH 04/11] make.bash: override CC when building dist and - go_bootstrap +Subject: [PATCH] make.bash: override CC when building dist and go_bootstrap for handling OE cross-canadian builds. @@ -22,7 +21,7 @@ Signed-off-by: Hongxu Jia 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/make.bash b/src/make.bash -index b67ae1529f..b59cdabd09 100755 +index d4e927dfda7c..8fc7e40888c6 100755 --- a/src/make.bash +++ b/src/make.bash @@ -153,7 +153,7 @@ fi @@ -43,6 +42,3 @@ index b67ae1529f..b59cdabd09 100755 rm -f ./cmd/dist/dist # DO NOT ADD ANY NEW CODE HERE. --- -2.25.1 - diff --git a/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch b/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch index 7c8923f..2c34ada 100644 --- a/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch +++ b/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch @@ -1,7 +1,7 @@ -From 12bf824f8b7e85f05434aa00e866e883a551aaeb Mon Sep 17 00:00:00 2001 +From c78ccbcf1c70e3bb27185b6a007d44d2e912466d Mon Sep 17 00:00:00 2001 From: Alex Kube Date: Fri, 28 Feb 2025 19:09:17 -0800 -Subject: [PATCH 05/11] cmd/dist: separate host and target builds +Subject: [PATCH] cmd/dist: separate host and target builds Change the dist tool to allow for OE-style cross- and cross-canadian builds: @@ -48,10 +48,10 @@ Signed-off-by: Hongxu Jia 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go -index b62e518030..0c54d82300 100644 +index 4210466fa4ea..ee069148143e 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go -@@ -50,6 +50,7 @@ var ( +@@ -51,6 +51,7 @@ var ( gofips140 string workdir string tooldir string @@ -59,7 +59,7 @@ index b62e518030..0c54d82300 100644 oldgoos string oldgoarch string oldgocache string -@@ -62,6 +63,7 @@ var ( +@@ -63,6 +64,7 @@ var ( rebuildall bool noOpt bool isRelease bool @@ -67,7 +67,7 @@ index b62e518030..0c54d82300 100644 vflag int // verbosity ) -@@ -278,6 +280,8 @@ func xinit() { +@@ -279,6 +281,8 @@ func xinit() { goversion := findgoversion() isRelease = (strings.HasPrefix(goversion, "release.") || strings.HasPrefix(goversion, "go")) && !strings.Contains(goversion, "devel") @@ -76,7 +76,7 @@ index b62e518030..0c54d82300 100644 } // compilerEnv returns a map from "goos/goarch" to the -@@ -543,8 +547,10 @@ func setup() { +@@ -558,8 +562,10 @@ func setup() { goosGoarch := pathf("%s/pkg/%s_%s", goroot, gohostos, gohostarch) if rebuildall { xremoveall(goosGoarch) @@ -87,7 +87,7 @@ index b62e518030..0c54d82300 100644 xatexit(func() { if files := xreaddir(goosGoarch); len(files) == 0 { xremove(goosGoarch) -@@ -1415,14 +1421,20 @@ func cmdbootstrap() { +@@ -1432,14 +1438,20 @@ func cmdbootstrap() { defer timelog("end", "dist bootstrap") var debug, distpack, force, noBanner, noClean bool @@ -109,7 +109,7 @@ index b62e518030..0c54d82300 100644 if noClean { xprintf("warning: --no-clean is deprecated and has no effect; use 'go install std cmd' instead\n") -@@ -1434,6 +1446,18 @@ func cmdbootstrap() { +@@ -1451,6 +1463,18 @@ func cmdbootstrap() { "Use the -force flag to build anyway.\n", goos, goarch) } @@ -128,7 +128,7 @@ index b62e518030..0c54d82300 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 -@@ -1512,9 +1536,14 @@ func cmdbootstrap() { +@@ -1529,9 +1553,14 @@ func cmdbootstrap() { xprintf("\n") } @@ -143,7 +143,7 @@ index b62e518030..0c54d82300 100644 goBootstrap := pathf("%s/go_bootstrap", tooldir) if debug { run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full") -@@ -1542,7 +1571,11 @@ func cmdbootstrap() { +@@ -1559,7 +1588,11 @@ func cmdbootstrap() { xprintf("\n") } xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n") @@ -155,7 +155,7 @@ index b62e518030..0c54d82300 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. -@@ -1595,6 +1628,7 @@ func cmdbootstrap() { +@@ -1612,6 +1645,7 @@ func cmdbootstrap() { os.Setenv("GOCACHE", oldgocache) } @@ -163,7 +163,7 @@ index b62e518030..0c54d82300 100644 if goos == oldgoos && goarch == oldgoarch { // Common case - not setting up for cross-compilation. timelog("build", "toolchain") -@@ -1638,6 +1672,42 @@ func cmdbootstrap() { +@@ -1655,6 +1689,42 @@ func cmdbootstrap() { checkNotStale(toolenv(), goBootstrap, toolchain...) copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec) } @@ -206,7 +206,7 @@ index b62e518030..0c54d82300 100644 // Check that there are no new files in $GOROOT/bin other than // go and gofmt and $GOOS_$GOARCH (target bin when cross-compiling). -@@ -1660,8 +1730,12 @@ func cmdbootstrap() { +@@ -1677,8 +1747,12 @@ func cmdbootstrap() { } } @@ -219,6 +219,3 @@ index b62e518030..0c54d82300 100644 if goos == "android" { // Make sure the exec wrapper will sync a fresh $GOROOT to the device. --- -2.25.1 - diff --git a/recipes-devtools/go/go/0006-cmd-go-make-GOROOT-precious-by-default.patch b/recipes-devtools/go/go/0006-cmd-go-make-GOROOT-precious-by-default.patch index 9aebc2f..74fd1fa 100644 --- a/recipes-devtools/go/go/0006-cmd-go-make-GOROOT-precious-by-default.patch +++ b/recipes-devtools/go/go/0006-cmd-go-make-GOROOT-precious-by-default.patch @@ -1,7 +1,7 @@ -From ba3caa9f969bac2b937f8f1ffed4a3679cd16ec7 Mon Sep 17 00:00:00 2001 +From 3d48927c9fa7228445be9249d8a7e696bb6d306d Mon Sep 17 00:00:00 2001 From: Alex Kube Date: Wed, 23 Oct 2019 21:18:56 +0430 -Subject: [PATCH 06/11] cmd/go: make GOROOT precious by default +Subject: [PATCH] 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 44bb9f8c1e..87ac4e30e5 100644 +index 8b3897e215ed..598e751aba4e 100644 --- a/src/cmd/go/internal/work/action.go +++ b/src/cmd/go/internal/work/action.go -@@ -1076,6 +1076,9 @@ func (b *Builder) addTransitiveLinkDeps(s *modload.State, a, a1 *Action, shlib s +@@ -1076,6 +1076,9 @@ func (b *Builder) addTransitiveLinkDeps(s *modload.Loader, a, a1 *Action, shlib if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] { continue } @@ -43,10 +43,10 @@ index 44bb9f8c1e..87ac4e30e5 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 3508d51fbb..77f5e7241a 100644 +index 969e0029c3e2..f80f28abff63 100644 --- a/src/cmd/go/internal/work/build.go +++ b/src/cmd/go/internal/work/build.go -@@ -238,6 +238,8 @@ See also: go install, go get, go clean. +@@ -240,6 +240,8 @@ See also: go install, go get, go clean. `, } @@ -55,7 +55,7 @@ index 3508d51fbb..77f5e7241a 100644 func init() { // break init cycle CmdBuild.Run = runBuild -@@ -292,6 +294,10 @@ func init() { +@@ -294,6 +296,10 @@ func init() { case "gc", "gccgo": buildCompiler{}.Set(build.Default.Compiler) } @@ -67,10 +67,10 @@ index 3508d51fbb..77f5e7241a 100644 type BuildFlagMask int diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go -index 1f618be0bb..651fa64582 100644 +index 617b7ece73f0..46c0712c5bd0 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go -@@ -605,6 +605,23 @@ func (b *Builder) checkCacheForBuild(a, buildAction *Action, covMetaFileName str +@@ -608,6 +608,23 @@ func (b *Builder) checkCacheForBuild(a, buildAction *Action, covMetaFileName str return nil, err } @@ -94,7 +94,7 @@ index 1f618be0bb..651fa64582 100644 if err := sh.Mkdir(buildAction.Objdir); err != nil { return nil, err } -@@ -1888,6 +1905,14 @@ func (b *Builder) linkShared(ctx context.Context, a *Action) (err error) { +@@ -1922,6 +1939,14 @@ func (b *Builder) linkShared(ctx context.Context, a *Action) (err error) { return err } @@ -109,6 +109,3 @@ index 1f618be0bb..651fa64582 100644 if err := b.Shell(a).Mkdir(a.Objdir); err != nil { return err } --- -2.25.1 - diff --git a/recipes-devtools/go/go/0007-exec.go-filter-out-build-specific-paths-from-linker-.patch b/recipes-devtools/go/go/0007-exec.go-filter-out-build-specific-paths-from-linker-.patch index 2598a7b..0cc770a 100644 --- a/recipes-devtools/go/go/0007-exec.go-filter-out-build-specific-paths-from-linker-.patch +++ b/recipes-devtools/go/go/0007-exec.go-filter-out-build-specific-paths-from-linker-.patch @@ -1,8 +1,7 @@ -From 2197f813c9cff65eedef44473872ec5ea9ced227 Mon Sep 17 00:00:00 2001 +From 0c1a5e347d722a0297328b28259c55acdd1b89c8 Mon Sep 17 00:00:00 2001 From: Changqing Li Date: Tue, 27 Feb 2024 18:06:51 +0800 -Subject: [PATCH 07/11] exec.go: filter out build-specific paths from linker - flags +Subject: [PATCH] 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. @@ -16,10 +15,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 651fa64582..586079afb4 100644 +index 46c0712c5bd0..e7c0459ee4c0 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go -@@ -1563,6 +1563,29 @@ func (b *Builder) linkActionID(a *Action) cache.ActionID { +@@ -1597,6 +1597,29 @@ func (b *Builder) linkActionID(a *Action) cache.ActionID { return h.Sum() } @@ -49,7 +48,7 @@ index 651fa64582..586079afb4 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) { -@@ -1573,7 +1596,7 @@ func (b *Builder) printLinkerConfig(h io.Writer, p *load.Package) { +@@ -1607,7 +1630,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 { @@ -58,6 +57,3 @@ index 651fa64582..586079afb4 100644 } // GOARM, GOMIPS, etc. --- -2.25.1 - diff --git a/recipes-devtools/go/go/0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch b/recipes-devtools/go/go/0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch index 59cbff1..cae95f7 100644 --- a/recipes-devtools/go/go/0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch +++ b/recipes-devtools/go/go/0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch @@ -1,8 +1,8 @@ -From e5752b239707df8ad7a72dc60420e01c5912d606 Mon Sep 17 00:00:00 2001 +From 11cab620644b3354a1bf281a1f8ca62d590ad46a Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Tue, 10 Nov 2020 16:33:27 +0000 -Subject: [PATCH 08/11] src/cmd/dist/buildgo.go: do not hardcode host compilers - into target binaries +Subject: [PATCH] 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 884e9d729a..2f52edacfe 100644 +index 6bd8a9ce8dfa..08f36eb0d8f1 100644 --- a/src/cmd/dist/buildgo.go +++ b/src/cmd/dist/buildgo.go @@ -50,8 +50,8 @@ func mkzdefaultcc(dir, file string) { @@ -41,6 +41,3 @@ index 884e9d729a..2f52edacfe 100644 writefile(buf.String(), file, writeSkipSame) } --- -2.25.1 - diff --git a/recipes-devtools/go/go/0009-go-Filter-build-paths-on-staticly-linked-arches.patch b/recipes-devtools/go/go/0009-go-Filter-build-paths-on-staticly-linked-arches.patch index 140923f..dcce739 100644 --- a/recipes-devtools/go/go/0009-go-Filter-build-paths-on-staticly-linked-arches.patch +++ b/recipes-devtools/go/go/0009-go-Filter-build-paths-on-staticly-linked-arches.patch @@ -1,7 +1,7 @@ -From 79a1c80ed43f2a541bcab665656a4e2bb87baab3 Mon Sep 17 00:00:00 2001 +From c6f96f86e8e2619c7e1be566f717b05437838e49 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sat, 2 Jul 2022 23:08:13 +0100 -Subject: [PATCH 09/11] go: Filter build paths on staticly linked arches +Subject: [PATCH] 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 15f6b2e87b..47c5b865a1 100644 +index 2985cff67cec..f7c3f5eed9f6 100644 --- a/src/cmd/go/internal/load/pkg.go +++ b/src/cmd/go/internal/load/pkg.go -@@ -2314,6 +2314,17 @@ func appendBuildSetting(info *debug.BuildInfo, key, value string) { +@@ -2359,6 +2359,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 15f6b2e87b..47c5b865a1 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 -@@ -2421,7 +2432,7 @@ func (p *Package) setBuildInfo(ctx context.Context, f *modfetch.Fetcher, autoVCS +@@ -2466,7 +2477,7 @@ func (p *Package) setBuildInfo(ctx context.Context, f *modfetch.Fetcher, autoVCS if gcflags := BuildGcflags.String(); gcflags != "" && cfg.BuildContext.Compiler == "gc" { appendSetting("-gcflags", gcflags) } @@ -47,7 +47,7 @@ index 15f6b2e87b..47c5b865a1 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). -@@ -2467,7 +2478,7 @@ func (p *Package) setBuildInfo(ctx context.Context, f *modfetch.Fetcher, autoVCS +@@ -2512,7 +2523,7 @@ func (p *Package) setBuildInfo(ctx context.Context, f *modfetch.Fetcher, autoVCS // 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,6 +56,3 @@ index 15f6b2e87b..47c5b865a1 100644 } } appendSetting("GOARCH", cfg.BuildContext.GOARCH) --- -2.25.1 - diff --git a/recipes-devtools/go/go/0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch b/recipes-devtools/go/go/0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch index 33e91bb..6e71187 100644 --- a/recipes-devtools/go/go/0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch +++ b/recipes-devtools/go/go/0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch @@ -1,8 +1,7 @@ -From c4215b5ca69a7626d97cf9b7ebc460c2b5b9148b Mon Sep 17 00:00:00 2001 +From 9a2ae8df1030046c94aa74bbd853dde5d844812d 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 +Subject: [PATCH] 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] @@ -27,10 +26,10 @@ Signed-off-by: Hongxu Jia 1 file changed, 6 insertions(+) diff --git a/src/cmd/go/internal/work/gc.go b/src/cmd/go/internal/work/gc.go -index 3a173efee8..8b7a44e031 100644 +index 49b26e15609b..7c0d2ac9e0f0 100644 --- a/src/cmd/go/internal/work/gc.go +++ b/src/cmd/go/internal/work/gc.go -@@ -717,6 +717,12 @@ func (gcToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, +@@ -721,6 +721,12 @@ 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) @@ -43,6 +42,3 @@ index 3a173efee8..8b7a44e031 100644 return b.Shell(root).run(dir, targetPath, cfgChangedEnv, cfg.BuildToolexec, base.Tool("link"), "-o", targetPath, "-importcfg", importcfg, ldflags) } --- -2.25.1 - diff --git a/recipes-devtools/go/go_1.27.0.bb b/recipes-devtools/go/go_1.27.1.bb similarity index 100% rename from recipes-devtools/go/go_1.27.0.bb rename to recipes-devtools/go/go_1.27.1.bb From patchwork Mon Sep 14 19:12:40 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Marko X-Patchwork-Id: 98226 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 E88BAC88E6F for ; Mon, 14 Sep 2026 19:14:52 +0000 (UTC) Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.5875.1789413287866440029 for ; Mon, 14 Sep 2026 12:14:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm1 header.b=b5pPTLIP; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.227, mailfrom: fm-256628-20260914191445466ce05f1e0002072f-pv6qee@rts-flowmailer.siemens.com) Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 20260914191445466ce05f1e0002072f for ; Mon, 14 Sep 2026 21:14:46 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=oe+pQZbQ7ZIwZp86vKAa69XiPgiensKJHyxLcoqiaKI=; b=b5pPTLIPgjCGj7wtMML8LkiJmyyNe/lStnigkoae+s+RYQOsS4KvP9vvre3GZRtSaw63lq /p5UxlGC0OTfZi53TCS6DhaTmRGoNoCKs7Mc+4akq7QyeUvjaF+R4ql3FgJRb7sxEzVjjiKc e3lzKhfKASSMZGthBRG4emTiEiXu++beLZP3KXR8PxDF2L48WcDwUnydZQqZT+RoIklK2vNk 0FXthEoiR1c/x3peHT1/Yc0n0GeLhtaAWO6HhLW9gX0tBqv/rMUxekMMSmtJe42NpFeKZTHR MLe1/vGmhy4aysMMIdLPeD4qf5fG2Dxn/24MhG99XHFlHOoWN0N4I+MA==; From: Peter Marko To: yocto-patches@lists.yoctoproject.org Cc: peter.marko@siemens.com, jose.quaresma@foundries.io Subject: [meta-lts-mixins][wrynose/go][PATCH 11/11] go-binary-native: upgrade 1.27.0 -> 1.27.1 Date: Mon, 14 Sep 2026 21:12:40 +0200 Message-ID: <20260914191240.1066469-11-peter.marko@siemens.com> In-Reply-To: <20260914191240.1066469-1-peter.marko@siemens.com> References: <20260914191240.1066469-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 14 Sep 2026 19:14:52 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/4838 From: Mathieu Dubois-Briand Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie Signed-off-by: Peter Marko (From OE-Core rev: 7443260986a9bb25c1a1c188fd3d1e78ccd0f445) Signed-off-by: Peter Marko --- ...o-binary-native_1.27.0.bb => go-binary-native_1.27.1.bb} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename recipes-devtools/go/{go-binary-native_1.27.0.bb => go-binary-native_1.27.1.bb} (80%) diff --git a/recipes-devtools/go/go-binary-native_1.27.0.bb b/recipes-devtools/go/go-binary-native_1.27.1.bb similarity index 80% rename from recipes-devtools/go/go-binary-native_1.27.0.bb rename to recipes-devtools/go/go-binary-native_1.27.1.bb index 0f6c3bc..f909581 100644 --- a/recipes-devtools/go/go-binary-native_1.27.0.bb +++ b/recipes-devtools/go/go-binary-native_1.27.1.bb @@ -9,9 +9,9 @@ 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] = "675c26c449cbb18fc24b74650de1eabbae6e16f64326fd85a283fb3b58280685" -SRC_URI[go_linux_arm64.sha256sum] = "51798d2c42d0e1c6ed7fd9f48728b4193abac9e8aad6dbac2fe96a81f5909bda" -SRC_URI[go_linux_ppc64le.sha256sum] = "068085e257a6014c036c723ca62943edbf48fd168b8d00a6d39527d10b656255" +SRC_URI[go_linux_amd64.sha256sum] = "63d339f0da5ab53635a56f2490a7984dfe12dfcff22ad749f63edaf590168445" +SRC_URI[go_linux_arm64.sha256sum] = "3450b45a3f9ee8568792736a5c5e70a1f2e9b36c35a8f74958c03e51d7d92bec" +SRC_URI[go_linux_ppc64le.sha256sum] = "ad1ff83c24f783c2d4a025852b928a05c199e8742a14a5482d88de0293d2bd0d" UPSTREAM_CHECK_URI = "https://golang.org/dl/" UPSTREAM_CHECK_REGEX = "go(?P\d+(\.\d+)+)\.linux"