how linker work?

76 views
Skip to first unread message

xie cui

unread,
Jan 1, 2021, 10:49:05 AM1/1/21
to golang-nuts
in my mind, the main job of linker is to resolve symbols between .a files, is the right?
my question:
    there a func named foo def in a.a,  and there a func named bar in b.a, bar will call foo,
before link the two file, i think in bar 's code has a  instruction like:  call foo, in C, before link the instruction is call 0x0, what's in .a file of go?
   the linker will change call 0x0 or something like call foo, to call 0xaaa(assume that 0xaaa is address of foo after linker), so where can i find the code resolve symbols to real address in source code of linker? 

Ian Lance Taylor

unread,
Jan 1, 2021, 1:32:58 PM1/1/21
to xie cui, golang-nuts
You may find it helpful to read my old series of blog posts about how
linkers work. Start at https://www.airs.com/blog/archives/38.

Ian
Reply all
Reply to author
Forward
0 new messages