mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.link] cmd/link: use Extname in doxcoff
On AIX, when external linking, we need to change the function names to start with a dot and make function descriptors with the names without the dot. Currently this is done through symbol renaming, which is not friendly for switching to the loader. In this CL we use symbol's external name for this. This allows us to get rid of symbol renaming. Change-Id: If72602d17e96f0339fdac2e2321f1edfb292b5f9 Reviewed-on: https://go-review.googlesource.com/c/go/+/224940 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
ed7a491940
commit
ea93ddfaeb
3 changed files with 25 additions and 36 deletions
|
|
@ -2060,35 +2060,12 @@ func (l *Loader) ExtractSymbols(syms *sym.Symbols, rp map[*sym.Symbol]*sym.Symbo
|
|||
i := l.Lookup(name, ver)
|
||||
return l.Syms[i]
|
||||
}
|
||||
syms.Rename = func(old, new string, ver int) {
|
||||
// annoying... maybe there is a better way to do this
|
||||
if ver >= 2 {
|
||||
panic("cannot rename static symbol")
|
||||
}
|
||||
i := l.Lookup(old, ver)
|
||||
s := l.Syms[i]
|
||||
s.Name = new
|
||||
if s.Extname() == old {
|
||||
s.SetExtname(new)
|
||||
}
|
||||
delete(l.symsByName[ver], old)
|
||||
|
||||
// This mirrors the old code. But I'm not sure if the logic of
|
||||
// handling dup in the old code actually works, or necessary.
|
||||
dupi := l.symsByName[ver][new]
|
||||
dup := l.Syms[dupi]
|
||||
if dup == nil {
|
||||
l.symsByName[ver][new] = i
|
||||
} else {
|
||||
if s.Type == 0 {
|
||||
dup.Attr |= s.Attr
|
||||
*s = *dup
|
||||
} else if dup.Type == 0 {
|
||||
s.Attr |= dup.Attr
|
||||
*dup = *s
|
||||
l.symsByName[ver][new] = i
|
||||
}
|
||||
}
|
||||
syms.Newsym = func(name string, ver int) *sym.Symbol {
|
||||
i := l.newExtSym(name, ver)
|
||||
s := l.allocSym(name, ver)
|
||||
l.installSym(i, s)
|
||||
syms.Allsym = append(syms.Allsym, s) // XXX see above
|
||||
return s
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue