aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2021-09-30 11:46:00 -0400
committerCherry Mui <cherryyz@google.com>2021-10-01 14:06:36 +0000
commit96d3ba868aae7aa043147f18e0ca299ada4e34b7 (patch)
treee3ffb90973ca24d4d79102c455e4d5469f541928 /src/cmd/link
parent8ac5cbe05d61df0a7a7c9a38ff33305d4dcfea32 (diff)
downloadgo-96d3ba868aae7aa043147f18e0ca299ada4e34b7.tar.xz
cmd/link: reduce alignment for some funcdata symbols
Funcdata like opendefer info and traceback arginfo are varints or bytes. There is no need to align them. GC liveness map and inline tree have 32-bit fields, so continue align them to 4 bytes. Change-Id: I9d5dd750a926c65a910efe5817f9f5c473019bc6 Reviewed-on: https://go-review.googlesource.com/c/go/+/353469 Trust: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/link')
-rw-r--r--src/cmd/link/internal/ld/symtab.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cmd/link/internal/ld/symtab.go b/src/cmd/link/internal/ld/symtab.go
index 8dec78e017..76cca41d25 100644
--- a/src/cmd/link/internal/ld/symtab.go
+++ b/src/cmd/link/internal/ld/symtab.go
@@ -537,6 +537,7 @@ func (ctxt *Link) symtab(pcln *pclntab) []sym.SymKind {
continue
}
+ align := int32(1)
name := ldr.SymName(s)
switch {
case strings.HasPrefix(name, "go.importpath.") && ctxt.UseRelro():
@@ -571,14 +572,17 @@ func (ctxt *Link) symtab(pcln *pclntab) []sym.SymKind {
case strings.HasPrefix(name, "gcargs."),
strings.HasPrefix(name, "gclocals."),
strings.HasPrefix(name, "gclocals·"),
- ldr.SymType(s) == sym.SGOFUNC && s != symgofunc,
- strings.HasSuffix(name, ".opendefer"),
+ ldr.SymType(s) == sym.SGOFUNC && s != symgofunc: // inltree, see pcln.go
+ // GC stack maps and inltrees have 32-bit fields.
+ align = 4
+ fallthrough
+ case strings.HasSuffix(name, ".opendefer"),
strings.HasSuffix(name, ".arginfo0"),
strings.HasSuffix(name, ".arginfo1"):
+ // These are just bytes, or varints, use align 1 (set before the switch).
symGroupType[s] = sym.SGOFUNC
ldr.SetAttrNotInSymbolTable(s, true)
ldr.SetCarrierSym(s, symgofunc)
- align := int32(4)
if a := ldr.SymAlign(s); a < align {
ldr.SetSymAlign(s, align)
} else {