diff options
author | Cherry Zhang <cherryyz@google.com> | 2021-03-12 23:21:09 -0500 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2021-03-16 23:14:54 +0000 |
commit | 7a1e963058460d4136603b86386f2bae6fe0d5f2 (patch) | |
tree | 2f1616a4213dfbb436135d4389e63d621f581b41 /src/cmd/compile/internal/walk/complit.go | |
parent | dc1556eaef871074895ed9fdf6028475d53235be (diff) | |
download | go-7a1e963058460d4136603b86386f2bae6fe0d5f2.tar.gz go-7a1e963058460d4136603b86386f2bae6fe0d5f2.zip |
cmd/compile, cmd/link: dynamically export writable static tmps
Static tmps are private to a package, but with plugins a package
can be shared among multiple DSOs. They need to have a consistent
view of the static tmps, especially for writable ones. So export
them. (Read-only static tmps have the same values anyway, so it
doesn't matter. Also Mach-O doesn't support dynamically exporting
read-only symbols anyway.)
Fixes #44956.
Change-Id: I921e25b7ab73cd5d5347800eccdb7931e3448779
Reviewed-on: https://go-review.googlesource.com/c/go/+/301793
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/compile/internal/walk/complit.go')
-rw-r--r-- | src/cmd/compile/internal/walk/complit.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/walk/complit.go b/src/cmd/compile/internal/walk/complit.go index 73442dc404..54f2c5fefe 100644 --- a/src/cmd/compile/internal/walk/complit.go +++ b/src/cmd/compile/internal/walk/complit.go @@ -55,11 +55,12 @@ func (c initContext) String() string { return "inNonInitFunction" } -// readonlystaticname returns a name backed by a (writable) static data symbol. +// readonlystaticname returns a name backed by a read-only static data symbol. func readonlystaticname(t *types.Type) *ir.Name { n := staticinit.StaticName(t) n.MarkReadonly() n.Linksym().Set(obj.AttrContentAddressable, true) + n.Linksym().Set(obj.AttrLocal, true) return n } |