The binary stores a lot of ancillary data for runtime access. This
(mostly?) spans out from runtime.pclntab and runtime.firstmoduledata and
all the structures referenced by them. This is uniform across all
platforms too, with the runtime doing the same operations across
different OS-es and executable formats instead of using some
ELF/PE/Mach-O specific features.
Looking at a decompiled cgo binary where .text != runtime.text, some
values that reference runtime.text are:
runtime.pclntab.textStart
runtime.firstmoduledata.minpc
runtime.firstmoduledata.text
I think this should, at the very least, lead you in the right direction.
Zxilly Chou:
Yesterday, I reported an issue on debug/gosym at issues/65232 regarding
the difference between the symbol table and gopclntab. A member of the
Go team informed me that the start of the .text segment is not always
kept the same as 'runtime.text' value.
I am curious about how the compiler sets this symbol and if there is a
way to obtain this value without relying on the symbol table.
Additionally, how does a compiled binary locate it even after being
stripped?
Any suggestions would be appreciated.
--
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
<mailto:golang-nuts+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/cf32849d-64a0-4615-bfa1-8add7b1f2b62n%40googlegroups.com <https://groups.google.com/d/msgid/golang-nuts/cf32849d-64a0-4615-bfa1-8add7b1f2b62n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/55135d79-d4f0-42da-9e28-a1eba363082a%40gmail.com.