ssa: add llgo:link support to Builder.abiMthd
This commit is contained in:
@@ -154,6 +154,9 @@ func (b Builder) abiMethodOf(mPkg *types.Package, mName string, mSig *types.Sign
|
||||
|
||||
func (b Builder) abiMthd(mPkg *types.Package, mName string, mSig *types.Signature, name, abiTyp, ifn llvm.Value) (ret Expr, tfn llvm.Value) {
|
||||
fullName := FuncName(mPkg, mName, mSig.Recv())
|
||||
if b.Pkg.fnlink != nil {
|
||||
fullName = b.Pkg.fnlink(fullName)
|
||||
}
|
||||
tfn = b.Pkg.NewFunc(fullName, mSig, InGo).impl // TODO(xsw): use rawType to speed up
|
||||
if ifn.IsNil() {
|
||||
ifn = tfn
|
||||
|
||||
@@ -586,6 +586,7 @@ type aPackage struct {
|
||||
named map[types.Type]Expr
|
||||
afterb unsafe.Pointer
|
||||
patch func(types.Type) types.Type
|
||||
fnlink func(string) string
|
||||
|
||||
iRoutine int
|
||||
}
|
||||
@@ -658,6 +659,11 @@ func (p Package) SetPatch(fn func(types.Type) types.Type) {
|
||||
p.patch = fn
|
||||
}
|
||||
|
||||
// SetResolveLinkname sets a function to resolve linkname.
|
||||
func (p Package) SetResolveLinkname(fn func(string) string) {
|
||||
p.fnlink = fn
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
func (p Package) afterBuilder() Builder {
|
||||
|
||||
Reference in New Issue
Block a user