Skip to content

Commit d7553d9

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Than McIntosh <[email protected]>
1 parent 84152d5 commit d7553d9

File tree

1 file changed

+2
-0
lines changed
  • src/cmd/link/internal/ld

1 file changed

+2
-0
lines changed

src/cmd/link/internal/ld/lib.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ const AfterLoadlibFull = 2
157157
func (ctxt *Link) mkArchSym(which int, name string, ver int, ls *loader.Sym, ss **sym.Symbol) {
158158
if which == BeforeLoadlibFull {
159159
*ls = ctxt.loader.LookupOrCreateSym(name, ver)
160+
ctxt.loader.SetAttrReachable(*ls, true)
160161
} else {
161162
*ss = ctxt.loader.Syms[*ls]
162163
}
@@ -167,6 +168,7 @@ func (ctxt *Link) mkArchSym(which int, name string, ver int, ls *loader.Sym, ss
167168
func (ctxt *Link) mkArchSymVec(which int, name string, ver int, ls []loader.Sym, ss []*sym.Symbol) {
168169
if which == BeforeLoadlibFull {
169170
ls[ver] = ctxt.loader.LookupOrCreateSym(name, ver)
171+
ctxt.loader.SetAttrReachable(ls[ver], true)
170172
} else if ls[ver] != 0 {
171173
ss[ver] = ctxt.loader.Syms[ls[ver]]
172174
}

0 commit comments

Comments
 (0)