[dev-lang/go] temp add to build vendor tarballs

This commit is contained in:
2026-02-13 04:41:45 +01:00
parent 6697cba505
commit a07db66df5
9 changed files with 476 additions and 0 deletions

2
dev-lang/go/Manifest Normal file
View File

@@ -0,0 +1,2 @@
DIST go1.24.13.src.tar.gz 30802752 BLAKE2B 6aa0121c5aa7cceb78342cc36f15149968792b1eaaff387edd9ca2876eecd09986daa850afa4b18807afa3bef5dd6257f3fd49be6c82056a02f689c779c54ba7 SHA512 049de4ea4be669853b2c567f1d93a4e0607815ebb57c2ca0c4802134a3613ef489b77434c83ab01e2a257b3eb4ee651b167b98ffb84d38b957d62ae933ebb243
DIST go1.25.7.src.tar.gz 31990868 BLAKE2B bf643197964eb9e35f791d84fd9ed71b0de4c31629a4645c3fb4e05d7aec8a3241d594a035a8dbb6254fddd0bcc1e760c0a884ae2616ed54f5daf397b52c62fb SHA512 054fdb8219d18a7942c524d8acc3c942d0a7b8f1c01b96184fa79017b6548533798f5f48cc78f7ecfb70da504c5c66569377a35d517a0e3184c32fe84c9ee0b6

View File

@@ -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?= <asm@redhat.com>
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

View File

@@ -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) {

View File

@@ -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

View File

@@ -0,0 +1,94 @@
From 7a6e3f07acfd822aa1d62f1c715125e30d67d089 Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor <iant@golang.org>
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 {

View File

@@ -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

View File

@@ -0,0 +1,133 @@
# 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-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
}

View File

@@ -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
}

17
dev-lang/go/metadata.xml Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>williamh@gentoo.org</email>
<name>William Hubbs</name>
</maintainer>
<longdescription lang="en">
Go is a new systems programming language developed at google by
Rob Pike. It has garbage collection, coroutines, communication
channels and a clean syntax.
</longdescription>
<upstream>
<remote-id type="cpe">cpe:/a:golang:go</remote-id>
<remote-id type="github">golang/go</remote-id>
</upstream>
</pkgmetadata>