cmd/internal/gc, cmd/internal/ld, cmd/internal/obj: teach compiler about local symbols

This lets us avoid loading string constants via the GOT and (together with
http://golang.org/cl/9102) results in the fannkuch benchmark having very similar
register usage with -dynlink as without.

Change-Id: Ic3892b399074982b76773c3e547cfbba5dabb6f9
Reviewed-on: https://go-review.googlesource.com/9103
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Michael Hudson-Doyle 2015-04-18 08:14:08 +12:00 committed by Ian Lance Taylor
parent 0e6a6c510f
commit 029c7bbdfe
11 changed files with 55 additions and 37 deletions

View file

@ -273,6 +273,7 @@ const (
A_ARCHSPECIFIC
)
// An LSym is the sort of symbol that is written to an object file.
type LSym struct {
Name string
Type int16
@ -283,18 +284,25 @@ type LSym struct {
Leaf uint8
Seenglobl uint8
Onlist uint8
Args int32
Locals int32
Value int64
Size int64
Next *LSym
Gotype *LSym
Autom *Auto
Text *Prog
Etext *Prog
Pcln *Pcln
P []byte
R []Reloc
// Local means make the symbol local even when compiling Go code to reference Go
// symbols in other shared libraries, as in this mode symbols are global by
// default. "local" here means in the sense of the dynamic linker, i.e. not
// visible outside of the module (shared library or executable) that contains its
// definition. (When not compiling to support Go shared libraries, all symbols are
// local in this sense unless there is a cgo_export_* directive).
Local bool
Args int32
Locals int32
Value int64
Size int64
Next *LSym
Gotype *LSym
Autom *Auto
Text *Prog
Etext *Prog
Pcln *Pcln
P []byte
R []Reloc
}
type Pcln struct {