cmd/internal/gc: replace hash tables with Go maps

The C version of the compiler had just one hash table,
indexed by a (name string, pkg *Pkg) pair.
Because we always know the pkg during a lookup,
replace the one table with a per-Pkg map[string]*Sym.
This also lets us do non-allocating []byte key lookups.

This CL *does* change the generated object files.
In the old code, export data and init calls were emitted
in "hash table order". Now they are emitted in the order
in which they were added to the table.

Change-Id: I5a48d5c9add996dc43ad04a905641d901522de0b
Reviewed-on: https://go-review.googlesource.com/6600
Reviewed-by: Rob Pike <r@golang.org>
diff --git a/src/cmd/internal/gc/go.go b/src/cmd/internal/gc/go.go
index 706e973..d23cdd4 100644
--- a/src/cmd/internal/gc/go.go
+++ b/src/cmd/internal/gc/go.go
@@ -110,11 +110,11 @@
 	Path     string
 	Pathsym  *Sym
 	Prefix   string
-	Link     *Pkg
 	Imported uint8
 	Exported int8
 	Direct   int8
 	Safe     bool
+	Syms     map[string]*Sym
 }
 
 type Sym struct {
@@ -122,7 +122,6 @@
 	Flags      uint8
 	Sym        uint8
 	Link       *Sym
-	Npkg       int32
 	Uniqgen    uint32
 	Importdef  *Pkg
 	Linkname   string
@@ -753,8 +752,6 @@
 
 var Debug_checknil int
 
-var hash [NHASH]*Sym
-
 var importmyname *Sym // my name for package
 
 var localpkg *Pkg // package being compiled
@@ -787,8 +784,6 @@
 
 var rawpkg *Pkg // fake package for raw symbol names
 
-var phash [128]*Pkg
-
 var Tptr int // either TPTR32 or TPTR64
 
 var myimportpath string