}
// We want to generate func table entries only for the "lowest level" symbols,
// not containers of subsymbols.
- if s.Type&sym.SCONTAINER != 0 {
- return false
+ if s.Attr.Container() {
+ return true
}
return true
}
// offset to file table [4 bytes]
nfunc := int32(0)
- // Find container symbols, mark them with sym.SCONTAINER
+ // Find container symbols and mark them as such.
for _, s := range ctxt.Textp {
if s.Outer != nil {
- s.Outer.Type |= sym.SCONTAINER
+ s.Outer.Attr |= sym.AttrContainer
}
}
package sym
// Attribute is a set of common symbol attributes.
-type Attribute int16
+type Attribute uint16
const (
// AttrDuplicateOK marks a symbol that can be present in multiple object
// the final executable. Only relevant when internally linking
// on an ELF platform.
AttrVisibilityHidden
- // 15 attributes defined so far.
+ // AttrContainer is set on text symbols that are present as the .Outer for some
+ // other symbol.
+ AttrContainer
+ // 16 attributes defined so far.
)
func (a Attribute) DuplicateOK() bool { return a&AttrDuplicateOK != 0 }
func (a Attribute) MakeTypelink() bool { return a&AttrMakeTypelink != 0 }
func (a Attribute) Shared() bool { return a&AttrShared != 0 }
func (a Attribute) VisibilityHidden() bool { return a&AttrVisibilityHidden != 0 }
+func (a Attribute) Container() bool { return a&AttrContainer != 0 }
func (a Attribute) CgoExport() bool {
return a.CgoExportDynamic() || a.CgoExportStatic()