Inspect a Binary Executable for Which Version of GCC Used to Compile It

GCC has its version written in the .comment section of the executable binaries as shown by commands:

objdump -s --section .comment /path/to/binary
# or pretty print
readelf -p .comment /path/to/binary

Credits