From: Cherry Zhang Date: Wed, 29 Apr 2020 18:24:30 +0000 (-0400) Subject: [dev.link] cmd/link: use new reloc on Wasm X-Git-Tag: go1.15beta1~259^2^2~14 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2a33f5368a4b246ef9656eac4229635d80b8ee2a;p=gostls13.git [dev.link] cmd/link: use new reloc on Wasm Change-Id: Icf4d075b64340964068ed038911a14194d241960 Reviewed-on: https://go-review.googlesource.com/c/go/+/230977 Run-TryBot: Cherry Zhang Reviewed-by: Jeremy Faller TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/link/internal/ld/main.go b/src/cmd/link/internal/ld/main.go index 2cac61c08c..6bd6a8e467 100644 --- a/src/cmd/link/internal/ld/main.go +++ b/src/cmd/link/internal/ld/main.go @@ -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")