3.4k views
1 vote
3. Compilers and Assemblers translate each source file individually to generate object code files. Hence the object files need to be linked together before they can be executed. Theoretically, however, it is possible to skip the linking step and directly have compilers generate the final executable file. What would be the downside of taking the latter approach

1 Answer

2 votes

Answer:

This could lead to a build error as the process called relocation is bypass which makes reference to external symbols, assigns final addresses to functions and variables, and rechecks code and data to match new addresses.

Step-by-step explanation:

There are four stages in running a C language source code, they are;

  • Preprocessing
  • Compilation
  • Assembly
  • Linking

Preprocessing processes the file contents like the include statement, conditions, functions, etc. The Compilation stage compiles the file to an assembly file, while the Assembly stage creates an assembly list and offset of the assembly code and stores it in an object file. The linking stage relocates the object file to execute the program.

User Bjoern
by
4.6k points