aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2026-03-17 11:18:36 -0400
committerGopher Robot <gobot@golang.org>2026-03-26 09:52:52 -0700
commit608303dd6e06f54fd36d3283f66f4b3d2060156e (patch)
treec0dd22bd9923c3c1bbc0e8d3397e24597584ec68
parente27183eff891f052454f35f3c1029abf29c10e40 (diff)
downloadgo-608303dd6e06f54fd36d3283f66f4b3d2060156e.tar.xz
[release-branch.go1.26] cmd/link: skip special symbols for label symbol generation
Some special symbols, e.g. funcdata symbols, don't have a section set, because they are laid out as part of the top-level go:func.* symbol. Similarly, other non-top-level symbols are part of some top-level symbols. There is no relocation directly targetting those symbols, so there is no need to generate label symbols for them. Updates #77593. Fixes #78239. (No in-tree test as it needs a function with very large funcdata.) Change-Id: I4aac4d0438bd64ac60b9baa3c2c66bb11f03c404 Reviewed-on: https://go-review.googlesource.com/c/go/+/756060 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> (cherry picked from commit 0520d3f35287d5363941b466df6dd2e134620d09) Reviewed-on: https://go-review.googlesource.com/c/go/+/759180 Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
-rw-r--r--src/cmd/link/internal/arm64/asm.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cmd/link/internal/arm64/asm.go b/src/cmd/link/internal/arm64/asm.go
index 7c4546fb17..98645d1173 100644
--- a/src/cmd/link/internal/arm64/asm.go
+++ b/src/cmd/link/internal/arm64/asm.go
@@ -1281,6 +1281,9 @@ func gensymlate(ctxt *ld.Link, ldr *loader.Loader) {
// addLabelSyms adds "label" symbols at s+limit, s+2*limit, etc.
addLabelSyms := func(s loader.Sym, limit, sz int64) {
+ if ldr.SymSect(s) == nil {
+ log.Fatalf("gensymlate: symbol %s has no section (type=%v)", ldr.SymName(s), ldr.SymType(s))
+ }
v := ldr.SymValue(s)
for off := limit; off < sz; off += limit {
p := ldr.LookupOrCreateSym(offsetLabelName(ldr, s, off), ldr.SymVersion(s))
@@ -1332,6 +1335,10 @@ func gensymlate(ctxt *ld.Link, ldr *loader.Loader) {
if t >= sym.SDWARFSECT {
continue // no need to add label for DWARF symbols
}
+ if ldr.AttrSpecial(s) || !ldr.TopLevelSym(s) {
+ // no need to add label for special symbols and non-top-level symbols
+ continue
+ }
sz := ldr.SymSize(s)
if sz <= limit {
continue