On Sun, Aug 30, 2020 at 7:32 AM xie cui <
cuiw...@gmail.com> wrote:
>
> i am trying to understand code of cmd/link, i need to know where linker get instructions(text segment in executable file) from *o file, and where linker write the binary data (.text segment) to excutable file(in linux it 's a elf file).
The linker was recently rewritten, so I'm describing tip and to some
extent Go 1.15, not earlier releases.
Object files are read by the cmd/link/internal/loader package. The Go
object file format is read by code in cmd/internal/goobj.
All the loadable segments are written out by the asmb function in
cmd/link/internal/asmb.go.
Ian