Pilation Linking Loading
Pilation Linking Loading
What is ELF ?
--------
Executable and Linkable Format
Format for creating machine code files, typically on Linux
ELF is used not only for executable (complete machine code) programs, but also for
partially compiled files e.g. main.o and library files like libc.so.6
Linking process
-------------
Linker is an application program
On linux, it's the "ld" program
E.g. you can run commands like $ ld a.o b.o -o c.o
Normally you have to specify some options to ld to get a proper executable file.
WHat is linking? -- "connecting" the call of a function with the code of the
function.
The resultatnt file "try" here, will contain the codes of all the functions and
linkages also.
Loader
-------------
Is a "code" that loads the machine code from a file into memory
E.g. "exec"
Loader is part of OS
cross-compilation
-----------
Using a compiler on one platform (os + processor) to generate machine code for
another platform (target).
Typically compilers by default will generaet machine code for "same" platform on
which they execute.
Compilers, good ones, like GCC can be used to do cross-compilation.
E.g. you can run gcc on Ubuntu+x86 to generate an executable file for ARM+some OS.
cross-compilation is needed if compiler does not exist on the "target" platform.