From: Jason A. Donenfeld Date: Wed, 2 Oct 2019 09:25:24 +0000 (+0200) Subject: cmd/link: implement Msync for Windows using FlushViewOfFile X-Git-Tag: go1.14beta1~898 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=274f4cef9329262dcfd4a715ab6c2ebc908d6209;p=gostls13.git cmd/link: implement Msync for Windows using FlushViewOfFile CL 196846 implemented memory mapped output files but forgot to provide an implementation for Msync. This rectifies that with a simple call to FlushViewOfFile. Change-Id: I5aebef9baf3a2a6ad54ceda096952a5d7d660bfe Reviewed-on: https://go-review.googlesource.com/c/go/+/198418 Run-TryBot: Jason A. Donenfeld Reviewed-by: Alex Brainman TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/link/internal/ld/outbuf_windows.go b/src/cmd/link/internal/ld/outbuf_windows.go index 4366a83c33..1cb05c301f 100644 --- a/src/cmd/link/internal/ld/outbuf_windows.go +++ b/src/cmd/link/internal/ld/outbuf_windows.go @@ -42,6 +42,8 @@ func (out *OutBuf) Munmap() { } func (out *OutBuf) Msync() error { - // does nothing on windows - return nil + if out.buf == nil { + return nil + } + return syscall.FlushViewOfFile(uintptr(unsafe.Pointer(&out.buf[0])), 0) }