cgo: support full cgo tags

This commit is contained in:
Li Jie
2024-11-15 12:24:46 +08:00
parent a64f4219e9
commit 9f0b3963cb
7 changed files with 344 additions and 50 deletions

View File

@@ -799,10 +799,6 @@ func (p *context) compileInstr(b llssa.Builder, instr ssa.Instruction) {
}
switch v := instr.(type) {
case *ssa.Store:
// skip cgo global variables
if checkCgo(v.Addr.Name()) {
// return
}
va := v.Addr
if va, ok := va.(*ssa.IndexAddr); ok {
if args, ok := p.isVArgs(va.X); ok { // varargs: this is a varargs store
@@ -1083,10 +1079,6 @@ func processPkg(ctx *context, ret llssa.Package, pkg *ssa.Package) {
case *ssa.Type:
ctx.compileType(ret, member)
case *ssa.Global:
// skip cgo global variables
if checkCgo(member.Name()) {
// continue
}
ctx.compileGlobal(ret, member)
}
}

View File

@@ -438,13 +438,10 @@ func (p *context) funcName(fn *ssa.Function, ignore bool) (*types.Package, strin
if checkCgo(fname) {
return nil, fname, llgoInstr
}
if strings.HasPrefix(fname, "_Cfunc_") {
if isCgoCfunc(fn) {
if _, ok := llgoInstrs[fname]; ok {
return nil, fname, llgoInstr
}
// fname = fname[7:]
// fn.WriteTo(os.Stdout)
// return nil, fname, cFunc
}
if fnPkg := fn.Pkg; fnPkg != nil {
pkg = fnPkg.Pkg