]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: don't mark stack object symbol DUPOK
authorCherry Zhang <cherryyz@google.com>
Thu, 22 Aug 2019 22:04:57 +0000 (18:04 -0400)
committerCherry Zhang <cherryyz@google.com>
Wed, 28 Aug 2019 15:05:12 +0000 (15:05 +0000)
Stack object symbol is named as <FunctionName>.stkobj. If the
function itself is not DUPOK, its stack object symbol should only
be defined in the package where the function is defined,
therefore no duplicates.

If in the future we change the stack object symbol to
content-hash naming, as other gcdata symbols, we can mark it as
DUPOK.

Change-Id: I5aee96578940e2f76e7115d96cd2716021672c03
Reviewed-on: https://go-review.googlesource.com/c/go/+/191437
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/obj.go

index c85268c120d7519dfa3357040803b87400cb8ad7..be13b278921c6b920ae0b03b183dfdf8d84986a5 100644 (file)
@@ -288,7 +288,11 @@ func addGCLocals() {
                        }
                }
                if x := s.Func.StackObjects; x != nil {
-                       ggloblsym(x, int32(len(x.P)), obj.RODATA|obj.DUPOK)
+                       attr := int16(obj.RODATA)
+                       if s.DuplicateOK() {
+                               attr |= obj.DUPOK
+                       }
+                       ggloblsym(x, int32(len(x.P)), attr)
                }
        }
 }