mirror of
https://github.com/golang/go
synced 2024-11-06 21:36:11 -07:00
[dev.link] cmd/link: add hooks for sorting loader.Reloc by offset
Add support for supporting loader.Reloc by offset, needed by host object loaders. Change-Id: I5ac0702ee74ad71531f443e6215558d8151e3a4c Reviewed-on: https://go-review.googlesource.com/c/go/+/211306 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
parent
186e783730
commit
a52cea446d
@ -1339,6 +1339,14 @@ func (l *Loader) relocs(r *oReader, li int) Relocs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RelocByOff implements sort.Interface for sorting relocations by offset.
|
||||||
|
|
||||||
|
type RelocByOff []Reloc
|
||||||
|
|
||||||
|
func (x RelocByOff) Len() int { return len(x) }
|
||||||
|
func (x RelocByOff) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
|
||||||
|
func (x RelocByOff) Less(i, j int) bool { return x[i].Off < x[j].Off }
|
||||||
|
|
||||||
// Preload a package: add autolibs, add symbols to the symbol table.
|
// Preload a package: add autolibs, add symbols to the symbol table.
|
||||||
// Does not read symbol data yet.
|
// Does not read symbol data yet.
|
||||||
func (l *Loader) Preload(arch *sys.Arch, syms *sym.Symbols, f *bio.Reader, lib *sym.Library, unit *sym.CompilationUnit, length int64, pn string, flags int) {
|
func (l *Loader) Preload(arch *sys.Arch, syms *sym.Symbols, f *bio.Reader, lib *sym.Library, unit *sym.CompilationUnit, length int64, pn string, flags int) {
|
||||||
|
Loading…
Reference in New Issue
Block a user