]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/link: always run Asmb before reloc
authorCherry Zhang <cherryyz@google.com>
Sat, 25 Apr 2020 00:49:35 +0000 (20:49 -0400)
committerCherry Zhang <cherryyz@google.com>
Mon, 27 Apr 2020 15:34:33 +0000 (15:34 +0000)
Currently, we run Asmb before reloc, except on Wasm, where the
order is reversed. However, Asmb is no-op on Wasm. So we can
always run Asmb first.

Change-Id: Ifb8989d8150ebdd5777deb05cbccec16f8e36d82
Reviewed-on: https://go-review.googlesource.com/c/go/+/229990
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/link/internal/ld/main.go

index fcd391da90c2e208b9d0fe0f944f43ed7c46faae..a5f2092f0f9b94681b1ceda6ea63f539c6d073d5 100644 (file)
@@ -346,20 +346,13 @@ func Main(arch *sys.Arch, theArch Arch) {
                if err := ctxt.Out.Mmap(filesize); err != nil {
                        panic(err)
                }
-               // Asmb will redirect symbols to the output file mmap, and relocations
-               // will be applied directly there.
-               bench.Start("Asmb")
-               thearch.Asmb(ctxt)
-               bench.Start("reloc")
-               ctxt.reloc()
-       } else {
-               // If we don't mmap, we need to apply relocations before
-               // writing out.
-               bench.Start("reloc")
-               ctxt.reloc()
-               bench.Start("Asmb")
-               thearch.Asmb(ctxt)
        }
+       // Asmb will redirect symbols to the output file mmap, and relocations
+       // will be applied directly there.
+       bench.Start("Asmb")
+       thearch.Asmb(ctxt)
+       bench.Start("reloc")
+       ctxt.reloc()
        bench.Start("Asmb2")
        thearch.Asmb2(ctxt)