Generating a linker map file during C/C++ compilation instructs GNU ld or LLVM lld to output detailed memory segment allocations, symbol addresses, and section sizes.

GCC Linker Map Compilation Commands

Terminal Compilation Commandsbash
# Pass -Wl,-Map option through GCC to GNU linker
gcc -o myprogram main.c -Wl,-Map=myprogram.map
 
# Inspect symbol addresses in generated map file
grep -A 5 ".text" myprogram.map