cl: compile cgo
This commit is contained in:
20
cl/import.go
20
cl/import.go
@@ -412,6 +412,15 @@ const (
|
||||
llgoAtomicUMax = llgoAtomicOpBase + llssa.OpUMax
|
||||
llgoAtomicUMin = llgoAtomicOpBase + llssa.OpUMin
|
||||
|
||||
llgoCgoBase = llgoInstrBase + 0x30
|
||||
llgoCgoCString = llgoCgoBase + 0x0
|
||||
llgoCgoCBytes = llgoCgoBase + 0x1
|
||||
llgoCgoGoString = llgoCgoBase + 0x2
|
||||
llgoCgoGoStringN = llgoCgoBase + 0x3
|
||||
llgoCgoGoBytes = llgoCgoBase + 0x4
|
||||
llgoCgoCMalloc = llgoCgoBase + 0x5
|
||||
llgoCgoCheckPointer = llgoCgoBase + 0x6
|
||||
|
||||
llgoAtomicOpLast = llgoAtomicOpBase + int(llssa.OpUMin)
|
||||
)
|
||||
|
||||
@@ -423,6 +432,17 @@ func (p *context) funcName(fn *ssa.Function, ignore bool) (*types.Package, strin
|
||||
p.ensureLoaded(pkg)
|
||||
orgName = funcName(pkg, origin, true)
|
||||
} else {
|
||||
fname := fn.Name()
|
||||
if fname == "_cgoCheckPointer" {
|
||||
return nil, fname, llgoInstr
|
||||
}
|
||||
if strings.HasPrefix(fname, "_Cfunc_") {
|
||||
if _, ok := llgoInstrs[fname]; ok {
|
||||
return nil, fname, llgoInstr
|
||||
}
|
||||
fname = fname[7:]
|
||||
return nil, fname, cFunc
|
||||
}
|
||||
if fnPkg := fn.Pkg; fnPkg != nil {
|
||||
pkg = fnPkg.Pkg
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user