cmd/compile: de-dup the gclocals symbols in compiler too

These symbols are de-duplicated in the linker but the compiler generates quite
many duplicates too: 2425 of 13769 total symbols for runtime.a for example.
De-duplicating them in the compiler saves the linker a bit of work.

Fixes #14983

Change-Id: I5f18e5f9743563c795aad8f0a22d17a7ed147711
Reviewed-on: https://go-review.googlesource.com/22293
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Michael Hudson-Doyle 2016-03-28 22:27:36 +13:00
parent d3c79d324a
commit f4d38a8792
3 changed files with 12 additions and 16 deletions

View file

@ -8,7 +8,6 @@ import (
"cmd/compile/internal/ssa"
"cmd/internal/obj"
"cmd/internal/sys"
"crypto/md5"
"fmt"
"sort"
"strings"
@ -130,15 +129,6 @@ func removevardef(firstp *obj.Prog) {
}
}
func gcsymdup(s *Sym) {
ls := Linksym(s)
if len(ls.R) > 0 {
Fatalf("cannot rosymdup %s with relocations", ls.Name)
}
ls.Name = fmt.Sprintf("gclocals·%x", md5.Sum(ls.P))
ls.Dupok = true
}
func emitptrargsmap() {
if Curfn.Func.Nname.Sym.Name == "_" {
return
@ -559,9 +549,6 @@ func genlegacy(ptxt *obj.Prog, gcargs, gclocals *Sym) {
// Emit garbage collection symbols.
liveness(Curfn, ptxt, gcargs, gclocals)
gcsymdup(gcargs)
gcsymdup(gclocals)
Thearch.Defframe(ptxt)
if Debug['f'] != 0 {