From 2a33f5368a4b246ef9656eac4229635d80b8ee2a Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Wed, 29 Apr 2020 14:24:30 -0400 Subject: [PATCH] [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 --- src/cmd/link/internal/ld/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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") -- 2.50.0