mirror of
https://github.com/golang/go
synced 2024-11-24 01:20:08 -07:00
[dev.link] cmd/link: fold zero symbol check into ResolveABIAlias
We call (or will call) ResolveABIAlias in many places. Doing zero symbol check everytime is annoying. Fold the condition into ResolveABIAlias. Change-Id: I10485fe83b9cce2d19b6bd17dc42176f72dae48b Reviewed-on: https://go-review.googlesource.com/c/go/+/231046 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
parent
516c29a79f
commit
2a00c137b1
@ -161,9 +161,7 @@ func relocsym(target *Target, ldr *loader.Loader, err *ErrorReporter, syms *Arch
|
|||||||
off := r.Off()
|
off := r.Off()
|
||||||
siz := int32(r.Siz())
|
siz := int32(r.Siz())
|
||||||
rs := r.Sym()
|
rs := r.Sym()
|
||||||
if rs != 0 {
|
|
||||||
rs = ldr.ResolveABIAlias(rs)
|
rs = ldr.ResolveABIAlias(rs)
|
||||||
}
|
|
||||||
rt := r.Type()
|
rt := r.Type()
|
||||||
if off < 0 || off+siz > int32(len(P)) {
|
if off < 0 || off+siz > int32(len(P)) {
|
||||||
rname := ""
|
rname := ""
|
||||||
|
@ -2161,6 +2161,9 @@ func (l *Loader) LoadFull(arch *sys.Arch, syms *sym.Symbols, needReloc bool) {
|
|||||||
// symbol. If the sym in question is not an alias, the sym itself is
|
// symbol. If the sym in question is not an alias, the sym itself is
|
||||||
// returned.
|
// returned.
|
||||||
func (l *Loader) ResolveABIAlias(s Sym) Sym {
|
func (l *Loader) ResolveABIAlias(s Sym) Sym {
|
||||||
|
if s == 0 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
if l.SymType(s) != sym.SABIALIAS {
|
if l.SymType(s) != sym.SABIALIAS {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user