Adding a custom toolchain
In the previous section, we learned how to add custom flags for the driver in Clang and learned how the driver translated them into flags that are accepted by the frontend. In this section, we are going to talk about the toolchain – an important module inside the driver that helps it adapt to different platforms.
Recall that in the first section of this chapter, Understanding drivers and toolchains in Clang, we showed the relationships between driver and toolchains in Figure 8.1: the driver chooses a proper toolchain based on the target platform before leveraging its knowledge to do the following:
- Execute the correct assembler, linker, or any tool that is required for the target code's generation.
- Pass platform-specific flags to the compiler, assembler, or linker.
This information is crucial for building the source code since each platform might have its own unique characteristics, such as system library paths and supported...