What are gcc linker map files used for?

I recommend generating a map file and keeping a copy for any software you put into production.

It can be useful for deciphering crash reports. Depending on the system, you likely can get a stack dump from the crash. The stack dump will include memory addresses and one of the registers will include the Instruction Pointer. That tells you the memory address code was executing at. On some systems, code addresses can be moved around (when loading dynamic libraries, hence, dynamic), but the lower order bytes should remain the same.

The map file is a MAP from memory location -> code location. It gives you the name of the function at a given memory address. Due to optimizations, it may not be extremely accurate, but it gives you a place to start in terms of looking for bugs that cause the crash.

Now, in 30 years of writing commercial software, this is the only thing I've used the map files for. Twice successfully.


What are the ".map" files generated by gcc/g++ linker option "-Map" used for?

There is no such thing as 'gcc linker' -- GCC and linker are independent and separate projects.

Usually the map is used for understanding decisions that ld made while linking the binary. From man ld:

-M
   --print-map
       Print a link map to the standard output.
       A link map provides information about the link, including the following:
       ·   Where object files are mapped into memory.
       ·   How common symbols are allocated.
       ·   All archive members included in the link, with a mention of the symbol which caused the archive member to be brought in.
       ·   The values assigned to symbols.
       ...

If you don't understand what that means, you likely don't (yet) have the questions that this output answers, and hence have no need to read it.