summaryrefslogtreecommitdiffstats
path: root/src/cmd
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:22:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:22:03 +0000
commit52b4757d798fb3fa2072230515c3ca1e22635941 (patch)
tree359ed7901c3ea0075b5cbee1aad4f48eb8ee3a31 /src/cmd
parentAdding upstream version 1.21.8. (diff)
downloadgolang-1.21-52b4757d798fb3fa2072230515c3ca1e22635941.tar.xz
golang-1.21-52b4757d798fb3fa2072230515c3ca1e22635941.zip
Adding upstream version 1.21.9.upstream/1.21.9
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/compile/internal/types2/typeset.go11
-rw-r--r--src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt4
-rw-r--r--src/cmd/internal/moddeps/moddeps_test.go2
-rw-r--r--src/cmd/internal/obj/ppc64/obj9.go19
-rw-r--r--src/cmd/link/internal/ppc64/asm.go17
5 files changed, 30 insertions, 23 deletions
diff --git a/src/cmd/compile/internal/types2/typeset.go b/src/cmd/compile/internal/types2/typeset.go
index 8d33597..14039ac 100644
--- a/src/cmd/compile/internal/types2/typeset.go
+++ b/src/cmd/compile/internal/types2/typeset.go
@@ -255,9 +255,8 @@ func computeInterfaceTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *_
allTerms := allTermlist
allComparable := false
for i, typ := range ityp.embeddeds {
- // The embedding position is nil for imported interfaces
- // and also for interface copies after substitution (but
- // in that case we don't need to report errors again).
+ // The embedding position is nil for imported interfaces.
+ // We don't need to do version checks in those cases.
var pos syntax.Pos // embedding position
if ityp.embedPos != nil {
pos = (*ityp.embedPos)[i]
@@ -270,7 +269,7 @@ func computeInterfaceTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *_
assert(!isTypeParam(typ))
tset := computeInterfaceTypeSet(check, pos, u)
// If typ is local, an error was already reported where typ is specified/defined.
- if check != nil && check.isImportedConstraint(typ) && !check.verifyVersionf(pos, go1_18, "embedding constraint interface %s", typ) {
+ if pos.IsKnown() && check != nil && check.isImportedConstraint(typ) && !check.verifyVersionf(pos, go1_18, "embedding constraint interface %s", typ) {
continue
}
comparable = tset.comparable
@@ -279,7 +278,7 @@ func computeInterfaceTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *_
}
terms = tset.terms
case *Union:
- if check != nil && !check.verifyVersionf(pos, go1_18, "embedding interface element %s", u) {
+ if pos.IsKnown() && check != nil && !check.verifyVersionf(pos, go1_18, "embedding interface element %s", u) {
continue
}
tset := computeUnionTypeSet(check, unionSets, pos, u)
@@ -293,7 +292,7 @@ func computeInterfaceTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *_
if u == Typ[Invalid] {
continue
}
- if check != nil && !check.verifyVersionf(pos, go1_18, "embedding non-interface type %s", typ) {
+ if pos.IsKnown() && check != nil && !check.verifyVersionf(pos, go1_18, "embedding non-interface type %s", typ) {
continue
}
terms = termlist{{false, typ}}
diff --git a/src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt b/src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt
index 735b5dc..d789f89 100644
--- a/src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt
+++ b/src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt
@@ -14,6 +14,10 @@ go build -ldflags='-linkmode=internal'
exec ./abitest
stdout success
+go build -buildmode=pie -o abitest.pie -ldflags='-linkmode=internal'
+exec ./abitest.pie
+stdout success
+
-- go.mod --
module abitest
diff --git a/src/cmd/internal/moddeps/moddeps_test.go b/src/cmd/internal/moddeps/moddeps_test.go
index ae890b6..718e120 100644
--- a/src/cmd/internal/moddeps/moddeps_test.go
+++ b/src/cmd/internal/moddeps/moddeps_test.go
@@ -33,6 +33,8 @@ import (
// See issues 36852, 41409, and 43687.
// (Also see golang.org/issue/27348.)
func TestAllDependencies(t *testing.T) {
+ t.Skip("TODO(#65051): 1.21.9 contains unreleased changes from vendored modules")
+
goBin := testenv.GoToolPath(t)
// Ensure that all packages imported within GOROOT
diff --git a/src/cmd/internal/obj/ppc64/obj9.go b/src/cmd/internal/obj/ppc64/obj9.go
index 02831b8..57660ce 100644
--- a/src/cmd/internal/obj/ppc64/obj9.go
+++ b/src/cmd/internal/obj/ppc64/obj9.go
@@ -36,8 +36,25 @@ import (
"cmd/internal/sys"
"internal/abi"
"log"
+ "strings"
)
+// Is this a symbol which should never have a TOC prologue generated?
+// These are special functions which should not have a TOC regeneration
+// prologue.
+func isNOTOCfunc(name string) bool {
+ switch {
+ case name == "runtime.duffzero":
+ return true
+ case name == "runtime.duffcopy":
+ return true
+ case strings.HasPrefix(name, "runtime.elf_"):
+ return true
+ default:
+ return false
+ }
+}
+
func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) {
p.From.Class = 0
p.To.Class = 0
@@ -643,7 +660,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
q = p
- if NeedTOCpointer(c.ctxt) && c.cursym.Name != "runtime.duffzero" && c.cursym.Name != "runtime.duffcopy" {
+ if NeedTOCpointer(c.ctxt) && !isNOTOCfunc(c.cursym.Name) {
// When compiling Go into PIC, without PCrel support, all functions must start
// with instructions to load the TOC pointer into r2:
//
diff --git a/src/cmd/link/internal/ppc64/asm.go b/src/cmd/link/internal/ppc64/asm.go
index d537bc5..3def3e6 100644
--- a/src/cmd/link/internal/ppc64/asm.go
+++ b/src/cmd/link/internal/ppc64/asm.go
@@ -475,24 +475,9 @@ func rewriteABIFuncReloc(ctxt *ld.Link, ldr *loader.Loader, tname string, r load
r.SetAdd(int64((n - minReg) * offMul))
firstUse = !ldr.AttrReachable(ts)
if firstUse {
- ldr.SetAttrReachable(ts, true)
// This function only becomes reachable now. It has been dropped from
// the text section (it was unreachable until now), it needs included.
- //
- // Similarly, TOC regeneration should not happen for these functions,
- // remove it from this save/restore function.
- if ldr.AttrShared(ts) {
- sb := ldr.MakeSymbolUpdater(ts)
- sb.SetData(sb.Data()[8:])
- sb.SetSize(sb.Size() - 8)
- relocs := sb.Relocs()
- // Only one PCREL reloc to .TOC. should be present.
- if relocs.Count() != 1 {
- log.Fatalf("Unexpected number of relocs in %s\n", ldr.SymName(ts))
- }
- sb.ResetRelocs()
-
- }
+ ldr.SetAttrReachable(ts, true)
}
return ts, firstUse
}