[dev.link] cmd/link: clean up some fields

With the new index mapping , we can clean up some fields.
Loader.max should always be equal to len(loader.objSyms) now. And
for external symbols we now give its "local index" as its index
in the payload array, so Relocs.extIdx is no longer useful.
Delete those fields.

Change-Id: If387ff9201ea0d347b954f651f5d4b4ae74937aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/218478
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
Cherry Zhang 2020-02-05 16:52:12 -05:00
parent 6cfd1bcada
commit 06e2339dfe
2 changed files with 37 additions and 40 deletions

View file

@ -19,12 +19,12 @@ import (
// do anything interesting with this symbol (such as look at its
// data or relocations).
func addDummyObjSym(t *testing.T, ldr *Loader, or *oReader, name string) Sym {
idx := ldr.max + 1
if _, ok := ldr.AddSym(name, 0, or, int(idx), false, sym.SRODATA); !ok {
idx := len(ldr.objSyms)
s, ok := ldr.AddSym(name, 0, or, idx, false, sym.SRODATA)
if !ok {
t.Errorf("AddrSym failed for '" + name + "'")
}
return idx
return s
}
func TestAddMaterializedSymbol(t *testing.T) {