Skip to content

Commit

Permalink
add UnresolvedSymbols
Browse files Browse the repository at this point in the history
  • Loading branch information
pkujhd committed Jan 13, 2024
1 parent c19b364 commit 6200a43
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ld.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,25 @@ func Load(linker *Linker, symPtr map[string]uintptr) (codeModule *CodeModule, er
return nil, err
}

func UnresolvedSymbols(linker *Linker, symPtr map[string]uintptr) []string {
unresolvedSymbols := make([]string, 0)
for name, sym := range linker.SymMap {
if sym.Offset == InvalidOffset {
if _, ok := symPtr[sym.Name]; !ok {
nName := strings.TrimSuffix(name, GOTPCRELSuffix)
if name != nName {
if _, ok := symPtr[nName]; !ok {
unresolvedSymbols = append(unresolvedSymbols, nName)
}
} else {
unresolvedSymbols = append(unresolvedSymbols, name)
}
}
}
}
return unresolvedSymbols
}

func (cm *CodeModule) Unload() {
removeitabs(cm.module)
runtime.GC()
Expand Down

0 comments on commit 6200a43

Please sign in to comment.