mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[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>
This commit is contained in:
parent
7cf907606d
commit
2f22143cd5
3 changed files with 66 additions and 97 deletions
|
|
@ -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 + "'")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue