diff --git a/src/cmd/internal/obj/plist.go b/src/cmd/internal/obj/plist.go index 9cf6a20bdb7..76c5a54fda7 100644 --- a/src/cmd/internal/obj/plist.go +++ b/src/cmd/internal/obj/plist.go @@ -183,16 +183,16 @@ func (ctxt *Link) InitTextSym(s *LSym, flag int, start src.XPos) { return } if s.Func() != nil { - ctxt.Diag("%s: symbol %s redeclared\n\t%s: other declaration of symbol %s", ctxt.PosTable.Pos(start), s.Name, ctxt.PosTable.Pos(s.Func().Text.Pos), s.Name) + ctxt.Diag("symbol %s redeclared at %s", s.Name, ctxt.PosTable.Pos(start)) return } s.NewFuncInfo() if s.OnList() { - ctxt.Diag("%s: symbol %s redeclared", ctxt.PosTable.Pos(start), s.Name) + ctxt.Diag("symbol %s redeclared at %s", s.Name, ctxt.PosTable.Pos(start)) return } if strings.HasPrefix(s.Name, `"".`) { - ctxt.Diag("%s: unqualified symbol name: %s", ctxt.PosTable.Pos(start), s.Name) + ctxt.Diag("unqualified symbol name %s at %s", s.Name, ctxt.PosTable.Pos(start)) } // startLine should be the same line number that would be displayed via diff --git a/test/fixedbugs/issue68962.go b/test/fixedbugs/issue68962.go new file mode 100644 index 00000000000..dfda7ced5e4 --- /dev/null +++ b/test/fixedbugs/issue68962.go @@ -0,0 +1,13 @@ +// compile + +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +package main + +import _ "unsafe" + +//go:linkname a main.c +func a() {} + +func c() {}