Overview of the lowering of a textual assembly file
The process of assembling a textual assembly file consists of taking a textual assembly file and turning it into a sequence of bits that comply with the target file format.
During this process, there are two main things that need to happen:
- The encoding of the instructions, which you discovered how to do in Chapter 12
- The encoding of the addresses of the symbols, such as the target of a jump or a call
The second point represents the main difficulty in assembling a textual assembly file. Indeed, resolving the address of a symbol may only be possible at (dynamic) link time when all object files and libraries are finally known.
In other words, the assembler needs to resolve all the symbols as best as it can, then leave some directive to the linker, called relocations, for the ones it could not resolve.
Figure 21.1 shows the overall steps that the assembler goes through when lowering assembly code...