Assembling & Linking Flashcards
What does an assembler do?
Reads an assembly language source file from beginning to end, producing an (relocatable) object file as output
A symbol table maps ______ to _______
symbols; values
Absolute Symbol
Symbol whose value does not depend on where in memory the current segment is loaded
Relocatable
Non-absolute symbols
What is a backpatch list?
Describes dependency of code/data on unknown information
What does a linker do?
Combines several relocatable object files to produce a single executable file
What is static linking?
Linking prior to runtime; copies library into program
What is dynamic linking?
Library not copied into program, but has references to functions in it. System looks for library at runtime.
What are strong symbols?
Procedures and initialized globals
What are weak symbols?
Uninitialized globals
What are the Linker’s symbol rules?
1.
2.
3.
- Multiple strong symbols are not allowed
- Given a strong symbol and multiple weak symbols, choose the strong symbol
*(reference to weak symbol resolve to strong symbol) - If there are multiple weak symbols, pick and arbitrary one
*(can be overridden with gcc -fno-common)
What is an ELF (Executable and Linkable Format)
Standard binary format for object files
What is the standard binary format for object files?
ELF (Executable and Linkable Format)
Where should libraries be put in the command line?
At the end
What is linking?
Technique that allows programs to be constructed from multiple object files