From: Cherry Zhang Date: Thu, 22 Aug 2019 22:04:57 +0000 (-0400) Subject: cmd/compile: don't mark stack object symbol DUPOK X-Git-Tag: go1.14beta1~1312 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1abe22c3c17091e46c0abec897691c23ad6ebc01;p=gostls13.git cmd/compile: don't mark stack object symbol DUPOK Stack object symbol is named as .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 TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- diff --git a/src/cmd/compile/internal/gc/obj.go b/src/cmd/compile/internal/gc/obj.go index c85268c120..be13b27892 100644 --- a/src/cmd/compile/internal/gc/obj.go +++ b/src/cmd/compile/internal/gc/obj.go @@ -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) } } }