Linker
The linker takes files generated by the Compilation and combines them into a single executable file. The linker performs several important tasks, including:
- Resolving symbols: The linker resolves symbols, which are identifiers used in the code that represent memory addresses, function addresses, and other data. The compiler generates symbols for the object files it produces, and the linker combines these symbols into a single symbol table, resolving any duplicates or conflicts.
- Combining object files: The linker combines the object files generated by the compiler into a single executable file. This executable file contains all the code and data needed to run the program, including any libraries that the program depends on.
- Relocating code: The linker relocates the code to the correct memory addresses. This allows the same executable file to run on different systems without modification.
- Generating relocation information: The linker generates relocation information, which is data that allows the operating system to load the executable file into memory and run it.
Command
ld -o hello -dynamic-linker /lib/ld-linux.so.2 -L/usr/lib/gcc-lib/i386-slackware-linux/3.2.2 -L/usr/i386-slackware-linux/lib /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/crtbegin.o /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/crtend.o /usr/lib/crtn.o hello.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh
Status:: #wiki/notes/mature
Plantations:: Software Development - 20230221103859
References:: ILOG