aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-09-08 20:41:51 -0400
committerCherry Zhang <cherryyz@google.com>2020-09-11 15:07:03 +0000
commita531bd5a59177dfef354df8b5b5b529a2a55d015 (patch)
tree5461f5cf3c1c1bf455609f4557d83f9f40afc5e2
parent9214677e7df1e6130249bc83d721130b00d829c4 (diff)
downloadgo-a531bd5a59177dfef354df8b5b5b529a2a55d015.tar.gz
go-a531bd5a59177dfef354df8b5b5b529a2a55d015.zip
cmd/internal/objfile: recognize Mach-O __DATA_CONST segment as read-only data
Updates #38830. Change-Id: I826c6b0a42bc8e48fcda556250ca4a95c73987eb Reviewed-on: https://go-review.googlesource.com/c/go/+/253918 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
-rw-r--r--src/cmd/internal/objfile/macho.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/internal/objfile/macho.go b/src/cmd/internal/objfile/macho.go
index fdb7e76dfc..1d6963f7c4 100644
--- a/src/cmd/internal/objfile/macho.go
+++ b/src/cmd/internal/objfile/macho.go
@@ -60,7 +60,7 @@ func (f *machoFile) symbols() ([]Sym, error) {
} else if int(s.Sect) <= len(f.macho.Sections) {
sect := f.macho.Sections[s.Sect-1]
switch sect.Seg {
- case "__TEXT":
+ case "__TEXT", "__DATA_CONST":
sym.Code = 'R'
case "__DATA":
sym.Code = 'D'