aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2018-04-04 12:12:10 -0400
committerAndrew Bonventre <andybons@golang.org>2018-10-29 19:25:12 +0000
commit1f8a5b8cc8f5dca6aaa09cf2a6604a2edd84cb14 (patch)
tree39a8c794e5fb0a891f7f4b7d53c58f6044aacff2
parent95b56b3879ef1440846ee726f077624878d22432 (diff)
downloadgo-1f8a5b8cc8f5dca6aaa09cf2a6604a2edd84cb14.tar.gz
go-1f8a5b8cc8f5dca6aaa09cf2a6604a2edd84cb14.zip
[release-branch.go1.10] cmd/link: put runtime.framepointer_enabled in DATA instead of RODATA
On darwin, only writable symbol is exported (cmd/link/internal/ld/macho.go:/machoShouldExport). For plugin to work correctly, global variables, including runtime.framepointer_enabled which is set by the linker, need to be exported when dynamic linking. Put it in DATA so it is exported. Also in Go it is defined as a var, which is not read-only. While here, do the same for runtime.goarm. Fixes #25038. Change-Id: I9d1b7d5a648be17103d20b97be65a901cb69f5a2 Reviewed-on: https://go-review.googlesource.com/104715 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-on: https://go-review.googlesource.com/c/122116 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-rw-r--r--src/cmd/link/internal/ld/lib.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
index 8a45825c65..bfb766522b 100644
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -461,14 +461,14 @@ func (ctxt *Link) loadlib() {
// recording the value of GOARM.
if ctxt.Arch.Family == sys.ARM {
s := ctxt.Syms.Lookup("runtime.goarm", 0)
- s.Type = sym.SRODATA
+ s.Type = sym.SDATA
s.Size = 0
s.AddUint8(uint8(objabi.GOARM))
}
if objabi.Framepointer_enabled(objabi.GOOS, objabi.GOARCH) {
s := ctxt.Syms.Lookup("runtime.framepointer_enabled", 0)
- s.Type = sym.SRODATA
+ s.Type = sym.SDATA
s.Size = 0
s.AddUint8(1)
}