cl: don't ignore standard libraries
This commit is contained in:
@@ -329,12 +329,6 @@ func TestIntVal(t *testing.T) {
|
||||
intVal(&ssa.Parameter{})
|
||||
}
|
||||
|
||||
func TestIgnoreName(t *testing.T) {
|
||||
if !ignoreName("runtime/foo") || !ignoreName("internal/abi") {
|
||||
t.Fatal("ignoreName failed")
|
||||
}
|
||||
}
|
||||
|
||||
func TestErrImport(t *testing.T) {
|
||||
var ctx context
|
||||
pkg := types.NewPackage("foo", "foo")
|
||||
|
||||
@@ -135,9 +135,6 @@ func (p *context) compileType(pkg llssa.Package, t *ssa.Type) {
|
||||
tnName := tn.Name()
|
||||
typ := tn.Type()
|
||||
name := llssa.FullName(tn.Pkg(), tnName)
|
||||
if ignoreName(name) {
|
||||
return
|
||||
}
|
||||
if debugInstr {
|
||||
log.Println("==> NewType", name, typ)
|
||||
}
|
||||
@@ -160,7 +157,7 @@ func (p *context) compileMethods(pkg llssa.Package, typ types.Type) {
|
||||
func (p *context) compileGlobal(pkg llssa.Package, gbl *ssa.Global) {
|
||||
typ := globalType(gbl)
|
||||
name, vtype, define := p.varName(gbl.Pkg.Pkg, gbl)
|
||||
if vtype == pyVar || ignoreName(name) {
|
||||
if vtype == pyVar {
|
||||
return
|
||||
}
|
||||
if debugInstr {
|
||||
|
||||
@@ -516,9 +516,6 @@ func (p *context) funcName(fn *ssa.Function, ignore bool) (*types.Package, strin
|
||||
}
|
||||
p.ensureLoaded(pkg)
|
||||
orgName = funcName(pkg, fn, false)
|
||||
if ignore && ignoreName(orgName) {
|
||||
return nil, orgName, ignoredFunc
|
||||
}
|
||||
}
|
||||
if v, ok := p.prog.Linkname(orgName); ok {
|
||||
if strings.HasPrefix(v, "C.") {
|
||||
@@ -671,23 +668,4 @@ func replaceGoName(v string, pos int) string {
|
||||
return v
|
||||
}
|
||||
|
||||
func ignoreName(name string) bool {
|
||||
/* TODO(xsw): confirm this is not needed more
|
||||
if name == "unsafe.init" {
|
||||
return true
|
||||
}
|
||||
*/
|
||||
const internal = "internal/"
|
||||
return (strings.HasPrefix(name, internal) && !supportedInternal(name[len(internal):])) ||
|
||||
strings.HasPrefix(name, "runtime/") || strings.HasPrefix(name, "arena.") ||
|
||||
strings.HasPrefix(name, "maps.") || strings.HasPrefix(name, "plugin.")
|
||||
}
|
||||
|
||||
func supportedInternal(name string) bool {
|
||||
return strings.HasPrefix(name, "abi.") || strings.HasPrefix(name, "bytealg.") ||
|
||||
strings.HasPrefix(name, "itoa.") || strings.HasPrefix(name, "oserror.") || strings.HasPrefix(name, "race.") ||
|
||||
strings.HasPrefix(name, "reflectlite.") || strings.HasPrefix(name, "stringslite.") || strings.HasPrefix(name, "filepathlite.") ||
|
||||
strings.HasPrefix(name, "syscall/unix.") || strings.HasPrefix(name, "syscall/execenv.")
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -854,13 +854,7 @@ func canSkipToBuild(pkgPath string) bool {
|
||||
if _, ok := hasAltPkg[pkgPath]; ok {
|
||||
return false
|
||||
}
|
||||
switch pkgPath {
|
||||
case "unsafe":
|
||||
return true
|
||||
default:
|
||||
return strings.HasPrefix(pkgPath, "internal/") ||
|
||||
strings.HasPrefix(pkgPath, "runtime/internal/")
|
||||
}
|
||||
return pkgPath == "unsafe"
|
||||
}
|
||||
|
||||
// findDylibDep finds the dylib dependency in the executable. It returns empty
|
||||
|
||||
Reference in New Issue
Block a user