What is compiler, linker, loader?

后端 未结 14 981
离开以前
离开以前 2020-12-07 06:48

I wanted to know in depth meaning and working of compiler, linker and loader. With reference to any language preferably c++.

14条回答
  •  佛祖请我去吃肉
    2020-12-07 07:28

    *

    explained with respect to, linux/unix based systems, though it's a basic concept for all other computing systems.

    *

    Linkers and Loaders from LinuxJournal explains this concept with clarity. It also explains how the classic name a.out came. (assembler output)

    A quick summary,

    c program --> [compiler] --> objectFile --> [linker] --> executable file (say, a.out)

    we got the executable, now give this file to your friend or to your customer who is in need of this software :)

    when they run this software, say by typing it in command line ./a.out

    execute in command line ./a.out --> [Loader] --> [execve] --> program is loaded in memory

    Once the program is loaded into the memory, control is transferred to this program by making the PC (program counter) pointing to the first instruction of a.out

提交回复
热议问题