abi int
}{
{"runtime.newobject", 1},
+ {"runtime.mallocgc", 1},
{"runtime.panicdivide", 1},
{"runtime.panicshift", 1},
{"runtime.panicmakeslicelen", 1},
{"runtime.block", 1},
{"runtime.makeslice", 1},
{"runtime.makeslice64", 1},
+ {"runtime.makeslicecopy", 1},
{"runtime.growslice", 1},
{"runtime.memmove", 1},
{"runtime.memclrNoHeapPointers", 1},
{"runtime.morestack", 0},
{"runtime.morestackc", 0},
{"runtime.morestack_noctxt", 0},
+ {"type.int8", 0},
+ {"type.*int8", 0},
+ {"type.uint8", 0},
+ {"type.*uint8", 0},
+ {"type.int16", 0},
+ {"type.*int16", 0},
+ {"type.uint16", 0},
+ {"type.*uint16", 0},
+ {"type.int32", 0},
+ {"type.*int32", 0},
+ {"type.uint32", 0},
+ {"type.*uint32", 0},
+ {"type.int64", 0},
+ {"type.*int64", 0},
+ {"type.uint64", 0},
+ {"type.*uint64", 0},
+ {"type.float32", 0},
+ {"type.*float32", 0},
+ {"type.float64", 0},
+ {"type.*float64", 0},
+ {"type.complex64", 0},
+ {"type.*complex64", 0},
+ {"type.complex128", 0},
+ {"type.*complex128", 0},
+ {"type.unsafe.Pointer", 0},
+ {"type.*unsafe.Pointer", 0},
+ {"type.uintptr", 0},
+ {"type.*uintptr", 0},
+ {"type.bool", 0},
+ {"type.*bool", 0},
+ {"type.string", 0},
+ {"type.*string", 0},
+ {"type.error", 0},
+ {"type.*error", 0},
+ {"type.func(error) string", 0},
+ {"type.*func(error) string", 0},
}
"log"
"os"
"path/filepath"
+ "strings"
)
var stdout = flag.Bool("stdout", false, "write to stdout instead of builtinlist.go")
// The list above only contains ones that are used by the frontend.
// The backend may create more references of builtin functions.
+ // We also want to include predefined types.
// Add them.
- for _, b := range extra {
- name := pkg + "." + b.name
+ extras := append(fextras[:], enumerateBasicTypes()...)
+ for _, b := range extras {
+ prefix := ""
+ if !strings.HasPrefix(b.name, "type.") {
+ prefix = pkg + "."
+ }
+ name := prefix + b.name
if decls[name] {
log.Fatalf("%q already added -- mkbuiltin.go out of sync?", name)
}
fmt.Fprintln(w, "}")
}
-var extra = [...]struct {
+// addBasicTypes returns the symbol names for basic types that are
+// defined in the runtime and referenced in other packages.
+// Needs to be kept in sync with reflect.go:dumpbasictypes() and
+// reflect.go:dtypesym() in the compiler.
+func enumerateBasicTypes() []extra {
+ names := [...]string{
+ "int8", "uint8", "int16", "uint16",
+ "int32", "uint32", "int64", "uint64",
+ "float32", "float64", "complex64", "complex128",
+ "unsafe.Pointer", "uintptr", "bool", "string", "error",
+ "func(error) string"}
+ result := []extra{}
+ for _, n := range names {
+ result = append(result, extra{"type." + n, 0})
+ result = append(result, extra{"type.*" + n, 0})
+ }
+ return result
+}
+
+type extra struct {
name string
abi int
-}{
+}
+
+var fextras = [...]extra{
// compiler frontend inserted calls (sysfunc)
{"deferproc", 1},
{"deferprocStack", 1},
}
l.growAttrBitmaps(len(l.objSyms) + int(end-start))
needNameExpansion := r.NeedNameExpansion()
+ loadingRuntimePkg := r.unit.Lib.Pkg == "runtime"
for i := start; i < end; i++ {
osym := r.Sym(i)
name := osym.Name(r.Reader)
if strings.HasPrefix(name, "go.itablink.") {
l.itablink[gi] = struct{}{}
}
- if strings.HasPrefix(name, "runtime.") {
+ if strings.HasPrefix(name, "runtime.") ||
+ (loadingRuntimePkg && strings.HasPrefix(name, "type.")) {
if bi := goobj2.BuiltinIdx(name, v); bi != -1 {
// This is a definition of a builtin symbol. Record where it is.
l.builtinSyms[bi] = gi