mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.link] cmd/link/internal/objfile: update deadcode2 to use new reloc hooks
Update the new deadcode pass to use the revised loader interface for querying relocations. Remove some of the previous loader relocation methods, since they are no longer used. Change-Id: I08cec4c05793a17698b2674068f64837a5bf4477 Reviewed-on: https://go-review.googlesource.com/c/go/+/200718 Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
0b25ab5d96
commit
9036351dd7
2 changed files with 11 additions and 37 deletions
|
|
@ -266,33 +266,6 @@ func (l *Loader) SymType(i Sym) sym.SymKind {
|
|||
return sym.AbiSymKindToSymKind[objabi.SymKind(osym.Type)]
|
||||
}
|
||||
|
||||
// Returns the number of relocations given a global index.
|
||||
func (l *Loader) NReloc(i Sym) int {
|
||||
r, li := l.ToLocal(i)
|
||||
if r == nil {
|
||||
return 0
|
||||
}
|
||||
return r.NReloc(li)
|
||||
}
|
||||
|
||||
// Returns the referred symbol of the j-th relocation of the i-th
|
||||
// symbol.
|
||||
func (l *Loader) RelocSym(i Sym, j int) Sym {
|
||||
r, li := l.ToLocal(i)
|
||||
rel := goobj2.Reloc{}
|
||||
rel.Read(r.Reader, r.RelocOff(li, j))
|
||||
return l.Resolve(r, rel.Sym)
|
||||
}
|
||||
|
||||
// Returns the relocation type of the j-th relocation of the i-th
|
||||
// symbol.
|
||||
func (l *Loader) RelocType(i Sym, j int) objabi.RelocType {
|
||||
r, li := l.ToLocal(i)
|
||||
rel := goobj2.Reloc{}
|
||||
rel.Read(r.Reader, r.RelocOff(li, j))
|
||||
return objabi.RelocType(rel.Type)
|
||||
}
|
||||
|
||||
// Returns the number of aux symbols given a global index.
|
||||
func (l *Loader) NAux(i Sym) int {
|
||||
r, li := l.ToLocal(i)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue