// Set symbol attributes or flags based on cgo directives.
// Any newly discovered HOSTOBJ syms are added to 'hostObjSyms'.
-func setCgoAttr(ctxt *Link, lookup func(string, int) loader.Sym, file string, pkg string, directives [][]string, hostObjSyms map[loader.Sym]struct{}) {
+func setCgoAttr(ctxt *Link, file string, pkg string, directives [][]string, hostObjSyms map[loader.Sym]struct{}) {
l := ctxt.loader
for _, f := range directives {
switch f[0] {
if i := strings.Index(remote, "#"); i >= 0 {
remote, q = remote[:i], remote[i+1:]
}
- s := lookup(local, 0)
+ s := l.LookupOrCreateSym(local, 0)
st := l.SymType(s)
if st == 0 || st == sym.SXREF || st == sym.SBSS || st == sym.SNOPTRBSS || st == sym.SHOSTOBJ {
l.SetSymDynimplib(s, lib)
}
local := f[1]
- s := lookup(local, 0)
+ s := l.LookupOrCreateSym(local, 0)
su := l.MakeSymbolUpdater(s)
su.SetType(sym.SHOSTOBJ)
su.SetSize(0)
// functions. Link.loadlib will resolve any
// ABI aliases we find here (since we may not
// yet know it's an alias).
- s := lookup(local, 0)
+ s := l.LookupOrCreateSym(local, 0)
if l.SymType(s) == sym.SHOSTOBJ {
hostObjSyms[s] = struct{}{}
switch ctxt.BuildMode {
case BuildModeCShared, BuildModeCArchive, BuildModePlugin:
- if s == lookup("main", 0) {
+ if s == l.Lookup("main", 0) {
continue
}
}
l := ctxt.loader
hostObjSyms := make(map[loader.Sym]struct{})
for _, d := range ctxt.cgodata {
- setCgoAttr(ctxt, ctxt.loader.LookupOrCreateSym, d.file, d.pkg, d.directives, hostObjSyms)
+ setCgoAttr(ctxt, d.file, d.pkg, d.directives, hostObjSyms)
}
ctxt.cgodata = nil