mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/objabi, cmd/link: move linker-only symkind values into linker
Many (most!) of the values of objapi.SymKind are used only in the linker, so this creates a separate cmd/link/internal/ld.SymKind type, removes most values from SymKind and maps one to the other when reading object files in the linker. Two of the remaining objapi.SymKind values are only checked for, never set and so will never be actually found but I wanted to keep this to the most mechanical change possible. Change-Id: I4bbc5aed6713cab3e8de732e6e288eb77be0474c Reviewed-on: https://go-review.googlesource.com/40985 Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
b1868cf107
commit
be2ee2a4b4
31 changed files with 642 additions and 549 deletions
|
|
@ -111,10 +111,10 @@ func ftabaddstring(ctxt *Link, ftab *Symbol, s string) int32 {
|
|||
|
||||
// numberfile assigns a file number to the file if it hasn't been assigned already.
|
||||
func numberfile(ctxt *Link, file *Symbol) {
|
||||
if file.Type != objabi.SFILEPATH {
|
||||
if file.Type != SFILEPATH {
|
||||
ctxt.Filesyms = append(ctxt.Filesyms, file)
|
||||
file.Value = int64(len(ctxt.Filesyms))
|
||||
file.Type = objabi.SFILEPATH
|
||||
file.Type = SFILEPATH
|
||||
path := file.Name[len(src.FileSymPrefix):]
|
||||
file.Name = expandGoroot(path)
|
||||
}
|
||||
|
|
@ -180,7 +180,7 @@ func container(s *Symbol) int {
|
|||
}
|
||||
// We want to generate func table entries only for the "lowest level" symbols,
|
||||
// not containers of subsymbols.
|
||||
if s.Type&objabi.SCONTAINER != 0 {
|
||||
if s.Type&SCONTAINER != 0 {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
|
|
@ -201,7 +201,7 @@ var pclntabLastFunc *Symbol
|
|||
func (ctxt *Link) pclntab() {
|
||||
funcdataBytes := int64(0)
|
||||
ftab := ctxt.Syms.Lookup("runtime.pclntab", 0)
|
||||
ftab.Type = objabi.SPCLNTAB
|
||||
ftab.Type = SPCLNTAB
|
||||
ftab.Attr |= AttrReachable
|
||||
|
||||
// See golang.org/s/go12symtab for the format. Briefly:
|
||||
|
|
@ -215,7 +215,7 @@ func (ctxt *Link) pclntab() {
|
|||
// Find container symbols, mark them with SCONTAINER
|
||||
for _, s := range ctxt.Textp {
|
||||
if s.Outer != nil {
|
||||
s.Outer.Type |= objabi.SCONTAINER
|
||||
s.Outer.Type |= SCONTAINER
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -334,7 +334,7 @@ func (ctxt *Link) pclntab() {
|
|||
|
||||
if len(pcln.InlTree) > 0 {
|
||||
inlTreeSym := ctxt.Syms.Lookup("inltree."+s.Name, 0)
|
||||
inlTreeSym.Type = objabi.SRODATA
|
||||
inlTreeSym.Type = SRODATA
|
||||
inlTreeSym.Attr |= AttrReachable | AttrDuplicateOK
|
||||
|
||||
for i, call := range pcln.InlTree {
|
||||
|
|
@ -443,7 +443,7 @@ const (
|
|||
// function for a pc. See src/runtime/symtab.go:findfunc for details.
|
||||
func (ctxt *Link) findfunctab() {
|
||||
t := ctxt.Syms.Lookup("runtime.findfunctab", 0)
|
||||
t.Type = objabi.SRODATA
|
||||
t.Type = SRODATA
|
||||
t.Attr |= AttrReachable
|
||||
t.Attr |= AttrLocal
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue