Assembling with the LLVM infrastructure
The LLVM infrastructure uses the same overall pipeline for producing both textual assembly files and object files.
In both cases, the process is guided by your target-specific AsmPrinter pass, which you wrote in Chapter 12. What changes to produce the different types of files is the actual implementation of the MCStreamer class. Figure 21.2 captures this difference:

Figure 21.2: How the target-specific AsmPrinter class produces a textual assembly or binary file
In Figure 21.2, you can see that the abstract MCStreamer class is instantiated with the MCAsmStreamer subclass to produce a textual assembly file (.s) or with one of the MCObjectStreamer subclasses to produce the related binary file format (.o): the MCELFStreamer class for ELF, the MCXCoffStreamer class for COFF, and so on.
The subclasses of the MCObjectStreamer class encapsulate all the logic to produce the layout of the related object file format, including the...