Linker Errors Every Embedded Engineer Must Understand

Compilation creates object files.
The linker builds the final program.
When symbols don’t match, the build breaks.

1. What the Linker Actually Does

In embedded development, source files are first compiled into object files. These object files contain machine code but may still reference functions or variables defined in other modules.

The linker combines these object files and resolves all symbol references to produce the final executable image.

If the linker cannot resolve a reference, the build fails with a linker error.

Understanding these errors is essential when building firmware with multiple source files, libraries, and hardware-specific startup code.

2. Undefined Reference

One of the most common linker errors occurs when a function or variable is declared but never defined.

Example scenario:
  • A function prototype exists in a header file
  • The actual implementation is missing or not compiled

The linker cannot find the symbol and produces an undefined reference error.

In embedded systems, this often happens when:
  • a source file is not included in the build
  • a library is missing
  • a function implementation was forgotten

3. Multiple Definition Errors

Another common issue occurs when the same symbol is defined in more than one source file.

For example, defining a global variable in multiple modules without using proper declarations can cause multiple definition errors.

The linker cannot decide which version should be used and stops the build.

Proper use of extern declarations and single definitions prevents this issue.

4. Missing Startup or Vector Table

Embedded systems require special startup code that initializes the runtime environment before main() executes.

If the startup file or interrupt vector table is missing or incorrectly linked, the firmware may fail to build or produce incorrect binaries.

This problem often appears when:
  • porting code to a new microcontroller
  • modifying linker scripts
  • removing startup files accidentally

5. Memory Region Overflow

Embedded systems have limited memory regions such as Flash and RAM.

If the program exceeds these limits, the linker will generate an error indicating that a memory region has overflowed.

This usually happens when:
  • large buffers are allocated
  • code size grows beyond Flash capacity
  • stack and heap allocations exceed RAM limits

Understanding the linker script and memory layout is critical when diagnosing these issues.

6. Practical Insight

Linker errors often look confusing because they occur after compilation, when the program is being assembled into its final form.

However, they usually indicate:
  • missing implementations
  • incorrect symbol declarations
  • build configuration problems
  • memory layout issues

Developers who understand how the linker works can diagnose these errors much faster.
Compilers translate code.
Linkers assemble programs.
When symbols don’t match, the system cannot exist.