[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

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