Which GCC Built My Kernel?

I'm playing around with the kqemu accelerator for the QEMU virtualization software. I can't remember which version of gcc I used to build my kernel. I have 3.4.6 and 4.1.1 on this (Gentoo) system. I seem to remember there is some command I can run against binaries that will tell me what gcc (and linker, etc..) built them. so far my searches have only turned up:

gcc -v (Shows me what version of GCC I have)

and

uname -a (which shows me all the kernel info except which GCC built it)

Any suggestions?

Try nm on the binary and see what symbols it spits out.

But if the binary is stripped i.e. built with the -s flag, then I dont think nm will output anything.

cat /proc/version | head -n1 | cut -d" " -f1-3,5-7

awk '{print $5,$6,$7}' /proc/version

or just

awk '{print $7}' /proc/version

to get the version number directly - 4.1.1 in my case.

I've been on vacation, but the answers referring to /proc/version are exactly what I needed!:slight_smile: