cmd/compile, cmd/link: stop generating unused go.string.hdr symbols.

name       old s/op    new s/op    delta
LinkCmdGo   0.29 ± 5%   0.29 ± 8%  -2.60%   (p=0.000 n=97+98)

name       old MaxRSS  new MaxRSS  delta
LinkCmdGo   106k ± 4%   105k ± 3%  -1.00%  (p=0.000 n=100+99)

Change-Id: I75a1c3b24ea711a15a5d2eae026b70b97ee7bad4
Reviewed-on: https://go-review.googlesource.com/31030
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
This commit is contained in:
shaharko 2016-10-13 22:31:46 +03:00 committed by Shahar Kohanim
parent 0017438139
commit 80a034642e
7 changed files with 23 additions and 71 deletions

View file

@ -1135,7 +1135,7 @@ func symalign(s *Symbol) int32 {
} else if s.Align != 0 {
return min
}
if (strings.HasPrefix(s.Name, "go.string.") && !strings.HasPrefix(s.Name, "go.string.hdr.")) || strings.HasPrefix(s.Name, "type..namedata.") {
if strings.HasPrefix(s.Name, "go.string.") || strings.HasPrefix(s.Name, "type..namedata.") {
// String data is just bytes.
// If we align it, we waste a lot of space to padding.
return min
@ -1336,7 +1336,7 @@ func (ctxt *Link) dodata() {
for _, s := range data[symnro] {
isRelro := len(s.R) > 0
switch s.Type {
case obj.STYPE, obj.SGOSTRINGHDR, obj.STYPERELRO, obj.SGOSTRINGHDRRELRO, obj.SGOFUNCRELRO:
case obj.STYPE, obj.STYPERELRO, obj.SGOFUNCRELRO:
// Symbols are not sorted yet, so it is possible
// that an Outer symbol has been changed to a
// relro Type before it reaches here.