compiler info in kernel identification string
Dimitry Andric
dim at FreeBSD.org
Wed Nov 14 09:42:17 UTC 2012
On 2012-11-14 08:01, Daniel Braniss wrote:
> in the old days (I'm talking before C :-) I remmeber one compiler
> putting such info in the code it produced, I wonder if that's the case
> with gcc/clang, and if so it would be nice if file(1) could show it.
> my 3c,
As far as I know, gcc has always included such information:
$ touch empty.c
$ gcc -c empty.c
$ objdump -j .comment -s empty.o
empty.o: file format elf32-i386-freebsd
Contents of section .comment:
0000 00474343 3a202847 4e552920 342e322e .GCC: (GNU) 4.2.
0010 31203230 30373038 33312070 61746368 1 20070831 patch
0020 6564205b 46726565 4253445d 00 ed [FreeBSD].
$ gcc47 -c empty.c
$ objdump -j .comment -s empty.o
empty.o: file format elf32-i386-freebsd
Contents of section .comment:
0000 00474343 3a202846 72656542 53442050 .GCC: (FreeBSD P
0010 6f727473 20436f6c 6c656374 696f6e29 orts Collection)
0020 20342e37 2e332032 30313230 39323920 4.7.3 20120929
0030 28707265 72656c65 61736529 00 (prerelease).
There is an old LLVM PR to get the same supported for clang, but it
ended up at the bottom of the pile:
http://llvm.org/bugs/show_bug.cgi?id=7292
I should probably just make a patch for it, and submit it. :-)
More information about the freebsd-current
mailing list