mirror of
https://github.com/golang/go.git
synced 2025-05-30 11:51:34 +00:00
[dev.link] cmd/link: add SymVersion loader method
Add a loader method to retrieve the version from a loader.Sym (useful mainly for debugging at the moment). Change-Id: I82e0e316bb86eb41b9cf366e656a0f848cf3424e Reviewed-on: https://go-review.googlesource.com/c/go/+/212617 Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
9a5468edff
commit
c6fea80b95
@ -607,6 +607,21 @@ func (l *Loader) SymName(i Sym) string {
|
|||||||
return strings.Replace(osym.Name, "\"\".", r.pkgprefix, -1)
|
return strings.Replace(osym.Name, "\"\".", r.pkgprefix, -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns the version of the i-th symbol.
|
||||||
|
func (l *Loader) SymVersion(i Sym) int {
|
||||||
|
if l.IsExternal(i) {
|
||||||
|
if s := l.Syms[i]; s != nil {
|
||||||
|
return int(s.Version)
|
||||||
|
}
|
||||||
|
pp := l.getPayload(i)
|
||||||
|
return pp.ver
|
||||||
|
}
|
||||||
|
r, li := l.toLocal(i)
|
||||||
|
osym := goobj2.Sym{}
|
||||||
|
osym.Read(r.Reader, r.SymOff(li))
|
||||||
|
return int(abiToVer(osym.ABI, r.version))
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the type of the i-th symbol.
|
// Returns the type of the i-th symbol.
|
||||||
func (l *Loader) SymType(i Sym) sym.SymKind {
|
func (l *Loader) SymType(i Sym) sym.SymKind {
|
||||||
if l.IsExternal(i) {
|
if l.IsExternal(i) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user