aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/go-patches/0004-cmd-link-do-not-mark-resource-section-as-writable.patch
blob: f98fa79bf3b925f40b89f1b3364e2e06b6d7735f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 8255e115f325a58fd4746741f9f35c2f54d70d63 Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Sun, 8 Nov 2020 11:11:27 +0100
Subject: [PATCH 04/10] 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 rmoving the writable
flag.

Change-Id: Ib441bde6620be2000f1685df1ea7bfaebdbe7860
---
 src/cmd/link/internal/ld/pe.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cmd/link/internal/ld/pe.go b/src/cmd/link/internal/ld/pe.go
index c9cb25dbe5..ec5b6d5f52 100644
--- a/src/cmd/link/internal/ld/pe.go
+++ b/src/cmd/link/internal/ld/pe.go
@@ -1482,7 +1482,7 @@ func addpersrc(ctxt *Link) {
 	data := rsrc.P
 	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
-- 
2.29.2