1
0
mirror of https://github.com/golang/go synced 2024-11-11 22:50:22 -07:00

cmd/link: mark special symbols reachable

The special symbols are linker-created symbols for special
purposes, therefore reachable (otherwise the linker won't create
them). Mark them so, so they get converted to sym.Symbols when we
convert to old symbol representation.

In particular, the failure for building shared library on PPC64
is due to .TOC. symbol not being converted to sym.Symbol, but
referenced in addmoduledata.

Change-Id: Iaf5d145ffa5d15122e86a6e6983514e56dd5d456
Reviewed-on: https://go-review.googlesource.com/c/go/+/240620
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Cherry Zhang 2020-06-30 18:41:24 -04:00
parent 84152d5769
commit d7553d9af9

View File

@ -157,6 +157,7 @@ const AfterLoadlibFull = 2
func (ctxt *Link) mkArchSym(which int, name string, ver int, ls *loader.Sym, ss **sym.Symbol) {
if which == BeforeLoadlibFull {
*ls = ctxt.loader.LookupOrCreateSym(name, ver)
ctxt.loader.SetAttrReachable(*ls, true)
} else {
*ss = ctxt.loader.Syms[*ls]
}
@ -167,6 +168,7 @@ func (ctxt *Link) mkArchSym(which int, name string, ver int, ls *loader.Sym, ss
func (ctxt *Link) mkArchSymVec(which int, name string, ver int, ls []loader.Sym, ss []*sym.Symbol) {
if which == BeforeLoadlibFull {
ls[ver] = ctxt.loader.LookupOrCreateSym(name, ver)
ctxt.loader.SetAttrReachable(ls[ver], true)
} else if ls[ver] != 0 {
ss[ver] = ctxt.loader.Syms[ls[ver]]
}