]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: do not align type name data
authorDavid Crawshaw <crawshaw@golang.org>
Fri, 8 Apr 2016 00:07:09 +0000 (20:07 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Fri, 22 Apr 2016 10:07:40 +0000 (10:07 +0000)
Now that reflect.name objects contain an offset to pkgPath instead of a
pointer, there is no need to align the symbol data.

Removes approx. 10KB from the cmd/go binary. The effect becomes more
important later as more type data is moved into name objects.

For #6853

Change-Id: Idb507fdbdad04f16fc224378f82272cb5c236ab7
Reviewed-on: https://go-review.googlesource.com/21776
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/link/internal/ld/data.go

index 6fc6de3818c566eb8186b570d81560695ce15b90..63caf9cf79444a74a798a7f7565f35a718fb349d 100644 (file)
@@ -1116,7 +1116,7 @@ func symalign(s *LSym) int32 {
        } else if s.Align != 0 {
                return min
        }
-       if strings.HasPrefix(s.Name, "go.string.") && !strings.HasPrefix(s.Name, "go.string.hdr.") {
+       if (strings.HasPrefix(s.Name, "go.string.") && !strings.HasPrefix(s.Name, "go.string.hdr.")) || 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