Skip to content

Commit

Permalink
Fix bug where pcsp and nameOff would be 0 for the first entries in th…
Browse files Browse the repository at this point in the history
…e funcnametab and pctab (which runtime treats as missing/empty)
  • Loading branch information
Anonymous committed Nov 9, 2022
1 parent c272d99 commit ccefd63
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ld.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit ccefd63

Please sign in to comment.