From: Jason A. Donenfeld Date: Sun, 8 Nov 2020 10:11:27 +0000 (+0100) Subject: cmd/link: do not mark resource section as writable X-Git-Tag: go1.16beta1~21 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=663cd862ed;p=gostls13.git cmd/link: do not mark resource section as writable Resources are immutable, and all other linkers set this section to be read-only and not read-write. Fix this oversight by removing the writable flag. Change-Id: Ib441bde6620be2000f1685df1ea7bfaebdbe7860 Reviewed-on: https://go-review.googlesource.com/c/go/+/268258 Reviewed-by: Cherry Zhang Trust: Alex Brainman Trust: Jason A. Donenfeld --- diff --git a/src/cmd/link/internal/ld/pe.go b/src/cmd/link/internal/ld/pe.go index d60aa55c36..adbf516d5c 100644 --- a/src/cmd/link/internal/ld/pe.go +++ b/src/cmd/link/internal/ld/pe.go @@ -1524,7 +1524,7 @@ func addpersrc(ctxt *Link) { data := ctxt.loader.Data(rsrcsym) size := len(data) h := pefile.addSection(".rsrc", size, size) - h.characteristics = IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE | IMAGE_SCN_CNT_INITIALIZED_DATA + h.characteristics = IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA h.checkOffset(ctxt.Out.Offset()) // relocation