What should I know about linking?

Linking was most useful in the age of limited computing resources, on self-hosting systems. Since our customers are cross-developing, and compiling resources are effectively unlimited (given the typical sizes of the embedded executables they create), linking has declined in importance.

We advocate Absolute Code Mode, a single compile-and-link step. Absolute Code Mode simply compiles the main C module to an executable, as opposed to an object file.

In fact, choosing to use object files can raise some interesting consequences:

  • Our compilers perform application-level optimization, to allow the compiler to pare the executable down as much as possible. This requires that #pragma directives from the device header file be present (or #included) in the linker command file, and that preprocessor directives can also appear there.
  • When compiling to object, the compiler will raise an error when #included files are missing. It will do this even when the #include is discounted by preprocessor statements (conditional compilation).