From 386b991030184ea7dc10b160769c1ae6e81fe94d Mon Sep 17 00:00:00 2001 From: Anton Schubert Date: Wed, 11 Mar 2026 12:12:03 +0100 Subject: [PATCH] dev-lang/go: new package, add 1.25.8 --- dev-lang/go/Manifest | 8 ++ .../files/go-1.24-dont-force-gold-arm.patch | 55 +++++++ .../go/files/go-1.24-skip-gdb-tests.patch | 12 ++ dev-lang/go/files/go-1.25-no-dwarf5.patch | 15 ++ .../files/go-1.25-strip-top-level-const.patch | 94 ++++++++++++ .../go-never-download-newer-toolchains.patch | 13 ++ dev-lang/go/go-1.25.8.ebuild | 135 ++++++++++++++++++ dev-lang/go/metadata.xml | 17 +++ 8 files changed, 349 insertions(+) create mode 100644 dev-lang/go/Manifest create mode 100644 dev-lang/go/files/go-1.24-dont-force-gold-arm.patch create mode 100644 dev-lang/go/files/go-1.24-skip-gdb-tests.patch create mode 100644 dev-lang/go/files/go-1.25-no-dwarf5.patch create mode 100644 dev-lang/go/files/go-1.25-strip-top-level-const.patch create mode 100644 dev-lang/go/files/go-never-download-newer-toolchains.patch create mode 100644 dev-lang/go/go-1.25.8.ebuild create mode 100644 dev-lang/go/metadata.xml diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest new file mode 100644 index 0000000..b82ab22 --- /dev/null +++ b/dev-lang/go/Manifest @@ -0,0 +1,8 @@ +AUX go-1.24-dont-force-gold-arm.patch 2151 BLAKE2B 1a2a16464d0fffdd78b195346cb7e8ddd9077c2e2e8472a8ca16de3c3b8468c4662f68398ada29463cc6b83869a8cdcab0f8ef0d0807fecf3f03bcc4becba03e SHA512 75eb534c214e9ba2ed7667d04c8007131b34dbae8b6e3e6ad0b8b7fe9ccee90fdb1c3bafe2f7e2bdd3270dc4a1cf3bcac789b03625f0eead9b51ce471bd294eb +AUX go-1.24-skip-gdb-tests.patch 408 BLAKE2B 062d5ee7bda4e4891a3098e4a9328136b128ac029cf4613d13dcc062a0af03d687f67a4c35bd3b130aad6af8661371b48408df471760eceb76d4e757a60189c2 SHA512 311e45c7fa8f0c32f7c2b3cd017af126a1781fbfddc5d62c5fbd6a2f2b4bc9f9d7492a6ba231bd97806821b1c75b0e096e1e7e526ea9c2d8bbe6108e5a907ca2 +AUX go-1.25-no-dwarf5.patch 533 BLAKE2B 80045f28f75ba924626b87ae952f00c9efda36f1c1d76b6d1a58ce410a8abd6f799d3bcb6815ae484ba9a87f3c3f287de8b603918f85842972d3a811f78db067 SHA512 5371f9853fd220ad2bfc07b25847016996d0b46e07f5e43a2a257d4fc1f123bfdb15ea5b7c879e26a36b7d20639385cb3afb693985b750b1e81c022726dc705c +AUX go-1.25-strip-top-level-const.patch 2808 BLAKE2B cd47888a8d26db5d72d6be0c2ce052ef3ef452e948af61487aa3a599880de2fecb52e388c1be33f4ca20d27f61254967826937c29240bbaa5ea7456d360c696c SHA512 6fd08437ce8717f61ee1b4151bcad0f5f2160dfd405ebcc49147b76d87341958643e773d2c05dbae8e17c02b0a48441e9bd6a86df326d480d94cb9c8f06b472f +AUX go-never-download-newer-toolchains.patch 368 BLAKE2B 0c90f46492af80622f430b2d506b143f3b553b5276085f78f41b93fee8219745179038302462603b5b1677554d92911eb4865084d0488aaa4c71ae1abc307f71 SHA512 b5acf97ccf96c6a353fcb7bd97113c38562defd82338828124fcc72c71334feda9c4e839d2aae5b66b809bc8a692eac96396c54a478e17a7ffd8d2c68fea95e6 +DIST go1.25.8.src.tar.gz 31991986 BLAKE2B c8a18a74a8903e53954bcc39ce804518e94bd6b2ee0b8a0cc4b5cd87f5d1760d6b1235233d2bf2804e3ec55a42cf6f5345a6fe4382e7406483915101ca107c97 SHA512 2f5c9f314d18169985a9a4b19346e00dd5d4b396c8c17bfffe5719e51f27d834cc9649d0165f7eeb7367d3b6d384f49917325a40b49ba4da65e22f2c5362c739 +EBUILD go-1.25.8.ebuild 3471 BLAKE2B 2fc35df597cb7dc6f34364e3e4499be219b0dfa6fdf389de6b6b12a35418aa85cfc51f2d644f7416fd481e5cecfa5be368f2bce3e041f13a4afbc614f0901ac8 SHA512 562b68c217c999a24391edd00d7ed89f64904bfb8d01d53162da767f23d7be0d4a6e98ac6517ffd7d2c10914b6d80589e214e9d41fcb70ebe91dc95128a4bf46 +MISC metadata.xml 589 BLAKE2B 341e4c0e91d73ca668c1795035e1223eed60f85c724afd989ef1f8fb69649f7f6eaaf8a5228f6c8f587ffcc40a438c47d332fbe6866839f5a0829872a983f642 SHA512 fe58ddddfbd4d0d060516cb035592a80c0f48e125bb59c95d3c6fac0c182271e2a9ec9bd055b9cc8e6cb8c449e6c483bff4a23c362f532c24255febfdefc273a diff --git a/dev-lang/go/files/go-1.24-dont-force-gold-arm.patch b/dev-lang/go/files/go-1.24-dont-force-gold-arm.patch new file mode 100644 index 0000000..4869b38 --- /dev/null +++ b/dev-lang/go/files/go-1.24-dont-force-gold-arm.patch @@ -0,0 +1,55 @@ +Don't default to -fuse-ld=gold on arm64. The gold linker is deprecated in +GNU Binutils and the referenced bfd bug which led to this default being +added is long-fixed. + +https://src.fedoraproject.org/rpms/golang/raw/rawhide/f/0006-Default-to-ld.bfd-on-ARM64.patch +https://bugs.gentoo.org/893956 +https://github.com/golang/go/issues/22040 +https://github.com/golang/go/pull/49748 +https://sourceware.org/PR19962 + +From 46ec67413008607e2150e3395668e54e538c5b6b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= +Date: Wed, 19 Jun 2024 10:18:58 +0200 +Subject: [PATCH] Default to ld.bfd on ARM64 + +--- + src/cmd/link/internal/ld/lib.go | 20 +++++++------------- + 1 file changed, 7 insertions(+), 13 deletions(-) + +diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go +index eab74dc328..b401f58727 100644 +--- a/src/cmd/link/internal/ld/lib.go ++++ b/src/cmd/link/internal/ld/lib.go +@@ -1620,22 +1620,16 @@ func (ctxt *Link) hostlink() { + } + + if ctxt.Arch.InFamily(sys.ARM64) && buildcfg.GOOS == "linux" { +- // On ARM64, the GNU linker will fail with +- // -znocopyreloc if it thinks a COPY relocation is +- // required. Switch to gold. +- // https://sourceware.org/bugzilla/show_bug.cgi?id=19962 +- // https://go.dev/issue/22040 +- altLinker = "gold" +- +- // If gold is not installed, gcc will silently switch +- // back to ld.bfd. So we parse the version information +- // and provide a useful error if gold is missing. ++ // Use ld.bfd as the default linker ++ altLinker = "bfd" ++ ++ // Provide a useful error if ld.bfd is missing + name, args := flagExtld[0], flagExtld[1:] +- args = append(args, "-fuse-ld=gold", "-Wl,--version") ++ args = append(args, "-fuse-ld=bfd", "-Wl,--version") + cmd := exec.Command(name, args...) + if out, err := cmd.CombinedOutput(); err == nil { +- if !bytes.Contains(out, []byte("GNU gold")) { +- log.Fatalf("ARM64 external linker must be gold (issue #15696, 22040), but is not: %s", out) ++ if !bytes.Contains(out, []byte("GNU ld")) { ++ log.Fatalf("ARM64 external linker must be ld.bfd, but is not: %s", out) + } + } + } +-- +2.45.1 diff --git a/dev-lang/go/files/go-1.24-skip-gdb-tests.patch b/dev-lang/go/files/go-1.24-skip-gdb-tests.patch new file mode 100644 index 0000000..4984835 --- /dev/null +++ b/dev-lang/go/files/go-1.24-skip-gdb-tests.patch @@ -0,0 +1,12 @@ +diff --git a/src/runtime/runtime-gdb_test.go b/src/runtime/runtime-gdb_test.go +index 9c54d68949..d4eada51af 100644 +--- a/src/runtime/runtime-gdb_test.go ++++ b/src/runtime/runtime-gdb_test.go +@@ -55,6 +55,7 @@ func checkGdbEnvironment(t *testing.T) { + case "plan9": + t.Skip("there is no gdb on Plan 9") + } ++ t.Skip("gdb tests do not work under gentoo portage") + } + + func checkGdbVersion(t *testing.T) { diff --git a/dev-lang/go/files/go-1.25-no-dwarf5.patch b/dev-lang/go/files/go-1.25-no-dwarf5.patch new file mode 100644 index 0000000..72c2bab --- /dev/null +++ b/dev-lang/go/files/go-1.25-no-dwarf5.patch @@ -0,0 +1,15 @@ +diff --git a/go.env b/go.env +index 6ff2b921d4..e8959a72c7 100644 +--- a/go.env ++++ b/go.env +@@ -2,6 +2,10 @@ + # Values set by 'go env -w' and written to the user's go/env file override these. + # The environment overrides everything else. + ++#This can be removed when debugedit is fixed to support dwarf5 ++# https://sourceware.org/bugzilla/show_bug.cgi?id=33204 ++GOEXPERIMENT=nodwarf5 ++ + # Use the Go module mirror and checksum database by default. + # See https://proxy.golang.org for details. + GOPROXY=https://proxy.golang.org,direct diff --git a/dev-lang/go/files/go-1.25-strip-top-level-const.patch b/dev-lang/go/files/go-1.25-strip-top-level-const.patch new file mode 100644 index 0000000..1531263 --- /dev/null +++ b/dev-lang/go/files/go-1.25-strip-top-level-const.patch @@ -0,0 +1,94 @@ +From 7a6e3f07acfd822aa1d62f1c715125e30d67d089 Mon Sep 17 00:00:00 2001 +From: Ian Lance Taylor +Date: Mon, 03 Nov 2025 15:54:39 -0800 +Subject: [PATCH] cmd/cgo: strip top-level const qualifier from argument frame struct + +Otherwise we can't assign to it. + +Fixes #75751 + +Change-Id: Iba680db672297bca1a1d1a33912b80863da66a08 +--- + +diff --git a/src/cmd/cgo/internal/test/test.go b/src/cmd/cgo/internal/test/test.go +index 9626407..e83e367 100644 +--- a/src/cmd/cgo/internal/test/test.go ++++ b/src/cmd/cgo/internal/test/test.go +@@ -953,6 +953,12 @@ + } issue69086struct; + static int issue690861(issue69086struct* p) { p->b = 1234; return p->c; } + static int issue690862(unsigned long ul1, unsigned long ul2, unsigned int u, issue69086struct s) { return (int)(s.b); } ++ ++char issue75751v = 1; ++char * const issue75751p = &issue75751v; ++#define issue75751m issue75751p ++char * const volatile issue75751p2 = &issue75751v; ++#define issue75751m2 issue75751p2 + */ + import "C" + +@@ -2396,3 +2402,8 @@ + t.Errorf("call: got %d, want 1234", got) + } + } ++ ++// Issue 75751: no runtime test, just make sure it compiles. ++func test75751() int { ++ return int(*C.issue75751m) + int(*C.issue75751m2) ++} +diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go +index 394e766..05d9dcf 100644 +--- a/src/cmd/cgo/out.go ++++ b/src/cmd/cgo/out.go +@@ -457,6 +457,33 @@ + // Also assumes that gc convention is to word-align the + // input and output parameters. + func (p *Package) structType(n *Name) (string, int64) { ++ // It's possible for us to see a type with a top-level const here, ++ // which will give us an unusable struct type. See #75751. ++ // The top-level const will always appear as a final qualifier, ++ // constructed by typeConv.loadType in the dwarf.QualType case. ++ // The top-level const is meaningless here and can simply be removed. ++ stripConst := func(s string) string { ++ i := strings.LastIndex(s, "const") ++ if i == -1 { ++ return s ++ } ++ ++ // A top-level const can only be followed by other qualifiers. ++ if r, ok := strings.CutSuffix(s, "const"); ok { ++ return r ++ } ++ ++ for _, f := range strings.Fields(s[i:]) { ++ switch f { ++ case "const", "restrict", "volatile": ++ default: ++ return s ++ } ++ } ++ ++ return strings.TrimSpace(s[:i]) + strings.TrimSpace(s[i+len("const"):]) ++ } ++ + var buf strings.Builder + fmt.Fprint(&buf, "struct {\n") + off := int64(0) +@@ -468,7 +495,7 @@ + } + c := t.Typedef + if c == "" { +- c = t.C.String() ++ c = stripConst(t.C.String()) + } + fmt.Fprintf(&buf, "\t\t%s p%d;\n", c, i) + off += t.Size +@@ -484,7 +511,7 @@ + fmt.Fprintf(&buf, "\t\tchar __pad%d[%d];\n", off, pad) + off += pad + } +- fmt.Fprintf(&buf, "\t\t%s r;\n", t.C) ++ fmt.Fprintf(&buf, "\t\t%s r;\n", stripConst(t.C.String())) + off += t.Size + } + if off%p.PtrSize != 0 { diff --git a/dev-lang/go/files/go-never-download-newer-toolchains.patch b/dev-lang/go/files/go-never-download-newer-toolchains.patch new file mode 100644 index 0000000..74e85f8 --- /dev/null +++ b/dev-lang/go/files/go-never-download-newer-toolchains.patch @@ -0,0 +1,13 @@ +diff --git a/go.env b/go.env +index 6ff2b921d4..1112a19c9b 100644 +--- a/go.env ++++ b/go.env +@@ -7,6 +7,6 @@ + GOPROXY=https://proxy.golang.org,direct + GOSUMDB=sum.golang.org + +-# Automatically download newer toolchains as directed by go.mod files. ++# Never download newer toolchains. + # See https://go.dev/doc/toolchain for details. +-GOTOOLCHAIN=auto ++GOTOOLCHAIN=local diff --git a/dev-lang/go/go-1.25.8.ebuild b/dev-lang/go/go-1.25.8.ebuild new file mode 100644 index 0000000..8655037 --- /dev/null +++ b/dev-lang/go/go-1.25.8.ebuild @@ -0,0 +1,135 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +export CBUILD=${CBUILD:-${CHOST}} +export CTARGET=${CTARGET:-${CHOST}} + +# See "Bootstrap" in release notes +GO_BOOTSTRAP_MIN=1.22.12 +MY_PV=${PV/_/} + +inherit go-env toolchain-funcs + +case ${PV} in +*9999*) + EGIT_REPO_URI="https://github.com/golang/go.git" + inherit git-r3 + ;; +*) + SRC_URI="https://go.dev/dl/go${MY_PV}.src.tar.gz " + S="${WORKDIR}"/go + KEYWORDS="-* ~amd64 ~arm ~arm64 ~loong ~mips ~ppc64 ~riscv ~s390 ~x86 ~x64-macos ~x64-solaris" + ;; +esac + +DESCRIPTION="A concurrent garbage collected and typesafe programming language" +HOMEPAGE="https://go.dev" + +LICENSE="BSD" +SLOT="0/${PV}" +IUSE="cpu_flags_x86_sse2" + +BDEPEND="|| ( + >=dev-lang/go-${GO_BOOTSTRAP_MIN} + >=dev-lang/go-bootstrap-${GO_BOOTSTRAP_MIN} )" + +# the *.syso files have writable/executable stacks +QA_EXECSTACK='*.syso' + +# Do not complain about CFLAGS, etc, since Go doesn't use them. +QA_FLAGS_IGNORED='.*' + +# The tools in /usr/lib/go should not cause the multilib-strict check to fail. +QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*" + +# This package triggers "unrecognized elf file(s)" notices on riscv. +# https://bugs.gentoo.org/794046 +QA_PREBUILT="*" +QA_PRESTRIPPED="*.syso" + +# The Go data race detector (go test -race) requires an unstripped Go toolchain. +# https://bugs.gentoo.org/961618 +RESTRICT="strip" + +DOCS=( + CONTRIBUTING.md + PATENTS + README.md + SECURITY.md +) + +go_tuple() { + echo "$(go-env_goos $@)_$(go-env_goarch $@)" +} + +go_cross_compile() { + [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]] +} + +PATCHES=( + "${FILESDIR}"/go-1.24-skip-gdb-tests.patch + "${FILESDIR}"/go-1.24-dont-force-gold-arm.patch + "${FILESDIR}"/go-1.25-no-dwarf5.patch + "${FILESDIR}"/go-1.25-strip-top-level-const.patch + "${FILESDIR}"/go-never-download-newer-toolchains.patch +) + +src_compile() { + if has_version -b ">=dev-lang/go-${GO_BOOTSTRAP_MIN}"; then + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go" + elif has_version -b ">=dev-lang/go-bootstrap-${GO_BOOTSTRAP_MIN}"; then + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go-bootstrap" + else + eerror "Go cannot be built without go or go-bootstrap installed" + die "Should not be here, please report a bug" + fi + + # Go's build script does not use BUILD/HOST/TARGET consistently. :( + export GOHOSTARCH=$(go-env_goarch ${CBUILD}) + export GOHOSTOS=$(go-env_goos ${CBUILD}) + export CC=$(tc-getBUILD_CC) + + export GOARCH=$(go-env_goarch) + export GOOS=$(go-env_goos) + export CC_FOR_TARGET=$(tc-getCC) + export CXX_FOR_TARGET=$(tc-getCXX) + use arm && export GOARM=$(go-env_goarm) + use x86 && export GO386=$(go-env_go386) + + cd src + bash -x ./make.bash || die "build failed" +} + +src_test() { + go_cross_compile && return 0 + cd src + PATH="${GOBIN}:${PATH}" \ + ./run.bash -no-rebuild -k || die "tests failed" +} + +src_install() { + dodir /usr/lib/go + # The use of cp is deliberate in order to retain permissions + cp -R . "${ED}"/usr/lib/go + einstalldocs + + # testdata directories are not needed on the installed system + # The other files we remove are installed by einstalldocs + rm -r $(find "${ED}"/usr/lib/go -iname testdata -type d -print) || die + rm "${ED}"/usr/lib/go/{CONTRIBUTING.md,PATENTS,README.md} || die + rm "${ED}"/usr/lib/go/{SECURITY.md,codereview.cfg,LICENSE} || die + + local bin_path + if go_cross_compile; then + bin_path="bin/$(go_tuple)" + else + bin_path=bin + fi + local f x + for x in ${bin_path}/*; do + f=${x##*/} + dosym ../lib/go/${bin_path}/${f} /usr/bin/${f} + done +} diff --git a/dev-lang/go/metadata.xml b/dev-lang/go/metadata.xml new file mode 100644 index 0000000..5e00214 --- /dev/null +++ b/dev-lang/go/metadata.xml @@ -0,0 +1,17 @@ + + + + + williamh@gentoo.org + William Hubbs + + + Go is a new systems programming language developed at google by + Rob Pike. It has garbage collection, coroutines, communication + channels and a clean syntax. + + + cpe:/a:golang:go + golang/go + +