]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/link: use new reloc on Wasm
authorCherry Zhang <cherryyz@google.com>
Wed, 29 Apr 2020 18:24:30 +0000 (14:24 -0400)
committerCherry Zhang <cherryyz@google.com>
Wed, 29 Apr 2020 18:47:15 +0000 (18:47 +0000)
Change-Id: Icf4d075b64340964068ed038911a14194d241960
Reviewed-on: https://go-review.googlesource.com/c/go/+/230977
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

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

index 2cac61c08cc45eeff1891b5ca7fab62620fc43e0..6bd6a8e4676732f5680bbf01e4274424a1e0c2ad 100644 (file)
@@ -326,14 +326,15 @@ func Main(arch *sys.Arch, theArch Arch) {
        ctxt.loader.InitOutData()
        thearch.Asmb(ctxt, ctxt.loader)
 
-       newreloc := ctxt.IsAMD64() || ctxt.Is386()
+       newreloc := ctxt.IsAMD64() || ctxt.Is386() || ctxt.IsWasm()
        if newreloc {
                bench.Start("reloc")
                ctxt.reloc()
                bench.Start("loadlibfull")
                // We don't need relocations at this point.
                // An exception is internal linking on Windows, see pe.go:addPEBaseRelocSym
-               needReloc := ctxt.IsWindows() && ctxt.IsInternal()
+               // Wasm is another exception, where it applies text relocations in Asmb2.
+               needReloc := (ctxt.IsWindows() && ctxt.IsInternal()) || ctxt.IsWasm()
                ctxt.loadlibfull(symGroupType, needReloc) // XXX do it here for now
        } else {
                bench.Start("loadlibfull")