aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/loader/loader_test.go
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-02-03 12:37:35 -0500
committerCherry Zhang <cherryyz@google.com>2020-02-05 20:53:18 +0000
commit2f22143cd5a22b1faba9223115514432f145d15c (patch)
tree408b4618587d8d097337b80ae22e02071f694279 /src/cmd/link/internal/loader/loader_test.go
parent7cf907606d7e2c86abad6180a0467fb4a3797268 (diff)
downloadgo-2f22143cd5a22b1faba9223115514432f145d15c.tar.xz
[dev.link] cmd/link: remove holes from global index space
In CL 217064, we made symbol's global index unique, but we still reserve index space for each object file, which means we may leave holes in the index space if the symbol is a dup or is overwritten. In this CL, we stop reserving index spaces. Instead, symbols are added one at a time, and only added if it does not already exist. There is no more holes in the index space. Change-Id: I3c4e67163c556ba1198e13065706510dac4692fb Reviewed-on: https://go-review.googlesource.com/c/go/+/217519 Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
Diffstat (limited to 'src/cmd/link/internal/loader/loader_test.go')
-rw-r--r--src/cmd/link/internal/loader/loader_test.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cmd/link/internal/loader/loader_test.go b/src/cmd/link/internal/loader/loader_test.go
index 71036b3a0a..8f06783977 100644
--- a/src/cmd/link/internal/loader/loader_test.go
+++ b/src/cmd/link/internal/loader/loader_test.go
@@ -20,8 +20,7 @@ import (
// data or relocations).
func addDummyObjSym(t *testing.T, ldr *Loader, or *oReader, name string) Sym {
idx := ldr.max + 1
- ldr.max++
- if _, ok := ldr.AddSym(name, 0, idx, or, int(idx-ldr.startIndex(or)), false, sym.SRODATA); !ok {
+ if _, ok := ldr.AddSym(name, 0, or, int(idx), false, sym.SRODATA); !ok {
t.Errorf("AddrSym failed for '" + name + "'")
}