}
if x := s.Func.StackObjects; x != nil {
attr := int16(obj.RODATA)
- if s.DuplicateOK() {
- attr |= obj.DUPOK
- }
ggloblsym(x, int32(len(x.P)), attr)
+ x.Set(obj.AttrStatic, true)
}
if x := s.Func.OpenCodedDeferInfo; x != nil {
ggloblsym(x, int32(len(x.P)), obj.RODATA|obj.DUPOK)
import (
"cmd/compile/internal/types"
+ "cmd/internal/obj"
"fmt"
)
// returned node for readonly nodes.
func staticname(t *types.Type) *Node {
// Don't use lookupN; it interns the resulting string, but these are all unique.
- n := newname(lookup(fmt.Sprintf(".stmp_%d", statuniqgen)))
+ n := newname(lookup(fmt.Sprintf("%s%d", obj.StaticNamePref, statuniqgen)))
statuniqgen++
addvar(n, t, PEXTERN)
return n
} else if flag&TLSBSS != 0 {
s.Type = objabi.STLSBSS
}
+ if strings.HasPrefix(s.Name, "\"\"."+StaticNamePref) {
+ s.Set(AttrStatic, true)
+ }
}
// EmitEntryLiveness generates PCDATA Progs after p to switch to the
return false
}
+// StaticNamePref is the prefix the front end applies to static temporary
+// variables. When turned into LSyms, these can be tagged as static so
+// as to avoid inserting them into the linker's name lookup tables.
+const StaticNamePref = ".stmp_"
+
type traverseFlag uint32
const (