On Thu, Oct 26, 2017 at 4:08 PM, <max.shavr...@gmail.com> wrote: > > Maybe I have some false assumptions here, but if I had a dynamically-linked > go library that I stripped, how would I be able to use reflection at runtime > when using things from this library.
Yes, you are onto something there, something I didn't mention. When building a plugin (using -buildmode=plugin, see https://golang.org/pkg/plugin), the Go compiler does in fact generate a table mapping names to types for the names defined in the main package. That table is used by programs that load the plugin in order to get the correct types. But that only exists for plugins, it's not a general approach. Ian > On Thursday, October 26, 2017 at 5:52:49 PM UTC-4, Ian Lance Taylor wrote: >> >> On Thu, Oct 26, 2017 at 1:34 PM, <max.sh...@gmail.com> wrote: >> > (Hoping this is the right place to ask this...) >> >> Yes, this is at any rate one of the right places. >> >> >> > I'm wondering if there's a way to map the function name/address to the >> > function's rtype/functype on a stripped go binary (at least, for ELF)? I >> > know the funcType is in .rodata, but I don't see any mapping from >> > .gopclntab >> > -> .typelink, or .gopclntab -> functype. Can I assume they're put into >> > rodata in order, or, even if there's no direct mapping, is there some >> > implementation-defined layout I can utilize? >> >> There is no such mapping. You're right that the information is >> generally there, but the mapping is not. I don't think there is any >> reliable workaround, and I'm sure there is no workaround that will >> remain stable in future releases. Sorry. >> >> Ian > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.