The binary elf will by default contain the signature of the version of the compiler used.
Now, as for the compiler flags used, if is -frecord-gcc-switches
used at compile time, you can find the signature in the ELF executable.
g++ -frecord-gcc-switches -std=c++0x trial.cpp
readelf -p .GCC.command.line a.out
Reset section line .GCC.command.line ':
[ 0] -imultilib . [ d] -imultiarch x86_64-linux-gnu [ 2a] -D_GNU_SOURCE [ 38] trial.cpp [ 42] -mtune=generic [ 51] -march=x86-64 [ 5f] -std=c++0x [ 6a] -frecord-gcc-switches [ 80]
-fstack-protector
source
share