In this talk I covered the internals of a Go binary, providing a comprehensive understanding of their structure.
We will begin an introduction of what obviously go in the Go binary, the program itself, and the runtime, and we are going to show that information using the Go tools. Also we are going to discuss other things that we could expect there, based on the things that we see in our programs, like information about the function names shown in stack traces or information about types accessible through reflection.
After that we are going to go a bit farther and explore the ELF format, at this point I'll need to introduce the main sections in that file, and how they are used by Go. Here we are going to cover the most common ELF sections, like `.text`, `.data`, `.bss`, `.rodata` and `.symtab`, and explore a bit what is contained there.
Once we are all in the same page about the ELF format, I'll explain other sections included in the binary, like gopclntab, gosymtab and go.buildinfo. We will explore a bit the Go code in the linker that takes care of the responsibility of building that sections.
From there, I'm going to explore some parts of the go code to expose how this information in the binary is initialized and used in the Go runtime for things like, stack traces, debugging, reflection or profiling.
As a last step, we are going to compile a small Go program and do a quick analysis of the Go binary and explore how some of the information is placed in the sections of the binary.
I'll finalize the talk with a summary of what is contain in the binary expecting the audience to be more aware now about what is there. And after that some references to keep investigating it.