I used to use -frecord-gcc-switches
to embed a version string in a binary.
With gcc 10.4, when compiling some c code with -Wall -Werror -O3 -frecord-gcc-switches -DVERSION_THING=123hello
, I'd get the following output from readelf -p .GCC.command.line
String dump of section '.GCC.command.line':
[ 0] -fdiagnostics-color=always
[ 1b] -imultiarch x86_64-linux-gnu
[ 38] -iprefix /opt/compiler-explorer/gcc-10.4.0/bin/../lib/gcc/x86_64-linux-gnu/10.4.0/
[ 8b] -D VERSION_THING=123hello
[ a5] /app/example.c
[ b4] -mtune=generic
[ c3] -march=x86-64
[ d1] -g
[ d4] -O3
[ d8] -Wall
[ de] -Werror
[ e6] -frecord-gcc-switches
However, with gcc 11.1 and later, I get this
String dump of section '.GCC.command.line':
[ 0] GNU C17 11.1.0 -mtune=generic -march=x86-64 -g -O3
Does anybody know where I should be looking to see what's changed between versions and why with regard to -frecord-gcc-switches
and if it's possible to get the old behaviour back?