On Wed, Jan 13, 2021 at 7:39 AM xie cui <cuiwei...@gmail.com> wrote:
>
> in linker,
> the code is like this:
>
> func f() {
>    g()
> }
>
> func g() {
>     f()
> }
> when gen binary code of func f, need func g, and gen g need f,
> how linker deal with this situation, and where is the code?
> is dynrelocsym do this job? it seem that it can deal with circles calls?

The linker gets code for f that has a relocation that says "here
insert a call to g", and gets code for g that has a relocation that
says "here insert a call to f".  The linker places the code for f and
g into the output.  Then it walks over all the relocations, and, for
this example, inserts a call to the appropriate address.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWC9h6S%2B8QeOWoxgYecFDv%3Dwxt%2Bm7WfD-eoi91%2BY2SSag%40mail.gmail.com.

Reply via email to