]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: replace SCONTAINER with an attribute bit
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Mon, 16 Oct 2017 01:20:01 +0000 (14:20 +1300)
committerMichael Hudson-Doyle <michael.hudson@canonical.com>
Mon, 16 Oct 2017 06:40:37 +0000 (06:40 +0000)
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>
src/cmd/link/internal/ld/pcln.go
src/cmd/link/internal/sym/attribute.go
src/cmd/link/internal/sym/symkind.go

index b770366d2f992ae2705d6dfddceba71d8ee60204..6384c81d5c9eacbbd04c17a162d164f49c8cfec3 100644 (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
                }
        }
 
index 27b45eef32f9f8e18983ee2d0a2d4afae89515ef..1a14c932d5f15178f8ed3a353c4b999bab8d1ecc 100644 (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()
index a47fa041de06d892ac1886cddc7b47bccd575c73..4b92917846f7df1a99eeaf8036e727110452b090 100644 (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