[dev.link] cmd/link: move the wavefront past addexport()

Reorganize the linker phase ordering so that addexport() runs before
loadlibfull. In previous CLs addexport() was changed to use loader
APIs but then copy back its work into sym.Symbol, so this change
removes the copying/shim code in question.

Change-Id: I17314a90007909e6242ee00e26393f3e4a02cf25
Reviewed-on: https://go-review.googlesource.com/c/go/+/226362
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Than McIntosh 2020-03-30 10:06:54 -04:00
parent 021bebe990
commit 84111acd35
3 changed files with 4 additions and 13 deletions

View File

@ -2393,8 +2393,6 @@ func elfadddynsym(target *Target, syms *ArchSyms, s *sym.Symbol) {
func elfadddynsym2(ldr *loader.Loader, target *Target, syms *ArchSyms, s loader.Sym) {
ldr.SetSymDynid(s, int32(Nelfsym))
// temporary until wafefront moves past addexport
ldr.Syms[s].Dynid = ldr.SymDynid(s)
Nelfsym++
d := ldr.MakeSymbolUpdater(syms.DynSym2)
name := ldr.SymExtname(s)

View File

@ -412,8 +412,6 @@ func (ctxt *Link) addexport() {
}
su := ctxt.loader.MakeSymbolUpdater(rs)
su.SetType(sym.SUNDEFEXT)
// temporary until the wavefront moves past addexport
ctxt.loader.Syms[rs].Type = sym.SUNDEFEXT
}
}
}
@ -431,11 +429,6 @@ func (ctxt *Link) addexport() {
for _, lib := range dynlib {
adddynlib(ctxt, lib)
}
// temporary until the wavefront moves past addexport:
// copy any changes to loader.Sym symbols back into the sym.Symbol world.
modified := []loader.Sym{ctxt.DynSym2, ctxt.Dynamic2, ctxt.DynStr2}
ctxt.loader.PropagateLoaderChangesToSymbols(modified, 0)
}
type Pkg struct {

View File

@ -281,14 +281,14 @@ func Main(arch *sys.Arch, theArch Arch) {
bench.Start("textbuildid")
ctxt.textbuildid()
bench.Start("loadlibfull")
bench.Start("addexport")
setupdynexp(ctxt)
ctxt.setArchSyms(BeforeLoadlibFull)
ctxt.addexport()
bench.Start("loadlibfull")
ctxt.loadlibfull() // XXX do it here for now
bench.Start("addexport")
ctxt.addexport()
bench.Start("Gentext")
thearch.Gentext(ctxt) // trampolines, call stubs, etc.
bench.Start("textaddress")