diff options
| author | Cherry Mui <cherryyz@google.com> | 2026-03-17 11:18:36 -0400 |
|---|---|---|
| committer | Cherry Mui <cherryyz@google.com> | 2026-03-19 17:44:50 -0700 |
| commit | 0520d3f35287d5363941b466df6dd2e134620d09 (patch) | |
| tree | da5f430fca49fcea3ae62ad8f6e39847dad6519c /src/cmd | |
| parent | 30bfe53dd7485e211247a6d5c2f29a6aea0719a9 (diff) | |
| download | go-0520d3f35287d5363941b466df6dd2e134620d09.tar.xz | |
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.
Fixes #77593.
(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>
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/link/internal/arm64/asm.go | 7 |
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 fc5dbac1a0..9864788e1b 100644 --- a/src/cmd/link/internal/arm64/asm.go +++ b/src/cmd/link/internal/arm64/asm.go @@ -1284,6 +1284,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)) @@ -1326,6 +1329,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 |
