3.4. Linking a program

As mentioned earlier, building an executable binary file from a source code file is a multi-stage process.

The gcc compiler usually carries all these steps for you by default. However you can stop gcc at any of these stages for various reasons. You have already seen how to create assembler code from a C source code file. In most software projects, output binaries are built from many source code files. For this purpose you have to compile these source code files to object files one by one before you can generate the output binary file. After creating these object files, you can link these files using gcc to the final executable.

The gcc compiler gets help from different programs during the four steps listed earlier in this ...

Get Linux Development Platform: Configuring, Using, and Maintaining a Complete Programming Environment, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.