1
0
mirror of https://github.com/golang/go synced 2024-11-19 15:54:46 -07:00

cmd/link: replace SCONTAINER with an attribute bit

This is much easier than replacing SSUB so split it out from my other CL.

Change-Id: If01e4005da5355895404456320a2156bde4ec09a
Reviewed-on: https://go-review.googlesource.com/71050
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Michael Hudson-Doyle 2017-10-16 14:20:01 +13:00
parent 1341104ae2
commit 302f0d1646
3 changed files with 10 additions and 7 deletions

View File

@ -181,8 +181,8 @@ func emitPcln(ctxt *Link, s *sym.Symbol) bool {
}
// 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
}
@ -213,10 +213,10 @@ func (ctxt *Link) pclntab() {
// 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
}
}

View File

@ -5,7 +5,7 @@
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
@ -57,7 +57,10 @@ const (
// 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 }
@ -75,6 +78,7 @@ func (a Attribute) ReflectMethod() bool { return a&AttrReflectMethod != 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()

View File

@ -107,7 +107,6 @@ const (
SDWARFLOC
SSUB = SymKind(1 << 8)
SMASK = SymKind(SSUB - 1)
SCONTAINER = SymKind(1 << 10) // has a sub-symbol
)
// AbiSymKindToSymKind maps values read from object files (which are