]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/link: move the wavefront past addexport()
authorThan McIntosh <thanm@google.com>
Mon, 30 Mar 2020 14:06:54 +0000 (10:06 -0400)
committerThan McIntosh <thanm@google.com>
Mon, 30 Mar 2020 18:44:30 +0000 (18:44 +0000)
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>
src/cmd/link/internal/ld/elf.go
src/cmd/link/internal/ld/go.go
src/cmd/link/internal/ld/main.go

index c5c07d63f7eb9e70ab17803b1f598000d28fb1e7..e15f94d5e0b96e290391137e99c4bb9b226cfc6a 100644 (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)
index 575ca6febe4afd6172e074968fb7cb1aea52e952..0e4198572b2f494e902aacc69668f3f67bc4eb3c 100644 (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 {
index 257002623899cb678ccecfe3e87b4cd5e5c6ad84..3772c5090cddd93e00f93b967eb45faa8344e93f 100644 (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")