diff --git a/ld.go b/ld.go index e4ac4b09..9d607130 100644 --- a/ld.go +++ b/ld.go @@ -75,6 +75,13 @@ var ( // initialize Linker func initLinker() *Linker { linker := &Linker{ + // Pad these tabs out so offsets don't start at 0, which is often used in runtime as a special value for "missing" + // e.g. runtime/traceback.go and runtime/symtab.go both contain checks like: + // if f.pcsp == 0 ... + // and + // if f.nameoff == 0 + funcnametab: make([]byte, PtrSize), + pctab: make([]byte, PtrSize), symMap: make(map[string]*obj.Sym), objsymbolMap: make(map[string]*obj.ObjSymbol), namemap: make(map[string]int),