[gollvm] How to demangle the funcname?

112 views
Skip to first unread message

MQTT Tactic

unread,
May 9, 2022, 12:00:03 PM5/9/22
to golang-nuts
First I use LLVM PASS to extract all of the functions from the LLVM bitcode that compiled by `gollvm`. What I got is as follows:

```
github_0com_1emitter_x2dio_1emitter_1internal_1security_1cipher._64_7uint8..eq
github_0com_1emitter_x2dio_1emitter_1internal_1security_1cipher._664_7uint8..eq
github_0com_1emitter_x2dio_1emitter_1internal_1security_1cipher..import
github_0com_1emitter_x2dio_1emitter_1internal_1security_1license.New
github_0com_1emitter_x2dio_1emitter_1internal_1security_1license.NewV3
github_0com_1emitter_x2dio_1emitter_1internal_1security_1license.V3.NewMasterKey
github_0com_1emitter_x2dio_1emitter_1internal_1security_1license.V3.Cipher
github_0com_1emitter_x2dio_1emitter_1internal_1security_1license.V3.String
github_0com_1emitter_x2dio_1emitter_1internal_1security_1license.V3.Contract
github_0com_1emitter_x2dio_1emitter_1internal_1security_1license.V3.Master
``` 

Are there any methods to convert these mangled name to the form in golang like `func Register(name string, i vlauth.IFace) error`. Or `func Register() xxx` to mangled name. Any help would be much appreciated!

Ian Lance Taylor

unread,
May 9, 2022, 2:56:28 PM5/9/22
to MQTT Tactic, golang-nuts
I don't think there is any existing program that will do it for you,
but the relevant code is
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/go/runtime/symtab.go#281

Ian

MQTT Tactic

unread,
May 10, 2022, 12:38:56 PM5/10/22
to golang-nuts
Oh, thanks! I will rewrite that.
Reply all
Reply to author
Forward
0 new messages