Skip to content

Commit

Permalink
rewrite read Func.FuncData
Browse files Browse the repository at this point in the history
  • Loading branch information
pkujhd committed Nov 22, 2023
1 parent 4e29e0e commit 22941f1
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions ld.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,22 +308,24 @@ func (linker *Linker) readFuncData(symbol *obj.ObjSymbol, codeLen int) (err erro
}

for _, name := range symbol.Func.FuncData {
if _, ok := linker.symMap[name]; !ok {
if _, ok := linker.objsymbolMap[name]; ok {
if _, err = linker.addSymbol(name); err != nil {
return err
if name == EmptyString {
Func.FuncData = append(Func.FuncData, (uintptr)(0))
} else {
if _, ok := linker.symMap[name]; !ok {
if _, ok := linker.objsymbolMap[name]; ok {
if _, err = linker.addSymbol(name); err != nil {
return err
}
} else {
return errors.New("unknown gcobj:" + name)
}
} else if len(name) == 0 {
//nothing todo
}
if sym, ok := linker.symMap[name]; ok {
Func.FuncData = append(Func.FuncData, (uintptr)(sym.Offset))
} else {
return errors.New("unknown gcobj:" + name)
Func.FuncData = append(Func.FuncData, (uintptr)(0))
}
}
if sym, ok := linker.symMap[name]; ok {
Func.FuncData = append(Func.FuncData, (uintptr)(sym.Offset))
} else {
Func.FuncData = append(Func.FuncData, (uintptr)(0))
}
}

if err = linker.addInlineTree(&_func, symbol); err != nil {
Expand Down

0 comments on commit 22941f1

Please sign in to comment.