xtool/nm:symbol version

This commit is contained in:
luoliwoshang
2024-10-15 14:48:51 +08:00
parent ace3c3e421
commit d682771c35
2 changed files with 50 additions and 8 deletions

View File

@@ -22,6 +22,7 @@ import (
"os"
"github.com/goplus/llgo/xtool/env/llvm"
nmtool "github.com/goplus/llgo/xtool/nm"
)
func main() {
@@ -45,10 +46,17 @@ func main() {
fmt.Printf("\n%s:\n", item.File)
}
for _, sym := range item.Symbols {
var versionInfo string
switch sym.VersionType {
case nmtool.VersionSpecific:
versionInfo = fmt.Sprintf("@%s", sym.Version)
case nmtool.VersionDefault:
versionInfo = fmt.Sprintf("@@%s", sym.Version)
}
if sym.FAddr {
fmt.Printf("%016x %c %s\n", sym.Addr, sym.Type, sym.Name)
fmt.Printf("%016x %c %s%s\n", sym.Addr, sym.Type, sym.Name, versionInfo)
} else {
fmt.Printf("%16s %c %s\n", "", sym.Type, sym.Name)
fmt.Printf("%16s %c %s%s\n", "", sym.Type, sym.Name, versionInfo)
}
}
}